Module: Gitploy
Defined Under Namespace
Classes: Config
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #action ⇒ Object
- #configure {|config| ... } ⇒ Object
- #current_stage ⇒ Object
- #deploy ⇒ Object
- #local ⇒ Object
- #push! ⇒ Object
- #rake(task) ⇒ Object
- #remote ⇒ Object
- #run(cmd) ⇒ Object
- #setup ⇒ Object
- #stage(name) ⇒ Object
- #sudo(cmd) ⇒ Object
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/gitploy.rb', line 3 def config @config end |
Instance Method Details
#action ⇒ Object
35 36 37 |
# File 'lib/gitploy.rb', line 35 def action ARGV[1] end |
#configure {|config| ... } ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/gitploy.rb', line 21 def configure config = Config.new yield config; config.check! config.local_branch ||= current_branch config.remote_branch ||= 'master' self.config = config end |
#current_stage ⇒ Object
31 32 33 |
# File 'lib/gitploy.rb', line 31 def current_stage ARGV[0] end |
#deploy ⇒ Object
43 44 45 |
# File 'lib/gitploy.rb', line 43 def deploy yield unless action == 'setup' end |
#local ⇒ Object
56 57 58 59 |
# File 'lib/gitploy.rb', line 56 def local yield pretty_run("LOCAL", flush_run_queue) end |
#push! ⇒ Object
73 74 75 |
# File 'lib/gitploy.rb', line 73 def push! local { run "git push #{config.user}@#{config.host}:#{config.path}/.git #{config.local_branch}:#{config.remote_branch}" } end |
#rake(task) ⇒ Object
69 70 71 |
# File 'lib/gitploy.rb', line 69 def rake(task) run("rake #{task}") end |
#remote ⇒ Object
51 52 53 54 |
# File 'lib/gitploy.rb', line 51 def remote yield pretty_run(config.host, "ssh #{config.user}@#{config.host} '#{flush_run_queue}'") end |
#run(cmd) ⇒ Object
61 62 63 |
# File 'lib/gitploy.rb', line 61 def run(cmd) run_queue << cmd end |
#setup ⇒ Object
47 48 49 |
# File 'lib/gitploy.rb', line 47 def setup yield if action == 'setup' end |
#stage(name) ⇒ Object
39 40 41 |
# File 'lib/gitploy.rb', line 39 def stage(name) yield if name.to_s == current_stage end |
#sudo(cmd) ⇒ Object
65 66 67 |
# File 'lib/gitploy.rb', line 65 def sudo(cmd) run("sudo #{cmd}") end |