Class: Scales::Up
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Scales::Up
- Includes:
- Helper::ContentTypes, Rake::DSL
- Defined in:
- lib/scales/up.rb
Constant Summary collapse
- @@application =
Worker::Application::Rails
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#paths ⇒ Object
Returns the value of attribute paths.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Up
constructor
A new instance of Up.
- #push(format, options) ⇒ Object
- #update(*new_paths, params) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Up
Returns a new instance of Up.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/scales/up.rb', line 21 def initialize(*args) @name = args.shift || :up @paths = [] @app = nil @pusher = Scales::Worker::Pusher.new desc "Scale up task" unless ::Rake.application.last_comment task name do RakeFileUtils.send(:verbose, verbose) do @app = Up.application.initialize_environment! yield self if block_given? @pusher.push!(@paths) end end end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
7 8 9 |
# File 'lib/scales/up.rb', line 7 def app @app end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/scales/up.rb', line 6 def name @name end |
#paths ⇒ Object
Returns the value of attribute paths.
8 9 10 |
# File 'lib/scales/up.rb', line 8 def paths @paths end |
Class Method Details
.application ⇒ Object
42 43 44 |
# File 'lib/scales/up.rb', line 42 def application @@application end |
.application=(application) ⇒ Object
46 47 48 |
# File 'lib/scales/up.rb', line 46 def application=(application) @@application = application end |
Instance Method Details
#push(format, options) ⇒ Object
10 11 12 |
# File 'lib/scales/up.rb', line 10 def push format, paths << { :format => format, :push => true }.merge() end |
#update(*new_paths, params) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/scales/up.rb', line 14 def update *new_paths, params raise "Please define a format like this :format => :html" unless params.is_a?(Hash) format = params.delete(:format) raise "Unknown format :#{format}" if format.to_content_type.nil? new_paths.each{ |path| paths << { :format => format, :to => path }} end |