rake

Trouble with Ruby on Rails with Rake

可紊 提交于 2019-12-21 19:52:20
问题 I'm very new to Rails, so please forgive my lack of understanding. I've installed the latest versions of RubyGems, Ruby, Rails, Rake, and MySQL etc via RubyGems, but I have this problem when starting to make a basic Rails app: Icarus:temporary atg$ rails new people ... (output omitted) ... Icarus:temporary atg$ cd people Icarus:people atg$ rake db:create (in /Users/atg/temporary/people) rake aborted! uninitialized constant Bundler /Users/atg/temporary/people/Rakefile:4 (See full trace by

Making the database.yml file work in Rails on OSX

南笙酒味 提交于 2019-12-21 09:17:17
问题 I understand that using postgres on osx is a little difficult because it has its own version running, and so in order to psql to it you need to supply the host name like so psql -h localhost mydatabasename -U me However how do you do this for your database.yml file for all the rail loveliness. If you try to connect with development: adapter: postgresql username: me database: mydatabasename you receive the classic Couldn't create database for {"adapter"=>"postgresql", "username"=>"me",

DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support will be removed in Rails 4.0 [duplicate]

微笑、不失礼 提交于 2019-12-21 09:15:03
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Rails 2.3-style plugins and deprecation warnings running task in Heroku I am running rake db:migrate gives me the following warnings and then aborts: $ heroku rake db:migration --trace DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support forthese plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and

How to call a rake task in rspec

巧了我就是萌 提交于 2019-12-21 08:45:51
问题 I am trying to invoke a rake task in in my rspec. require "rake" rake = Rake::Application.new Rake.application = rake rake.init rake.load_rakefile rake['rake my:task'].invoke But i am getting error Failure/Error: rake['rake db:migrate'].invoke RuntimeError: Don't know how to build task 'rake db:migrate' Does anyone have a idea how we can invoke rake task in rspec code. Any help would be highly appreciated. 回答1: To pass in the arguments in square brackets to invoke : rake sim:manual_review

How to call a rake task in rspec

99封情书 提交于 2019-12-21 08:45:10
问题 I am trying to invoke a rake task in in my rspec. require "rake" rake = Rake::Application.new Rake.application = rake rake.init rake.load_rakefile rake['rake my:task'].invoke But i am getting error Failure/Error: rake['rake db:migrate'].invoke RuntimeError: Don't know how to build task 'rake db:migrate' Does anyone have a idea how we can invoke rake task in rspec code. Any help would be highly appreciated. 回答1: To pass in the arguments in square brackets to invoke : rake sim:manual_review

Accepting user input from the console/command prompt inside a rake task

雨燕双飞 提交于 2019-12-21 07:28:29
问题 I'm writing a custom rake task for Rails, and there is a point the program where it summarises what it's going to do and then asks the user if what it's about to do is correct. puts "\n Is this what you want to happen? [Y/N]" answer = gets.chomp if answer == "Y" # commits else if answer == "N" return false #(Aborts the rake task) end However, this code causes the rake to be aborted prematurely; rake aborted! No such file or directory - populate " populate " is the name of the rake task. I

On Unix, find if user who executed the program is root?

一曲冷凌霜 提交于 2019-12-21 07:10:09
问题 I'm writing a rake script and would like to detect (using Ruby rather than bash if possible) if the user who executed the rake script has root privileges. If it is not root then I would like to terminate the script. 回答1: Use uid or euid in the Process class: raise 'Must run as root' unless Process.uid == 0 回答2: I don't know Ruby, but what you want to check for is if the user ID is 0. In C, you would do this by checking getuid(). From the Unix command line, you could also check the output of

Rake multitask with a variable task list

前提是你 提交于 2019-12-21 05:32:17
问题 I've read some posts, tips and tutorials about using rake arguments and rake multitask. The following would be some simple examples. multitask 'build_parallel' => ['build_a', 'build_z'] or multitask :mytask => [:task1, :task2, :task3] do puts "Completed parallel execution of tasks 1 through 3." end My question: What is the best way to build a global variable in one task that I can then use in my multitask? The following doesn't execute task1, task2, task3...which means the global $build_list

How does `rake` know where to look for Rakefiles?

半世苍凉 提交于 2019-12-21 05:06:10
问题 I'm trying to better understand how rake works. I've looked on the rake website to see how it works but there isn't a clear explanation for how rake searches for Rakefiles and the steps it goes through in resolving dependencies. Can someone explain how rake works? 回答1: By default rake will look for one of these files under the directory you execute it from : rakefile Rakefile rakefile.rb Rakefile.rb You can look at Rake's Application docs to see this list Additionally, any ruby file including

Rake uninitialized constant RDoc::RDoc

谁说我不能喝 提交于 2019-12-21 04:29:18
问题 When ever I run make I get this 'uninitialized constant RDoc::RDoc' error rake -T (in Main) rake aborted! uninitialized constant RDoc::RDoc C:/Ruby186/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' (See full trace by running task with --trace) --edit Running --trace it seems the only non rails code is from rdoc_rails. Since other people seem to be able to run it fine I assume I am missing a gem or plugin but I can't figure out which. 回答1: It looks like i have to