Class: Oops::Tasks
Instance Attribute Summary collapse
-
#additional_paths ⇒ Object
Returns the value of attribute additional_paths.
-
#excludes ⇒ Object
Returns the value of attribute excludes.
-
#format ⇒ Object
Returns the value of attribute format.
-
#includes ⇒ Object
Returns the value of attribute includes.
-
#prerequisites ⇒ Object
Returns the value of attribute prerequisites.
Class Method Summary collapse
Instance Method Summary collapse
- #add_file(file_path, path) ⇒ Object
-
#initialize {|_self| ... } ⇒ Tasks
constructor
A new instance of Tasks.
- #remove_file(file_path, path) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Tasks
Returns a new instance of Tasks.
19 20 21 22 23 24 25 |
# File 'lib/oops/tasks.rb', line 19 def initialize(&block) self.class.default_args.each do |key, value| public_send("#{key}=", value) end yield(self) create_task! end |
Instance Attribute Details
#additional_paths ⇒ Object
Returns the value of attribute additional_paths.
7 8 9 |
# File 'lib/oops/tasks.rb', line 7 def additional_paths @additional_paths end |
#excludes ⇒ Object
Returns the value of attribute excludes.
7 8 9 |
# File 'lib/oops/tasks.rb', line 7 def excludes @excludes end |
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/oops/tasks.rb', line 7 def format @format end |
#includes ⇒ Object
Returns the value of attribute includes.
7 8 9 |
# File 'lib/oops/tasks.rb', line 7 def includes @includes end |
#prerequisites ⇒ Object
Returns the value of attribute prerequisites.
7 8 9 |
# File 'lib/oops/tasks.rb', line 7 def prerequisites @prerequisites end |
Class Method Details
.default_args ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/oops/tasks.rb', line 9 def self.default_args { prerequisites: ['assets:clean', 'assets:precompile'], additional_paths: [], includes: ['public/assets'], excludes: ['.gitignore'], format: 'zip' } end |
Instance Method Details
#add_file(file_path, path) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/oops/tasks.rb', line 27 def add_file file_path, path if format == 'zip' sh *%W{zip -r -g build/#{file_path} #{path}} elsif format == 'tar' sh *%W{tar -r -f build/#{file_path} #{path}} end end |
#remove_file(file_path, path) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/oops/tasks.rb', line 35 def remove_file file_path, path if format == 'zip' sh *%W{zip build/#{file_path} -d #{path}} elsif format == 'tar' sh *%W{tar --delete -f build/#{file_path} #{path}} end end |