rake

Octopress failed on running rake preview

不打扰是莪最后的温柔 提交于 2019-12-24 00:52:37
问题 It's a little wired that, I tried to install octopress, everything went very well, but I just can't use the rake preview . There are some information when I tried to view preview: Server seems no problem at all: bash-3.2$ rake preview Starting to watch source with Jekyll and Compass. Starting Rack on port 4000 Configuration from /Users/Gizak/Documents/oct/_config.yml [2013-12-23 16:12:21] INFO WEBrick 1.3.1 [2013-12-23 16:12:21] INFO ruby 2.0.0 (2013-06-27) [universal.x86_64-darwin13] [2013

How do I run a shell command inside a rake task as administrator?

梦想的初衷 提交于 2019-12-23 22:40:25
问题 I have a short .cmd file which I would like to run as part of my deployment process. Unfortunately the .cmd file requires administrator privileges. Is it possible to get administrator permission from within rake, or do I need to start the shell as admin? 回答1: You can try the runas command. I don't know what your rake task looks like, but if you're running Kernel#system , try task :foo do system "runas /profile /user:#{ENV["COMPUTERNAME"]}/Administrator mybatchfile.cmd" end Only trouble is,

rake undefined method `gsub' for nil:NilClass

我的梦境 提交于 2019-12-23 19:01:07
问题 I'm hoping there is someone out here with a few encouraging words and a little advice. I am using Ruby v1.9.2 p290 I've been setting up a new production server and I'm having a terrible time trying to get the new environment to work correctly. Everything is installed and now I'm trying to run rake , but it is giving me an error I can't make any sense of and can't find any internet help on. deploy@ip-10-99-66-30:~/pm$ rake -v --trace rake aborted! undefined method `gsub' for nil:NilClass /usr

db:seed is throwing an error

我们两清 提交于 2019-12-23 18:36:20
问题 I'm using ruby 1.9.2 with rails 3.0.9. Whenever I try to execute rake db:seed it throws following error: rake aborted! uninitialized constant EmployeeCategory I've disabled threadsafe and enabled 'dependency_loading in config/application.rb file. config.threadsafe! unless $rails_rake_task config.dependency_loading = true But it is still not working. Here's the content of seed.rb file StudentCategory.destroy_all StudentCategory.create([ {:name=>"OBC",:is_deleted=>false}, {:name=>"General",:is

accessing rails models from rake task

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 17:54:45
问题 How can I access model objects from rails rake task? If I initialize my rufus scheduler $scheduler = Rufus::Scheduler.start_new in my rake would that scheduler stay alive since it's from a rake task? 回答1: To access a rails model in your rake task you need to load the :environment. task :my_task => [:environment] do User.new #... end You would not call the scheduler within a task but the other way around. You need to start a Rufus scheduler and then call your rake tasks from them. You need to

Custom rake task for DB: Table not found

牧云@^-^@ 提交于 2019-12-23 15:43:38
问题 I have a custom rake task, that creates a development DB with data for various situation. The core looks like this: namespace :db do task setup_seed: :environment do Rake::Task['db:drop'].invoke Rake::Task['db:create'].invoke Rake::Task['db:schema:load'].invoke Rake::Task['db:migrate'].invoke Rake::Task['db:test:prepare'].invoke Rake::Task['db:seed'].invoke end end Everything runs fine, until db:seed is invoked, because it throws an error that tables does not exist. This is my seed.rb : puts

How to re-enable Test::Unit in Rails 4 after 'rails new app --skip-test-unit'

我是研究僧i 提交于 2019-12-23 12:32:36
问题 I used rails new app --skip-test-unit because initially, I thought I could add testing later. I developed a significant portion of my app. Now, I would like to add Test::Unit but I couldn't find any documentation on how to do it. Googling only lead me to the Rails Guides and tutorials that assume you didn't ask rails to skip the testing framework when you first created the app. I know I might be able to figure out what _test.rb files to add manually and how to modify the Rakefile (by looking

What is the purpose of Rake?

扶醉桌前 提交于 2019-12-23 09:31:47
问题 I know Rake stands for Ruby Make, and I know Make is a unix build utility. Now, I come from working in Xcode building iPhone apps to Ruby, so I have never used Make before, and the only time I use rake is when in rails or installing some third party package and I type a command like rake db:migrate . The things I don't understand are ... What exactly is a build utility? What is the purpose of rake? What does it let me do? So if anyone can help answer any of these questions for me, it would be

Set Multiple Environmental Variables On Invocation of Rake Task

空扰寡人 提交于 2019-12-23 09:03:02
问题 I can invoke a Rake task and set a single environmental variable like this: $ ONE=1 rake temp:both But how do I set two environmental variables? This doesn't work: $ ONE=1 TWO=2 rake temp:both This works, but is confusing to read: $ ONE=1 rake temp:both TWO=2 How can I pass more than one env before the call to rake ? 回答1: Agree with @Ernest; it should work. Here's a sample... Sample rake task to echo vars: task :echo_env do puts "VAR1: #{ENV['VAR1']}" puts "VAR2: #{ENV['VAR2']}" end Execute

Rails Seed-Fu Writer why seed got commented out?

前提是你 提交于 2019-12-23 02:38:27
问题 So, here's my custom rake task: task :backup => :environment do |t| SeedFu::Writer.write('/path/to/file.rb', class_name: 'Category', constraints: [:id] do |w| Category.all.each do |x| w << x end end end And the following result file contains: # DO NOT MODIFY THIS FILE, it was auto-generated. # # Date: 2014-06-15 21:08:13 +0700 # Seeding Category # Written with the command: # # /home/dave/.rvm/gems/ruby-2.1.2/bin/rake backup # Category.seed(:id, #<Category id: 1, name: "foo">, #<Category id: 2