Module: Miniploy::DSL
- Included in:
- Deploy
- Defined in:
- lib/miniploy/dsl.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#bundle_add ⇒ Object
Returns the value of attribute bundle_add.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#ssh_args ⇒ Object
Returns the value of attribute ssh_args.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
- #app_path ⇒ Object
- #append(filepath, content) ⇒ Object
- #bundle_run(cmd) ⇒ Object
- #rake(task) ⇒ Object
- #run(cmd) ⇒ Object
- #run_path ⇒ Object
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
3 4 5 |
# File 'lib/miniploy/dsl.rb', line 3 def app @app end |
#bundle_add ⇒ Object
Returns the value of attribute bundle_add.
3 4 5 |
# File 'lib/miniploy/dsl.rb', line 3 def bundle_add @bundle_add end |
#repository ⇒ Object
Returns the value of attribute repository.
3 4 5 |
# File 'lib/miniploy/dsl.rb', line 3 def repository @repository end |
#ssh_args ⇒ Object
Returns the value of attribute ssh_args.
3 4 5 |
# File 'lib/miniploy/dsl.rb', line 3 def ssh_args @ssh_args end |
#target ⇒ Object
Returns the value of attribute target.
3 4 5 |
# File 'lib/miniploy/dsl.rb', line 3 def target @target end |
Class Method Details
.hook(*methods) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/miniploy/dsl.rb', line 30 def self.hook(*methods) methods.each do |method| eval <<-eoh def #{method}(&block) @hooks ||= {} if block_given? @hooks[:#{method}] = block else @hooks[:#{method}].call end end eoh end end |
Instance Method Details
#app_path ⇒ Object
5 6 7 |
# File 'lib/miniploy/dsl.rb', line 5 def app_path "apps/#{app}" end |
#append(filepath, content) ⇒ Object
9 10 11 |
# File 'lib/miniploy/dsl.rb', line 9 def append(filepath, content) run "echo \"#{content}\" >> #{filepath}" end |
#bundle_run(cmd) ⇒ Object
13 14 15 |
# File 'lib/miniploy/dsl.rb', line 13 def bundle_run(cmd) run "cd #{app_path} && RACK_ENV=production bundle exec #{cmd}" end |
#rake(task) ⇒ Object
17 18 19 |
# File 'lib/miniploy/dsl.rb', line 17 def rake(task) bundle_run "rake #{task}" end |
#run(cmd) ⇒ Object
21 22 23 24 |
# File 'lib/miniploy/dsl.rb', line 21 def run(cmd) puts ">> `#{cmd}`" raise RuntimeError unless ssh(cmd) end |
#run_path ⇒ Object
26 27 28 |
# File 'lib/miniploy/dsl.rb', line 26 def run_path "#{app_path}/tmp/run" end |