rake

rails secret_key_base not being recognized in production

蓝咒 提交于 2019-12-10 03:00:33
问题 So I am trying to deploy my rails app in production. When I go to the page I get a 500 error. When I go to my error logs I get the following error: Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`) I am running Rails 4.1 and my config/secrets.yml looks like this: development: secret_key_base: <development key> test: secret_key_base: <test key> # Do not keep production secrets in the repository, #

Rake Task: error handling

点点圈 提交于 2019-12-10 01:34:54
问题 I am still learning Rake. Does Rake has built in support to handle task's error like MSBuild of NANT: if this task failed; execute anoter tasks (rolling back, etc.) e.g.: in MSBuild they have OnError element <OnError ExecuteTargets="RollBackDatabase" /> Thanks for your help 回答1: Found out the answer: just use normal exception handling block task :will_fail_task do begin raise "something's wrong here" rescue rollback() raise "error executing task" end end 来源: https://stackoverflow.com

RubyMine debugger with Rake?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 01:28:27
问题 Using RubyMine 3.0, I set up a Rake configuration to run a Unit Test. Then I set some breakpoints, then ran the Rake task. No breakpoints were hit, the test just executed like normal and then exited. Does the RubyMine debugger not work through Rake? 回答1: Try this: Go to Run -> Edit Configurations Expand the Rake node and add new rake configuration for your rake task (if not already done) Go to Run -> Debug... Select your configured rake task. 回答2: The above answer is correct. I just want to

How to use input filename to generate output filename with Rake?

守給你的承諾、 提交于 2019-12-09 22:52:00
问题 I've got some input files which I want to encode using Ruby. The output from the encoding should match some pattern based on the filename of the input file. In order to not do this by hand, I want to use Rake as help for automation. Further I'd like to not specify a single task for every input file. I've tried some FileList "magic" but it didn't work out. Here's the code: desc 'Create all output from specified input' task :encode do FileList['input/*.txt'].each {|input| file "output/output_#

rake / rails .save! not updating database

我只是一个虾纸丫 提交于 2019-12-09 16:12:06
问题 I am trying to save changes to my database trough a rake task. In my rake task I do something like: namespace :parts do desc "Update Parts table, swap names in title" task :swap => :environment do Part.swap end end In my Part class I do def self.swap Part.all.each do |part| if (part.title =~ REGEX) == 0 part.title.gsub! REGEX, '\2 \1' puts part.title part.save! end end end However, this does not save the part. The save! does return true. the puts part.title does return the value I want. If I

how do you activate or set the default rake?

ぐ巨炮叔叔 提交于 2019-12-09 15:46:52
问题 I have seen many You have already activated rake 0.9.x, but your Gemfile requires rake 0.x.x errors. Of course, they can be solved (temporarily or always) by some methods like the following. bundle exec rake The method above works but you always have to type bundle exec. It can also be solved by bundle update But bundle update also updates your other gems. Some say it can be solved by gem uninstall unwanted_rake_version Yes, the unwanted rake can be installed but it is still marked as

Is there a “method_missing” for rake tasks?

随声附和 提交于 2019-12-09 15:32:34
问题 If my Rakefile does not find a task with a particular name, I'd like rake to instead create a new task by that name according to certain rules, if a file with the missing task name exists. But if it doesn't, I want to fall back to the default ("Don't know how to build task 'foo'!"). In short, is there a method_missing for Rake? 回答1: I haven't tried it, but a quick search revealed this. If you define a rule with an empty string, you can catch any task that hasn’t been defined elsewhere. This

Run initializer only for Rake tasks

痴心易碎 提交于 2019-12-09 12:59:37
问题 I'd like a certain initializer to run when executing a Rake task, but not when running the Rails server. What is the best way to differentiate a Rake invocation and a server invocation? 回答1: Rake allows you to specify dependencies for your tasks. The best recommended action would be for you to put your rake-specific initialization in its own task that in turn depends on the "environment" task. For example: namespace :myapp do task :custom_environment => :environment do # special

GitLab sidekiq failing test

那年仲夏 提交于 2019-12-09 12:58:06
问题 I am following the instructions here: https://github.com/gitlabhq/gitlabhq/blob/4-1-stable/doc/install/databases.md When I try to run the tests: sudo -u gitlab -H bundle exec rake gitlab:env:info RAILS_ENV=production sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production The first test returns orange headers, the second test shows an error with Sidekiq: Checking Sidekiq ... Running? ... no Try fixing it: sudo -u gitlab -H bundle exec rake sidekiq:start For more information see:

Deploy Gollum wiki to Heroku

…衆ロ難τιáo~ 提交于 2019-12-09 08:39:14
问题 Gollum is "A simple, Git-powered wiki with a sweet API and local frontend." It's hosted on GitHub: http://github.com/github/gollum It seems to be a simple Sinatra app, and as such, it seems like it should be easy to deploy to Heroku. I can't seem to get it to work. Mostly because I know next to nothing about Rake and config.ru files. Is it even possible to deploy a Gollum wiki to Heroku? If so, what would my config.ru file need to look like? Update/Edit lib/gollum/frontend/app: module