Permalink
Browse files
Add the 'say' method to output messages in a nice fashion.
- Loading branch information...
Showing
with
23 additions
and
7 deletions.
-
+14
−1
README.textile
-
+9
−6
lib/inploy/dsl.rb
|
@@ -166,7 +166,20 @@ To show a "down for maintenance" page during the deployment, use the before_git |
|
|
|
|
|
If you need another hook, please fork the project and implement it. Or submit an issue, it's very easy.
|
|
|
|
|
|
-h2. CONTRIBUTORS:
|
|
|
+h3. say
|
|
|
+
|
|
|
+Use the <code>say</code> method to show messages issued by your hooks.
|
|
|
+
|
|
|
+<pre><code># Show a simple message
|
|
|
+say 'restart custom daemons'
|
|
|
+
|
|
|
+# Show a message (blank output lines are suppressed)
|
|
|
+say 'revert local changes' do |output|
|
|
|
+ output << `git checkout . 2>&1`
|
|
|
+end
|
|
|
+</pre></code>
|
|
|
+
|
|
|
+h2. CONTRIBUTORS
|
|
|
|
|
|
Inploy is brought to you by:
|
|
|
|
|
|
|
@@ -32,10 +32,6 @@ def load_module(filename) |
|
|
extend eval(filename.split("/").map { |word| camelize(word) }.join("::"))
|
|
|
end
|
|
|
|
|
|
- def log(command)
|
|
|
- puts "Inploy => #{command}"
|
|
|
- end
|
|
|
-
|
|
|
def rake(command)
|
|
|
run "rake #{command}"
|
|
|
end
|
|
@@ -56,8 +52,15 @@ def using_bundler? |
|
|
file_exists?("Gemfile")
|
|
|
end
|
|
|
|
|
|
+ def say(message)
|
|
|
+ puts "Inploy => #{message}"
|
|
|
+ output = []
|
|
|
+ yield output if block_given?
|
|
|
+ output.each {|o| puts o if o =~ /\S/ }
|
|
|
+ end
|
|
|
+
|
|
|
def run(command, disable_sudo = false)
|
|
|
- log command
|
|
|
+ say command
|
|
|
|
|
|
Bundler.with_clean_env do
|
|
|
if disable_sudo
|
|
@@ -81,7 +84,7 @@ def login_shell_wrap(cmd) |
|
|
|
|
|
def secure_copy(src, dest)
|
|
|
unless file_exists?(dest)
|
|
|
- log "cp #{src} #{dest}"
|
|
|
+ say "cp #{src} #{dest}"
|
|
|
FileUtils.cp src, dest
|
|
|
end
|
|
|
end
|
|
|
0 comments on commit
cc08d09