New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable declaration order issue #85
Comments
The workaround/solution is to use blocks for definitions, at which point definitions are evaluated when they are used. How would you propose improving on the current |
I'm not aware of rake supporting the |
Sorry, that clearly was capistrano and not rake syntax. My mistake. |
Why not use an OpenStruct object to house all of your "constants" and read/write/override them as you wish? # some_lib.rb
require 'ostruct'
MY_QUOTE_CONSTANTS = OpenStruct.new
task :foobar do
puts "now do something with #{MY_QUOTE_CONSTANTS.something}"
end
# Rakefile
require './some_lib'
MY_QUOTE_CONSTANTS.something = "that foobar thing!"
task :catdog do
MY_QUOTE_CONSTANTS.something = "that catdog thing!"
Rake::Task[:foobar].invoke
end And now to run the above code: $ rake foobar
(in /tmp)
now do something with that foobar thing!
$ rake catdog
(in /tmp)
now do something with that catdog thing! KISS, and more importantly, keep Ruby/Rake simple please! |
Yet another follow-up of issue #82.
Since there is no rake mechanism to declare constants, ruby constants are often uses to describe things like a build path or defaults. Because those are not declarative, "rakelib/*.rake" file inclusion order then rapidly start to matter when you start to have cross-dependencies.
I propose to introduce a "var" task that defines the value of it's name after the declaration phase.
The text was updated successfully, but these errors were encountered: