webbynode 1.0.2 → 1.0.3.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of webbynode might be problematic. Click here for more details.
- data/Manifest +2 -0
 - data/Rakefile +1 -1
 - data/lib/webbynode.rb +2 -1
 - data/lib/webbynode/commands/change_dns.rb +6 -1
 - data/lib/webbynode/commands/init.rb +21 -12
 - data/lib/webbynode/commands/remote.rb +1 -1
 - data/lib/webbynode/engines/all.rb +1 -0
 - data/lib/webbynode/engines/nodejs.rb +6 -0
 - data/lib/webbynode/git.rb +5 -0
 - data/lib/webbynode/io.rb +11 -1
 - data/lib/webbynode/ssh.rb +2 -2
 - data/spec/webbynode/commands/change_dns_spec.rb +13 -2
 - data/spec/webbynode/commands/init_spec.rb +65 -11
 - data/spec/webbynode/commands/remote_spec.rb +1 -1
 - data/spec/webbynode/engines/nodejs_spec.rb +12 -0
 - data/spec/webbynode/git_spec.rb +12 -6
 - data/spec/webbynode/io_spec.rb +44 -4
 - data/webbynode.gemspec +4 -4
 - metadata +9 -5
 
    
        data/Manifest
    CHANGED
    
    | 
         @@ -44,6 +44,7 @@ lib/webbynode/commands/webbies.rb 
     | 
|
| 
       44 
44 
     | 
    
         
             
            lib/webbynode/engines/all.rb
         
     | 
| 
       45 
45 
     | 
    
         
             
            lib/webbynode/engines/django.rb
         
     | 
| 
       46 
46 
     | 
    
         
             
            lib/webbynode/engines/engine.rb
         
     | 
| 
      
 47 
     | 
    
         
            +
            lib/webbynode/engines/nodejs.rb
         
     | 
| 
       47 
48 
     | 
    
         
             
            lib/webbynode/engines/php.rb
         
     | 
| 
       48 
49 
     | 
    
         
             
            lib/webbynode/engines/rack.rb
         
     | 
| 
       49 
50 
     | 
    
         
             
            lib/webbynode/engines/rails.rb
         
     | 
| 
         @@ -108,6 +109,7 @@ spec/webbynode/commands/version_spec.rb 
     | 
|
| 
       108 
109 
     | 
    
         
             
            spec/webbynode/commands/webbies_spec.rb
         
     | 
| 
       109 
110 
     | 
    
         
             
            spec/webbynode/engines/django_spec.rb
         
     | 
| 
       110 
111 
     | 
    
         
             
            spec/webbynode/engines/engine_spec.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            spec/webbynode/engines/nodejs_spec.rb
         
     | 
| 
       111 
113 
     | 
    
         
             
            spec/webbynode/engines/php_spec.rb
         
     | 
| 
       112 
114 
     | 
    
         
             
            spec/webbynode/engines/rack_spec.rb
         
     | 
| 
       113 
115 
     | 
    
         
             
            spec/webbynode/engines/rails3_spec.rb
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/webbynode.rb
    CHANGED
    
    | 
         @@ -28,6 +28,7 @@ require File.join(File.dirname(__FILE__), 'webbynode', 'engines', 'rails3') 
     | 
|
| 
       28 
28 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'engines', 'rack')
         
     | 
| 
       29 
29 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'engines', 'django')
         
     | 
| 
       30 
30 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'engines', 'php')
         
     | 
| 
      
 31 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), 'webbynode', 'engines', 'nodejs')
         
     | 
| 
       31 
32 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'engines', 'all')
         
     | 
| 
       32 
33 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'commands', 'apps')
         
     | 
| 
       33 
34 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'commands', 'addons')
         
     | 
| 
         @@ -51,7 +52,7 @@ require File.join(File.dirname(__FILE__), 'webbynode', 'commands', 'version') 
     | 
|
| 
       51 
52 
     | 
    
         
             
            require File.join(File.dirname(__FILE__), 'webbynode', 'application')
         
     | 
| 
       52 
53 
     | 
    
         | 
| 
       53 
54 
     | 
    
         
             
            module Webbynode
         
     | 
| 
       54 
     | 
    
         
            -
              VERSION = '1.0. 
     | 
| 
      
 55 
     | 
    
         
            +
              VERSION = '1.0.3.beta'
         
     | 
| 
       55 
56 
     | 
    
         
             
            end
         
     | 
| 
       56 
57 
     | 
    
         | 
| 
       57 
58 
     | 
    
         
             
            class Array
         
     | 
| 
         @@ -21,7 +21,12 @@ module Webbynode::Commands 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                  git.add ".pushand"
         
     | 
| 
       23 
23 
     | 
    
         
             
                  git.add ".webbynode/settings" if io.file_exists?(".webbynode/settings")
         
     | 
| 
       24 
     | 
    
         
            -
                  git. 
     | 
| 
      
 24 
     | 
    
         
            +
                  result = git.commit3("Changed DNS to \"#{param(:dns_entry)}\"")
         
     | 
| 
      
 25 
     | 
    
         
            +
                  
         
     | 
| 
      
 26 
     | 
    
         
            +
                  unless result[0]
         
     | 
| 
      
 27 
     | 
    
         
            +
                    io.log ""
         
     | 
| 
      
 28 
     | 
    
         
            +
                    raise CommandError, "Error from git commit:\n#{result[1]}"
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
       25 
30 
     | 
    
         | 
| 
       26 
31 
     | 
    
         
             
                  io.log "Your application will start responding to #{param(:dns_entry)} after next deployment."
         
     | 
| 
       27 
32 
     | 
    
         
             
                end
         
     | 
| 
         @@ -39,19 +39,19 @@ module Webbynode::Commands 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  io.log ""
         
     | 
| 
       40 
40 
     | 
    
         
             
                  io.log "Initializing directory structure..."
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
       43 
     | 
    
         
            -
                    io. 
     | 
| 
      
 42 
     | 
    
         
            +
                  if pushand_exists = io.file_exists?(".pushand")
         
     | 
| 
      
 43 
     | 
    
         
            +
                    io.log ""
         
     | 
| 
      
 44 
     | 
    
         
            +
                    io.log "It seems this application was initialized before."
         
     | 
| 
      
 45 
     | 
    
         
            +
                    overwrite = ask('Do you want to initialize it again (y/n)?').downcase == 'y'
         
     | 
| 
       44 
46 
     | 
    
         
             
                  end
         
     | 
| 
       45 
47 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                   
     | 
| 
       47 
     | 
    
         
            -
                    io. 
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                    io.create_file(".webbynode/tasks/after_push", "")
         
     | 
| 
       50 
     | 
    
         
            -
                    io.create_file(".webbynode/tasks/before_push", "")
         
     | 
| 
       51 
     | 
    
         
            -
                    io.create_file(".webbynode/aliases", "")
         
     | 
| 
       52 
     | 
    
         
            -
                    io.create_file(".webbynode/config", "")
         
     | 
| 
      
 48 
     | 
    
         
            +
                  if overwrite || !pushand_exists
         
     | 
| 
      
 49 
     | 
    
         
            +
                    io.log ""
         
     | 
| 
      
 50 
     | 
    
         
            +
                    io.create_file(".pushand", "#! /bin/bash\nphd $0 #{app_name} #{dns_entry}\n", true)
         
     | 
| 
       53 
51 
     | 
    
         
             
                  end
         
     | 
| 
       54 
52 
     | 
    
         | 
| 
      
 53 
     | 
    
         
            +
                  create_webbynode_tree
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       55 
55 
     | 
    
         
             
                  unless git_present
         
     | 
| 
       56 
56 
     | 
    
         
             
                    io.log "Initializing git and applying initial commit..."
         
     | 
| 
       57 
57 
     | 
    
         
             
                    git.init 
         
     | 
| 
         @@ -62,16 +62,16 @@ module Webbynode::Commands 
     | 
|
| 
       62 
62 
     | 
    
         
             
                  if git.remote_exists?('webbynode')
         
     | 
| 
       63 
63 
     | 
    
         
             
                    io.log ""
         
     | 
| 
       64 
64 
     | 
    
         
             
                    io.log "Webbynode git integration already initialized."
         
     | 
| 
       65 
     | 
    
         
            -
                    if ask('Do you want to overwrite the current settings (y/n)?').downcase == 'y'
         
     | 
| 
      
 65 
     | 
    
         
            +
                    if overwrite || ask('Do you want to overwrite the current settings (y/n)?').downcase == 'y'
         
     | 
| 
       66 
66 
     | 
    
         
             
                      git.delete_remote('webbynode')
         
     | 
| 
       67 
67 
     | 
    
         
             
                    end
         
     | 
| 
       68 
68 
     | 
    
         
             
                    io.log ""
         
     | 
| 
       69 
69 
     | 
    
         
             
                  end
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
                  if !git.remote_exists?('webbynode') and git_present
         
     | 
| 
      
 71 
     | 
    
         
            +
                  if overwrite or (!git.remote_exists?('webbynode') and git_present)
         
     | 
| 
       72 
72 
     | 
    
         
             
                    io.log "Commiting Webbynode changes..."
         
     | 
| 
       73 
73 
     | 
    
         
             
                    git.add "." 
         
     | 
| 
       74 
     | 
    
         
            -
                    git.commit2 "[Webbynode] Rapid App Deployment  
     | 
| 
      
 74 
     | 
    
         
            +
                    git.commit2 "[Webbynode] Rapid App Deployment Reinitialization"
         
     | 
| 
       75 
75 
     | 
    
         
             
                  end
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
77 
     | 
    
         
             
                  io.log "Adding webbynode as git remote..."
         
     | 
| 
         @@ -192,5 +192,14 @@ For more information about installing git: http://book.git-scm.com/2_installing_ 
     | 
|
| 
       192 
192 
     | 
    
         
             
            EOS
         
     | 
| 
       193 
193 
     | 
    
         
             
                  end
         
     | 
| 
       194 
194 
     | 
    
         
             
                end
         
     | 
| 
      
 195 
     | 
    
         
            +
                
         
     | 
| 
      
 196 
     | 
    
         
            +
                def create_webbynode_tree
         
     | 
| 
      
 197 
     | 
    
         
            +
                  io.mkdir(".webbynode/tasks")
         
     | 
| 
      
 198 
     | 
    
         
            +
                  
         
     | 
| 
      
 199 
     | 
    
         
            +
                  io.create_if_missing(".webbynode/tasks/after_push", "")
         
     | 
| 
      
 200 
     | 
    
         
            +
                  io.create_if_missing(".webbynode/tasks/before_push", "")
         
     | 
| 
      
 201 
     | 
    
         
            +
                  io.create_if_missing(".webbynode/aliases", "")
         
     | 
| 
      
 202 
     | 
    
         
            +
                  io.create_if_missing(".webbynode/config", "")
         
     | 
| 
      
 203 
     | 
    
         
            +
                end
         
     | 
| 
       195 
204 
     | 
    
         
             
              end
         
     | 
| 
       196 
205 
     | 
    
         
             
            end
         
     | 
| 
         @@ -19,7 +19,7 @@ module Webbynode::Commands 
     | 
|
| 
       19 
19 
     | 
    
         
             
                  remote_app_name = pushand.parse_remote_app_name
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  # Notify the user
         
     | 
| 
       22 
     | 
    
         
            -
                  io.log("Performing the requested remote command.." 
     | 
| 
      
 22 
     | 
    
         
            +
                  io.log("Performing the requested remote command..")
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  # Executes the command on the remote server inside the application root folder
         
     | 
| 
       25 
25 
     | 
    
         
             
                  remote_executor.exec("cd #{remote_app_name}; #{param_values.join(" ")}", true)
         
     | 
    
        data/lib/webbynode/git.rb
    CHANGED
    
    | 
         @@ -80,6 +80,11 @@ module Webbynode 
     | 
|
| 
       80 
80 
     | 
    
         
             
                  io.exec2("git commit -m \"#{comments}\"") == 0
         
     | 
| 
       81 
81 
     | 
    
         
             
                end
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
      
 83 
     | 
    
         
            +
                def commit3(comments)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  comments.gsub! /"/, '\"'
         
     | 
| 
      
 85 
     | 
    
         
            +
                  io.exec3("git commit -m \"#{comments}\"")
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
                
         
     | 
| 
       83 
88 
     | 
    
         
             
                def commit(comments)
         
     | 
| 
       84 
89 
     | 
    
         
             
                  comments.gsub! /"/, '\"'
         
     | 
| 
       85 
90 
     | 
    
         
             
                  exec("git commit -m \"#{comments}\"") do |output|
         
     | 
    
        data/lib/webbynode/io.rb
    CHANGED
    
    | 
         @@ -64,6 +64,11 @@ module Webbynode 
     | 
|
| 
       64 
64 
     | 
    
         
             
                  $?
         
     | 
| 
       65 
65 
     | 
    
         
             
                end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
      
 67 
     | 
    
         
            +
                def exec3(s, redirect_stderr=false)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  result = `#{s}#{redirect_stderr ? " 2>&1" : ""}`
         
     | 
| 
      
 69 
     | 
    
         
            +
                  [$? == 0, result]
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
                
         
     | 
| 
       67 
72 
     | 
    
         
             
                def directory?(s)
         
     | 
| 
       68 
73 
     | 
    
         
             
                  File.directory?(s)
         
     | 
| 
       69 
74 
     | 
    
         
             
                end
         
     | 
| 
         @@ -110,7 +115,7 @@ module Webbynode 
     | 
|
| 
       110 
115 
     | 
    
         | 
| 
       111 
116 
     | 
    
         
             
                  when :warning
         
     | 
| 
       112 
117 
     | 
    
         
             
                    notify = false
         
     | 
| 
       113 
     | 
    
         
            -
                    puts " 
     | 
| 
      
 118 
     | 
    
         
            +
                    puts "WARNING: #{text}"
         
     | 
| 
       114 
119 
     | 
    
         | 
| 
       115 
120 
     | 
    
         
             
                  when :action
         
     | 
| 
       116 
121 
     | 
    
         
             
                    notify = false
         
     | 
| 
         @@ -167,6 +172,10 @@ module Webbynode 
     | 
|
| 
       167 
172 
     | 
    
         
             
                  ::FileUtils.chmod 0755, file_name if executable
         
     | 
| 
       168 
173 
     | 
    
         
             
                end
         
     | 
| 
       169 
174 
     | 
    
         | 
| 
      
 175 
     | 
    
         
            +
                def create_if_missing(file_name, contents="", executable=nil)
         
     | 
| 
      
 176 
     | 
    
         
            +
                  create_file(file_name, contents, executable) unless file_exists?(file_name)
         
     | 
| 
      
 177 
     | 
    
         
            +
                end
         
     | 
| 
      
 178 
     | 
    
         
            +
                
         
     | 
| 
       170 
179 
     | 
    
         
             
                def delete_file(file_name)
         
     | 
| 
       171 
180 
     | 
    
         
             
                  File.delete(file_name)
         
     | 
| 
       172 
181 
     | 
    
         
             
                end
         
     | 
| 
         @@ -185,6 +194,7 @@ module Webbynode 
     | 
|
| 
       185 
194 
     | 
    
         
             
                end
         
     | 
| 
       186 
195 
     | 
    
         | 
| 
       187 
196 
     | 
    
         
             
                def add_line(file, line)
         
     | 
| 
      
 197 
     | 
    
         
            +
                  create_if_missing(file)
         
     | 
| 
       188 
198 
     | 
    
         
             
                  return if File.read(file).include?("#{line}")
         
     | 
| 
       189 
199 
     | 
    
         
             
                  File.open(file, 'a') { |f| f.puts line }
         
     | 
| 
       190 
200 
     | 
    
         
             
                end
         
     | 
    
        data/lib/webbynode/ssh.rb
    CHANGED
    
    | 
         @@ -22,12 +22,12 @@ module Webbynode 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    @password ||= ask("Enter your deployment password for #{@remote_ip}: ") { |q| q.echo = '' }
         
     | 
| 
       23 
23 
     | 
    
         
             
                    @conn     ||= Net::SSH.start(@remote_ip, 'git', :port => @port, :password => @password)  
         
     | 
| 
       24 
24 
     | 
    
         
             
                  rescue Net::SSH::AuthenticationFailed
         
     | 
| 
       25 
     | 
    
         
            -
                    io.log "Could not connect to server: invalid authentication." 
     | 
| 
      
 25 
     | 
    
         
            +
                    io.log "Could not connect to server: invalid authentication."
         
     | 
| 
       26 
26 
     | 
    
         
             
                    exit
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                rescue Net::SSH::Disconnect
         
     | 
| 
       30 
     | 
    
         
            -
                  io.log "Could not connect to the server: Wrong IP or Server Offline." 
     | 
| 
      
 30 
     | 
    
         
            +
                  io.log "Could not connect to the server: Wrong IP or Server Offline."
         
     | 
| 
       31 
31 
     | 
    
         
             
                  exit
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
         @@ -36,7 +36,9 @@ describe Webbynode::Commands::ChangeDns do 
     | 
|
| 
       36 
36 
     | 
    
         
             
                it "should perform a commit of .pushand" do
         
     | 
| 
       37 
37 
     | 
    
         
             
                  io.should_receive(:file_exists?).with(".webbynode/settings").and_return(false)
         
     | 
| 
       38 
38 
     | 
    
         
             
                  git.should_receive(:add).with(".pushand")
         
     | 
| 
       39 
     | 
    
         
            -
                  git.should_receive(: 
     | 
| 
      
 39 
     | 
    
         
            +
                  git.should_receive(:commit3).
         
     | 
| 
      
 40 
     | 
    
         
            +
                    with("Changed DNS to \"the.newdns.com\"").
         
     | 
| 
      
 41 
     | 
    
         
            +
                    and_return([true, "blah"])
         
     | 
| 
       40 
42 
     | 
    
         
             
                  cmd.run
         
     | 
| 
       41 
43 
     | 
    
         
             
                end
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
         @@ -44,8 +46,17 @@ describe Webbynode::Commands::ChangeDns do 
     | 
|
| 
       44 
46 
     | 
    
         
             
                  io.should_receive(:file_exists?).with(".webbynode/settings").and_return(true)
         
     | 
| 
       45 
47 
     | 
    
         
             
                  git.should_receive(:add).with(".pushand")
         
     | 
| 
       46 
48 
     | 
    
         
             
                  git.should_receive(:add).with(".webbynode/settings")
         
     | 
| 
       47 
     | 
    
         
            -
                  git.should_receive(: 
     | 
| 
      
 49 
     | 
    
         
            +
                  git.should_receive(:commit3).with("Changed DNS to \"the.newdns.com\"").and_return([true, "blah"])
         
     | 
| 
       48 
50 
     | 
    
         
             
                  cmd.run
         
     | 
| 
       49 
51 
     | 
    
         
             
                end
         
     | 
| 
       50 
52 
     | 
    
         
             
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
              
         
     | 
| 
      
 54 
     | 
    
         
            +
              context "when commit fails" do
         
     | 
| 
      
 55 
     | 
    
         
            +
                it "reports the error" do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  io.should_receive(:file_exists?).with(".webbynode/settings").and_return(false)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  git.should_receive(:add).with(".pushand")
         
     | 
| 
      
 58 
     | 
    
         
            +
                  git.should_receive(:commit3).with("Changed DNS to \"the.newdns.com\"").and_return([false, "Some git error"])
         
     | 
| 
      
 59 
     | 
    
         
            +
                  lambda { cmd.execute }.should raise_error(Webbynode::Command::CommandError)
         
     | 
| 
      
 60 
     | 
    
         
            +
                end
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
       51 
62 
     | 
    
         
             
            end
         
     | 
| 
         @@ -13,6 +13,7 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       13 
13 
     | 
    
         
             
                @command.stub!(:gemfile).and_return(gemfile)
         
     | 
| 
       14 
14 
     | 
    
         
             
                @command.should_receive(:git).any_number_of_times.and_return(git_handler) 
         
     | 
| 
       15 
15 
     | 
    
         
             
                @command.should_receive(:io).any_number_of_times.and_return(io_handler)
         
     | 
| 
      
 16 
     | 
    
         
            +
                io_handler.stub!(:file_exists?).with(".pushand").and_return(false)
         
     | 
| 
       16 
17 
     | 
    
         
             
              end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
              before(:each) do
         
     | 
| 
         @@ -47,10 +48,13 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       47 
48 
     | 
    
         
             
                subject do 
         
     | 
| 
       48 
49 
     | 
    
         
             
                  Webbynode::Commands::Init.new('2.1.2.3', '--port=2020').tap do |cmd|
         
     | 
| 
       49 
50 
     | 
    
         
             
                    cmd.stub!(:git_present).and_return(:false)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    cmd.stub!(:io).and_return(io_handler)
         
     | 
| 
       50 
52 
     | 
    
         
             
                  end
         
     | 
| 
       51 
53 
     | 
    
         
             
                end
         
     | 
| 
       52 
54 
     | 
    
         | 
| 
       53 
55 
     | 
    
         
             
                it "calls add_remote with the specified port" do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  io_handler.stub!(:file_exists?).with(".pushand").and_return(false)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       54 
58 
     | 
    
         
             
                  git_handler.stub!(:present?).and_return(:false)
         
     | 
| 
       55 
59 
     | 
    
         
             
                  git_handler.should_receive(:add_remote).with("webbynode", "2.1.2.3", anything(), 2020)
         
     | 
| 
       56 
60 
     | 
    
         | 
| 
         @@ -283,9 +287,25 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       283 
287 
     | 
    
         
             
                    cmd.stub!(:gemfile).and_return(gemfile)
         
     | 
| 
       284 
288 
     | 
    
         
             
                    cmd.stub!(:detect_engine).and_return(Webbynode::Engines::Rails)
         
     | 
| 
       285 
289 
     | 
    
         
             
                    cmd.stub!(:git).and_return(git_handler) 
         
     | 
| 
      
 290 
     | 
    
         
            +
                    cmd.stub!(:io).and_return(io_handler) 
         
     | 
| 
       286 
291 
     | 
    
         
             
                  end
         
     | 
| 
       287 
292 
     | 
    
         
             
                end
         
     | 
| 
       288 
293 
     | 
    
         | 
| 
      
 294 
     | 
    
         
            +
                it "doesn't ask if user already agreed to reinitialize" do
         
     | 
| 
      
 295 
     | 
    
         
            +
                  io_handler.should_receive(:file_exists?).with(".pushand").and_return(true)
         
     | 
| 
      
 296 
     | 
    
         
            +
                  io_handler.should_receive(:app_name).any_number_of_times.and_return("mah_app")
         
     | 
| 
      
 297 
     | 
    
         
            +
                  io_handler.should_receive(:create_file).with(".pushand", "#! /bin/bash\nphd $0 mah_app mah_app\n", true)
         
     | 
| 
      
 298 
     | 
    
         
            +
             
     | 
| 
      
 299 
     | 
    
         
            +
                  subject.should_receive(:ask).with("Do you want to initialize it again (y/n)?").once.ordered.and_return("y")
         
     | 
| 
      
 300 
     | 
    
         
            +
                  
         
     | 
| 
      
 301 
     | 
    
         
            +
                  git_handler.should_receive(:present?).and_return(true)
         
     | 
| 
      
 302 
     | 
    
         
            +
                  git_handler.should_receive(:remote_exists?).with("webbynode").and_return(true)
         
     | 
| 
      
 303 
     | 
    
         
            +
                  git_handler.should_receive(:delete_remote).with("webbynode")
         
     | 
| 
      
 304 
     | 
    
         
            +
             
     | 
| 
      
 305 
     | 
    
         
            +
                  subject.should_receive(:ask).with("Do you want to overwrite the current settings (y/n)?").never
         
     | 
| 
      
 306 
     | 
    
         
            +
                  subject.run
         
     | 
| 
      
 307 
     | 
    
         
            +
                end
         
     | 
| 
      
 308 
     | 
    
         
            +
                
         
     | 
| 
       289 
309 
     | 
    
         
             
                it "keep the same remotes when answer is no to overwriting" do
         
     | 
| 
       290 
310 
     | 
    
         
             
                  git_handler.should_receive(:present?).and_return(true)
         
     | 
| 
       291 
311 
     | 
    
         
             
                  git_handler.should_receive(:remote_exists?).with("webbynode").and_return(true)
         
     | 
| 
         @@ -326,6 +346,7 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       326 
346 
     | 
    
         
             
                  @command.stub!(:gemfile).and_return(gemfile)
         
     | 
| 
       327 
347 
     | 
    
         
             
                  @command.stub!(:git).and_return(git_handler) 
         
     | 
| 
       328 
348 
     | 
    
         
             
                  @command.stub!(:detect_engine).and_return(Webbynode::Engines::Rails)
         
     | 
| 
      
 349 
     | 
    
         
            +
                  io.stub!(:file_exists?).with(".pushand").and_return(false)
         
     | 
| 
       329 
350 
     | 
    
         
             
                end
         
     | 
| 
       330 
351 
     | 
    
         | 
| 
       331 
352 
     | 
    
         
             
                it "should setup DNS using Webbynode API" do
         
     | 
| 
         @@ -383,6 +404,8 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       383 
404 
     | 
    
         
             
                  # the DNS setting should remove any dns_aliases on .webbynode/settings
         
     | 
| 
       384 
405 
     | 
    
         
             
                  io = Webbynode::Io.new
         
     | 
| 
       385 
406 
     | 
    
         
             
                  io.should_receive(:remove_setting).with("dns_alias")
         
     | 
| 
      
 407 
     | 
    
         
            +
                  io.stub!(:file_exists?).and_return(false)
         
     | 
| 
      
 408 
     | 
    
         
            +
                  # io.should_receive(:file_exists?).with(".pushand").and_return(false)
         
     | 
| 
       386 
409 
     | 
    
         | 
| 
       387 
410 
     | 
    
         
             
                  @command.should_receive(:api).any_number_of_times.and_return(api)
         
     | 
| 
       388 
411 
     | 
    
         
             
                  @command.should_receive(:io).any_number_of_times.and_return(io)
         
     | 
| 
         @@ -401,6 +424,8 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       401 
424 
     | 
    
         
             
                  # the DNS setting should remove any dns_aliases on .webbynode/settings
         
     | 
| 
       402 
425 
     | 
    
         
             
                  io = Webbynode::Io.new
         
     | 
| 
       403 
426 
     | 
    
         
             
                  io.should_receive(:remove_setting).with("dns_alias")
         
     | 
| 
      
 427 
     | 
    
         
            +
                  io.stub!(:file_exists?).and_return(false)
         
     | 
| 
      
 428 
     | 
    
         
            +
                  # io.stub!(:file_exists?).with(".pushand").and_return(false)
         
     | 
| 
       404 
429 
     | 
    
         | 
| 
       405 
430 
     | 
    
         
             
                  @command.should_receive(:api).any_number_of_times.and_return(api)
         
     | 
| 
       406 
431 
     | 
    
         
             
                  @command.should_receive(:io).any_number_of_times.and_return(io)
         
     | 
| 
         @@ -524,18 +549,31 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       524 
549 
     | 
    
         
             
              end
         
     | 
| 
       525 
550 
     | 
    
         | 
| 
       526 
551 
     | 
    
         
             
              context "when .webbynode is not present" do
         
     | 
| 
      
 552 
     | 
    
         
            +
                let(:io)  { double('io').as_null_object }
         
     | 
| 
      
 553 
     | 
    
         
            +
                let(:git) { double('git').as_null_object }
         
     | 
| 
      
 554 
     | 
    
         
            +
                subject do 
         
     | 
| 
      
 555 
     | 
    
         
            +
                  Webbynode::Commands::Init.new("10.0.1.1").tap do |cmd|
         
     | 
| 
      
 556 
     | 
    
         
            +
                    cmd.stub!(:io).and_return(io)
         
     | 
| 
      
 557 
     | 
    
         
            +
                    cmd.stub!(:git).and_return(git)
         
     | 
| 
      
 558 
     | 
    
         
            +
                    cmd.stub!(:detect_engine).and_return(Webbynode::Engines::Rails)
         
     | 
| 
      
 559 
     | 
    
         
            +
                    cmd.stub!(:ask)
         
     | 
| 
      
 560 
     | 
    
         
            +
                  end
         
     | 
| 
      
 561 
     | 
    
         
            +
                end
         
     | 
| 
      
 562 
     | 
    
         
            +
                
         
     | 
| 
       527 
563 
     | 
    
         
             
                before(:each) do
         
     | 
| 
       528 
     | 
    
         
            -
                   
     | 
| 
      
 564 
     | 
    
         
            +
                  git.stub(:remote_exists?).and_return(false)
         
     | 
| 
      
 565 
     | 
    
         
            +
                  io.should_receive(:file_exists?).with('.pushand').and_return(false)
         
     | 
| 
       529 
566 
     | 
    
         
             
                end
         
     | 
| 
       530 
567 
     | 
    
         | 
| 
       531 
     | 
    
         
            -
                it " 
     | 
| 
       532 
     | 
    
         
            -
                   
     | 
| 
       533 
     | 
    
         
            -
             
     | 
| 
       534 
     | 
    
         
            -
                   
     | 
| 
       535 
     | 
    
         
            -
                   
     | 
| 
       536 
     | 
    
         
            -
                   
     | 
| 
      
 568 
     | 
    
         
            +
                it "creates the .webbynode system folder and stub files" do
         
     | 
| 
      
 569 
     | 
    
         
            +
                  io.should_receive(:mkdir).with(".webbynode/tasks")
         
     | 
| 
      
 570 
     | 
    
         
            +
             
     | 
| 
      
 571 
     | 
    
         
            +
                  io.should_receive(:create_if_missing).with(".webbynode/tasks/after_push", "")
         
     | 
| 
      
 572 
     | 
    
         
            +
                  io.should_receive(:create_if_missing).with(".webbynode/tasks/before_push", "")
         
     | 
| 
      
 573 
     | 
    
         
            +
                  io.should_receive(:create_if_missing).with(".webbynode/aliases", "")
         
     | 
| 
      
 574 
     | 
    
         
            +
                  io.should_receive(:create_if_missing).with(".webbynode/config", "")
         
     | 
| 
       537 
575 
     | 
    
         | 
| 
       538 
     | 
    
         
            -
                   
     | 
| 
      
 576 
     | 
    
         
            +
                  subject.run
         
     | 
| 
       539 
577 
     | 
    
         
             
                end
         
     | 
| 
       540 
578 
     | 
    
         
             
              end
         
     | 
| 
       541 
579 
     | 
    
         | 
| 
         @@ -558,9 +596,25 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       558 
596 
     | 
    
         
             
                  @command.stub!(:detect_engine).and_return(Webbynode::Engines::Rails)
         
     | 
| 
       559 
597 
     | 
    
         
             
                end
         
     | 
| 
       560 
598 
     | 
    
         | 
| 
       561 
     | 
    
         
            -
                it " 
     | 
| 
      
 599 
     | 
    
         
            +
                it "isn't replaced if user answers no" do
         
     | 
| 
       562 
600 
     | 
    
         
             
                  io_handler.should_receive(:file_exists?).with(".pushand").and_return(true)
         
     | 
| 
       563 
     | 
    
         
            -
                  io_handler.should_receive(:create_file).never
         
     | 
| 
      
 601 
     | 
    
         
            +
                  io_handler.should_receive(:create_file).with(".pushand").never
         
     | 
| 
      
 602 
     | 
    
         
            +
                  io_handler.should_receive(:log).with("It seems this application was initialized before.")
         
     | 
| 
      
 603 
     | 
    
         
            +
                  @command.should_receive(:ask).with("Do you want to initialize it again (y/n)?").once.ordered.and_return("n")
         
     | 
| 
      
 604 
     | 
    
         
            +
                  
         
     | 
| 
      
 605 
     | 
    
         
            +
                  @command.run
         
     | 
| 
      
 606 
     | 
    
         
            +
                end
         
     | 
| 
      
 607 
     | 
    
         
            +
             
     | 
| 
      
 608 
     | 
    
         
            +
                it "is replaced if user answers yes" do
         
     | 
| 
      
 609 
     | 
    
         
            +
                  io_handler.should_receive(:file_exists?).with(".pushand").and_return(true)
         
     | 
| 
      
 610 
     | 
    
         
            +
                  io_handler.should_receive(:app_name).any_number_of_times.and_return("mah_app")
         
     | 
| 
      
 611 
     | 
    
         
            +
                  io_handler.should_receive(:create_file).with(".pushand", "#! /bin/bash\nphd $0 mah_app mah_app\n", true)
         
     | 
| 
      
 612 
     | 
    
         
            +
                  
         
     | 
| 
      
 613 
     | 
    
         
            +
                  io_handler.should_receive(:log).with("Commiting Webbynode changes...")
         
     | 
| 
      
 614 
     | 
    
         
            +
                  git_handler.should_receive(:add).with(".")
         
     | 
| 
      
 615 
     | 
    
         
            +
                  git_handler.should_receive(:commit2).with("[Webbynode] Rapid App Deployment Reinitialization")
         
     | 
| 
      
 616 
     | 
    
         
            +
             
     | 
| 
      
 617 
     | 
    
         
            +
                  @command.should_receive(:ask).with("Do you want to initialize it again (y/n)?").once.ordered.and_return("y")
         
     | 
| 
       564 
618 
     | 
    
         | 
| 
       565 
619 
     | 
    
         
             
                  @command.run
         
     | 
| 
       566 
620 
     | 
    
         
             
                end
         
     | 
| 
         @@ -637,7 +691,7 @@ describe Webbynode::Commands::Init do 
     | 
|
| 
       637 
691 
     | 
    
         | 
| 
       638 
692 
     | 
    
         
             
                it "commits the changes" do
         
     | 
| 
       639 
693 
     | 
    
         
             
                  git_handler.should_receive(:present?).and_return(true)
         
     | 
| 
       640 
     | 
    
         
            -
                  git_handler.should_receive(:commit2).with("[Webbynode] Rapid App Deployment  
     | 
| 
      
 694 
     | 
    
         
            +
                  git_handler.should_receive(:commit2).with("[Webbynode] Rapid App Deployment Reinitialization")
         
     | 
| 
       641 
695 
     | 
    
         | 
| 
       642 
696 
     | 
    
         
             
                  @command.run
         
     | 
| 
       643 
697 
     | 
    
         
             
                end
         
     | 
| 
         @@ -24,7 +24,7 @@ describe Webbynode::Commands::Remote do 
     | 
|
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              it "should notify the user" do
         
     | 
| 
       27 
     | 
    
         
            -
                io.should_receive(:log).with("Performing the requested remote command.." 
     | 
| 
      
 27 
     | 
    
         
            +
                io.should_receive(:log).with("Performing the requested remote command..")
         
     | 
| 
       28 
28 
     | 
    
         
             
                remote.run
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Load Spec Helper
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'spec_helper')
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe Webbynode::Engines::NodeJS do
         
     | 
| 
      
 5 
     | 
    
         
            +
              describe 'class methods' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                subject { Webbynode::Engines::NodeJS }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                its(:engine_id)    { should == 'nodejs' }
         
     | 
| 
      
 9 
     | 
    
         
            +
                its(:engine_name)  { should == 'NodeJS' }
         
     | 
| 
      
 10 
     | 
    
         
            +
                its(:git_excluded) { should be_empty }
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/webbynode/git_spec.rb
    CHANGED
    
    | 
         @@ -32,11 +32,6 @@ describe Webbynode::Git do 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  "fatal: Not a git repository (or any of the parent directories): .git", &blk
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
              it "should have an io instance" do
         
     | 
| 
       36 
     | 
    
         
            -
                pending "Check out why this is being mocked"
         
     | 
| 
       37 
     | 
    
         
            -
                Webbynode::Git.new.io.class.should == Webbynode::Io
         
     | 
| 
       38 
     | 
    
         
            -
              end
         
     | 
| 
       39 
     | 
    
         
            -
              
         
     | 
| 
       40 
35 
     | 
    
         
             
              describe "#delete_remote" do
         
     | 
| 
       41 
36 
     | 
    
         
             
                it "executes remote rm command for the specificed remote" do
         
     | 
| 
       42 
37 
     | 
    
         
             
                  git = Webbynode::Git.new
         
     | 
| 
         @@ -278,9 +273,20 @@ describe Webbynode::Git do 
     | 
|
| 
       278 
273 
     | 
    
         
             
                  lambda { git.add "." }.should_not raise_error
         
     | 
| 
       279 
274 
     | 
    
         
             
                end
         
     | 
| 
       280 
275 
     | 
    
         
             
              end
         
     | 
| 
      
 276 
     | 
    
         
            +
              
         
     | 
| 
      
 277 
     | 
    
         
            +
              describe '#commit3' do
         
     | 
| 
      
 278 
     | 
    
         
            +
                it "adds objects to git" do
         
     | 
| 
      
 279 
     | 
    
         
            +
                  io_handler = mock("io")
         
     | 
| 
      
 280 
     | 
    
         
            +
                  io_handler.should_receive(:exec3).with('git commit -m "Commit comment"').and_return([0, "[master (root-commit) 8f590c7] Commit comment"])
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
                  git = Webbynode::Git.new
         
     | 
| 
      
 283 
     | 
    
         
            +
                  git.should_receive(:io).and_return(io_handler)
         
     | 
| 
      
 284 
     | 
    
         
            +
                  git.commit3("Commit comment").should == [0, "[master (root-commit) 8f590c7] Commit comment"]
         
     | 
| 
      
 285 
     | 
    
         
            +
                end
         
     | 
| 
      
 286 
     | 
    
         
            +
              end
         
     | 
| 
       281 
287 
     | 
    
         | 
| 
       282 
288 
     | 
    
         
             
              describe "#commit" do
         
     | 
| 
       283 
     | 
    
         
            -
                context "when  
     | 
| 
      
 289 
     | 
    
         
            +
                context "when successful" do
         
     | 
| 
       284 
290 
     | 
    
         
             
                  it "should add objects to git" do
         
     | 
| 
       285 
291 
     | 
    
         
             
                    io_handler = mock("io")
         
     | 
| 
       286 
292 
     | 
    
         
             
                    io_handler.should_receive(:exec).with('git commit -m "Commit comment"').and_return("[master (root-commit) 8f590c7] Commit comment
         
     | 
    
        data/spec/webbynode/io_spec.rb
    CHANGED
    
    | 
         @@ -171,6 +171,24 @@ describe Webbynode::Io do 
     | 
|
| 
       171 
171 
     | 
    
         
             
              end
         
     | 
| 
       172 
172 
     | 
    
         | 
| 
       173 
173 
     | 
    
         
             
              describe '#add_line' do
         
     | 
| 
      
 174 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 175 
     | 
    
         
            +
                  subject.stub(:create_if_missing)
         
     | 
| 
      
 176 
     | 
    
         
            +
                end
         
     | 
| 
      
 177 
     | 
    
         
            +
                
         
     | 
| 
      
 178 
     | 
    
         
            +
                context "when file doesn't exist yet" do
         
     | 
| 
      
 179 
     | 
    
         
            +
                  it "creates the file" do
         
     | 
| 
      
 180 
     | 
    
         
            +
                    file = stub('file')
         
     | 
| 
      
 181 
     | 
    
         
            +
                    
         
     | 
| 
      
 182 
     | 
    
         
            +
                    File.should_receive(:read).with('.gitignore').and_return('')
         
     | 
| 
      
 183 
     | 
    
         
            +
                    
         
     | 
| 
      
 184 
     | 
    
         
            +
                    File.should_receive(:open).with('.gitignore', 'a').and_yield(file)
         
     | 
| 
      
 185 
     | 
    
         
            +
                    file.should_receive(:puts).with('new_line')
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                    subject.should_receive(:create_if_missing).with(".gitignore")
         
     | 
| 
      
 188 
     | 
    
         
            +
                    subject.add_line '.gitignore', 'new_line'
         
     | 
| 
      
 189 
     | 
    
         
            +
                  end
         
     | 
| 
      
 190 
     | 
    
         
            +
                end
         
     | 
| 
      
 191 
     | 
    
         
            +
                
         
     | 
| 
       174 
192 
     | 
    
         
             
                context "when line doesn't exist yet" do
         
     | 
| 
       175 
193 
     | 
    
         
             
                  it "adds one line to a file" do
         
     | 
| 
       176 
194 
     | 
    
         
             
                    file = stub('file')
         
     | 
| 
         @@ -180,8 +198,7 @@ describe Webbynode::Io do 
     | 
|
| 
       180 
198 
     | 
    
         
             
                    File.should_receive(:open).with('.gitignore', 'a').and_yield(file)
         
     | 
| 
       181 
199 
     | 
    
         
             
                    file.should_receive(:puts).with('new_line')
         
     | 
| 
       182 
200 
     | 
    
         | 
| 
       183 
     | 
    
         
            -
                     
     | 
| 
       184 
     | 
    
         
            -
                    io.add_line '.gitignore', 'new_line'
         
     | 
| 
      
 201 
     | 
    
         
            +
                    subject.add_line '.gitignore', 'new_line'
         
     | 
| 
       185 
202 
     | 
    
         
             
                  end
         
     | 
| 
       186 
203 
     | 
    
         
             
                end
         
     | 
| 
       187 
204 
     | 
    
         | 
| 
         @@ -190,8 +207,7 @@ describe Webbynode::Io do 
     | 
|
| 
       190 
207 
     | 
    
         
             
                    File.should_receive(:read).with('.gitignore').and_return('new_line')
         
     | 
| 
       191 
208 
     | 
    
         
             
                    File.should_receive(:open).with('.gitignore', 'a').never
         
     | 
| 
       192 
209 
     | 
    
         | 
| 
       193 
     | 
    
         
            -
                     
     | 
| 
       194 
     | 
    
         
            -
                    io.add_line '.gitignore', 'new_line'
         
     | 
| 
      
 210 
     | 
    
         
            +
                    subject.add_line '.gitignore', 'new_line'
         
     | 
| 
       195 
211 
     | 
    
         
             
                  end
         
     | 
| 
       196 
212 
     | 
    
         
             
                end
         
     | 
| 
       197 
213 
     | 
    
         
             
              end
         
     | 
| 
         @@ -218,6 +234,20 @@ describe Webbynode::Io do 
     | 
|
| 
       218 
234 
     | 
    
         
             
                end
         
     | 
| 
       219 
235 
     | 
    
         
             
              end
         
     | 
| 
       220 
236 
     | 
    
         | 
| 
      
 237 
     | 
    
         
            +
              describe '#create_if_missing' do
         
     | 
| 
      
 238 
     | 
    
         
            +
                it "creates the file if it doesn't exist" do
         
     | 
| 
      
 239 
     | 
    
         
            +
                  subject.should_receive(:file_exists?).with("a").and_return(false)
         
     | 
| 
      
 240 
     | 
    
         
            +
                  subject.should_receive(:create_file).with("a", "contents", true)
         
     | 
| 
      
 241 
     | 
    
         
            +
                  subject.create_if_missing("a", "contents", true)
         
     | 
| 
      
 242 
     | 
    
         
            +
                end
         
     | 
| 
      
 243 
     | 
    
         
            +
                
         
     | 
| 
      
 244 
     | 
    
         
            +
                it "does nothing if file exists" do
         
     | 
| 
      
 245 
     | 
    
         
            +
                  subject.should_receive(:file_exists?).with("a").and_return(true)
         
     | 
| 
      
 246 
     | 
    
         
            +
                  subject.should_receive(:create_file).never
         
     | 
| 
      
 247 
     | 
    
         
            +
                  subject.create_if_missing("a", "contents")
         
     | 
| 
      
 248 
     | 
    
         
            +
                end
         
     | 
| 
      
 249 
     | 
    
         
            +
              end
         
     | 
| 
      
 250 
     | 
    
         
            +
              
         
     | 
| 
       221 
251 
     | 
    
         
             
              describe "#exec" do
         
     | 
| 
       222 
252 
     | 
    
         
             
                context "when successful" do
         
     | 
| 
       223 
253 
     | 
    
         
             
                  it "should execute the command and retrieve the output" do
         
     | 
| 
         @@ -228,6 +258,16 @@ describe Webbynode::Io do 
     | 
|
| 
       228 
258 
     | 
    
         
             
                end
         
     | 
| 
       229 
259 
     | 
    
         
             
              end
         
     | 
| 
       230 
260 
     | 
    
         | 
| 
      
 261 
     | 
    
         
            +
              describe "#exec3" do
         
     | 
| 
      
 262 
     | 
    
         
            +
                context "when successful" do
         
     | 
| 
      
 263 
     | 
    
         
            +
                  it "executes the command and retrieve the output and exit code" do
         
     | 
| 
      
 264 
     | 
    
         
            +
                    io = Webbynode::Io.new
         
     | 
| 
      
 265 
     | 
    
         
            +
                    io.should_receive(:`).with("ls -la").and_return("output for ls -la")
         
     | 
| 
      
 266 
     | 
    
         
            +
                    io.exec3("ls -la").should == [false, "output for ls -la"]
         
     | 
| 
      
 267 
     | 
    
         
            +
                  end
         
     | 
| 
      
 268 
     | 
    
         
            +
                end
         
     | 
| 
      
 269 
     | 
    
         
            +
              end
         
     | 
| 
      
 270 
     | 
    
         
            +
              
         
     | 
| 
       231 
271 
     | 
    
         
             
              describe "#read_file" do
         
     | 
| 
       232 
272 
     | 
    
         
             
                context "when successful" do
         
     | 
| 
       233 
273 
     | 
    
         
             
                  it "should return file contents" do
         
     | 
    
        data/webbynode.gemspec
    CHANGED
    
    | 
         @@ -2,16 +2,16 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       4 
4 
     | 
    
         
             
              s.name = %q{webbynode}
         
     | 
| 
       5 
     | 
    
         
            -
              s.version = "1.0. 
     | 
| 
      
 5 
     | 
    
         
            +
              s.version = "1.0.3.beta"
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       8 
8 
     | 
    
         
             
              s.authors = ["Felipe Coury"]
         
     | 
| 
       9 
     | 
    
         
            -
              s.date = %q{2010-08- 
     | 
| 
      
 9 
     | 
    
         
            +
              s.date = %q{2010-08-11}
         
     | 
| 
       10 
10 
     | 
    
         
             
              s.description = %q{Webbynode Deployment Gem}
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.email = %q{felipe@webbynode.com}
         
     | 
| 
       12 
12 
     | 
    
         
             
              s.executables = ["webbynode", "wn"]
         
     | 
| 
       13 
     | 
    
         
            -
              s.extra_rdoc_files = ["README.rdoc", "bin/webbynode", "bin/wn", "lib/templates/api_token", "lib/templates/backup", "lib/templates/gitignore", "lib/templates/help", "lib/webbynode.rb", "lib/webbynode/api_client.rb", "lib/webbynode/application.rb", "lib/webbynode/attribute_accessors.rb", "lib/webbynode/command.rb", "lib/webbynode/commands/add_backup.rb", "lib/webbynode/commands/add_key.rb", "lib/webbynode/commands/addons.rb", "lib/webbynode/commands/alias.rb", "lib/webbynode/commands/apps.rb", "lib/webbynode/commands/change_dns.rb", "lib/webbynode/commands/config.rb", "lib/webbynode/commands/delete.rb", "lib/webbynode/commands/help.rb", "lib/webbynode/commands/init.rb", "lib/webbynode/commands/open.rb", "lib/webbynode/commands/push.rb", "lib/webbynode/commands/remote.rb", "lib/webbynode/commands/restart.rb", "lib/webbynode/commands/start.rb", "lib/webbynode/commands/stop.rb", "lib/webbynode/commands/tasks.rb", "lib/webbynode/commands/version.rb", "lib/webbynode/commands/webbies.rb", "lib/webbynode/engines/all.rb", "lib/webbynode/engines/django.rb", "lib/webbynode/engines/engine.rb", "lib/webbynode/engines/php.rb", "lib/webbynode/engines/rack.rb", "lib/webbynode/engines/rails.rb", "lib/webbynode/engines/rails3.rb", "lib/webbynode/gemfile.rb", "lib/webbynode/git.rb", "lib/webbynode/io.rb", "lib/webbynode/notify.rb", "lib/webbynode/option.rb", "lib/webbynode/parameter.rb", "lib/webbynode/properties.rb", "lib/webbynode/push_and.rb", "lib/webbynode/remote_executor.rb", "lib/webbynode/server.rb", "lib/webbynode/ssh.rb", "lib/webbynode/ssh_keys.rb", "lib/webbynode/updater.rb"]
         
     | 
| 
       14 
     | 
    
         
            -
              s.files = ["Manifest", "PostInstall.txt", "README.rdoc", "Rakefile", "assets/webbynode.png", "bin/webbynode", "bin/wn", "changelog.rdoc", "cucumber.yml.old", "inactive_features/bootstrap.feature", "inactive_features/step_definitions/command_steps.rb", "inactive_features/support/env.rb", "inactive_features/support/hooks.rb", "inactive_features/support/io_features.rb", "inactive_features/support/mocha.rb", "lib/templates/api_token", "lib/templates/backup", "lib/templates/gitignore", "lib/templates/help", "lib/webbynode.rb", "lib/webbynode/api_client.rb", "lib/webbynode/application.rb", "lib/webbynode/attribute_accessors.rb", "lib/webbynode/command.rb", "lib/webbynode/commands/add_backup.rb", "lib/webbynode/commands/add_key.rb", "lib/webbynode/commands/addons.rb", "lib/webbynode/commands/alias.rb", "lib/webbynode/commands/apps.rb", "lib/webbynode/commands/change_dns.rb", "lib/webbynode/commands/config.rb", "lib/webbynode/commands/delete.rb", "lib/webbynode/commands/help.rb", "lib/webbynode/commands/init.rb", "lib/webbynode/commands/open.rb", "lib/webbynode/commands/push.rb", "lib/webbynode/commands/remote.rb", "lib/webbynode/commands/restart.rb", "lib/webbynode/commands/start.rb", "lib/webbynode/commands/stop.rb", "lib/webbynode/commands/tasks.rb", "lib/webbynode/commands/version.rb", "lib/webbynode/commands/webbies.rb", "lib/webbynode/engines/all.rb", "lib/webbynode/engines/django.rb", "lib/webbynode/engines/engine.rb", "lib/webbynode/engines/php.rb", "lib/webbynode/engines/rack.rb", "lib/webbynode/engines/rails.rb", "lib/webbynode/engines/rails3.rb", "lib/webbynode/gemfile.rb", "lib/webbynode/git.rb", "lib/webbynode/io.rb", "lib/webbynode/notify.rb", "lib/webbynode/option.rb", "lib/webbynode/parameter.rb", "lib/webbynode/properties.rb", "lib/webbynode/push_and.rb", "lib/webbynode/remote_executor.rb", "lib/webbynode/server.rb", "lib/webbynode/ssh.rb", "lib/webbynode/ssh_keys.rb", "lib/webbynode/updater.rb", "spec/fixtures/aliases", "spec/fixtures/api/credentials", "spec/fixtures/api/dns", "spec/fixtures/api/dns_a_record", "spec/fixtures/api/dns_a_record_already_exists", "spec/fixtures/api/dns_a_record_error", "spec/fixtures/api/dns_new_zone", "spec/fixtures/api/webbies", "spec/fixtures/api/webbies_unauthorized", "spec/fixtures/api/webby", "spec/fixtures/commands/tasks/after_push", "spec/fixtures/fixture_helpers", "spec/fixtures/git/config/210.11.13.12", "spec/fixtures/git/config/67.23.79.31", "spec/fixtures/git/config/67.23.79.32", "spec/fixtures/git/config/config", "spec/fixtures/git/config/config_5", "spec/fixtures/git/config/new_210.11.13.12", "spec/fixtures/git/config/new_67.23.79.31", "spec/fixtures/git/config/new_67.23.79.32", "spec/fixtures/git/config/new_config", "spec/fixtures/git/status/clean", "spec/fixtures/git/status/dirty", "spec/fixtures/pushand", "spec/fixtures/settings.py", "spec/spec_helper.rb", "spec/webbynode/api_client_spec.rb", "spec/webbynode/application_spec.rb", "spec/webbynode/command_spec.rb", "spec/webbynode/commands/add_backup_spec.rb", "spec/webbynode/commands/add_key_spec.rb", "spec/webbynode/commands/addons_spec.rb", "spec/webbynode/commands/alias_spec.rb", "spec/webbynode/commands/apps_spec.rb", "spec/webbynode/commands/change_dns_spec.rb", "spec/webbynode/commands/config_spec.rb", "spec/webbynode/commands/delete_spec.rb", "spec/webbynode/commands/help_spec.rb", "spec/webbynode/commands/init_spec.rb", "spec/webbynode/commands/open_spec.rb", "spec/webbynode/commands/push_spec.rb", "spec/webbynode/commands/remote_spec.rb", "spec/webbynode/commands/tasks_spec.rb", "spec/webbynode/commands/version_spec.rb", "spec/webbynode/commands/webbies_spec.rb", "spec/webbynode/engines/django_spec.rb", "spec/webbynode/engines/engine_spec.rb", "spec/webbynode/engines/php_spec.rb", "spec/webbynode/engines/rack_spec.rb", "spec/webbynode/engines/rails3_spec.rb", "spec/webbynode/engines/rails_spec.rb", "spec/webbynode/gemfile_spec.rb", "spec/webbynode/git_spec.rb", "spec/webbynode/io_spec.rb", "spec/webbynode/option_spec.rb", "spec/webbynode/parameter_spec.rb", "spec/webbynode/properties_spec.rb", "spec/webbynode/push_and_spec.rb", "spec/webbynode/remote_executor_spec.rb", "spec/webbynode/server_spec.rb", "spec/webbynode/ssh_spec.rb", "webbynode.gemspec"]
         
     | 
| 
      
 13 
     | 
    
         
            +
              s.extra_rdoc_files = ["README.rdoc", "bin/webbynode", "bin/wn", "lib/templates/api_token", "lib/templates/backup", "lib/templates/gitignore", "lib/templates/help", "lib/webbynode.rb", "lib/webbynode/api_client.rb", "lib/webbynode/application.rb", "lib/webbynode/attribute_accessors.rb", "lib/webbynode/command.rb", "lib/webbynode/commands/add_backup.rb", "lib/webbynode/commands/add_key.rb", "lib/webbynode/commands/addons.rb", "lib/webbynode/commands/alias.rb", "lib/webbynode/commands/apps.rb", "lib/webbynode/commands/change_dns.rb", "lib/webbynode/commands/config.rb", "lib/webbynode/commands/delete.rb", "lib/webbynode/commands/help.rb", "lib/webbynode/commands/init.rb", "lib/webbynode/commands/open.rb", "lib/webbynode/commands/push.rb", "lib/webbynode/commands/remote.rb", "lib/webbynode/commands/restart.rb", "lib/webbynode/commands/start.rb", "lib/webbynode/commands/stop.rb", "lib/webbynode/commands/tasks.rb", "lib/webbynode/commands/version.rb", "lib/webbynode/commands/webbies.rb", "lib/webbynode/engines/all.rb", "lib/webbynode/engines/django.rb", "lib/webbynode/engines/engine.rb", "lib/webbynode/engines/nodejs.rb", "lib/webbynode/engines/php.rb", "lib/webbynode/engines/rack.rb", "lib/webbynode/engines/rails.rb", "lib/webbynode/engines/rails3.rb", "lib/webbynode/gemfile.rb", "lib/webbynode/git.rb", "lib/webbynode/io.rb", "lib/webbynode/notify.rb", "lib/webbynode/option.rb", "lib/webbynode/parameter.rb", "lib/webbynode/properties.rb", "lib/webbynode/push_and.rb", "lib/webbynode/remote_executor.rb", "lib/webbynode/server.rb", "lib/webbynode/ssh.rb", "lib/webbynode/ssh_keys.rb", "lib/webbynode/updater.rb"]
         
     | 
| 
      
 14 
     | 
    
         
            +
              s.files = ["Manifest", "PostInstall.txt", "README.rdoc", "Rakefile", "assets/webbynode.png", "bin/webbynode", "bin/wn", "changelog.rdoc", "cucumber.yml.old", "inactive_features/bootstrap.feature", "inactive_features/step_definitions/command_steps.rb", "inactive_features/support/env.rb", "inactive_features/support/hooks.rb", "inactive_features/support/io_features.rb", "inactive_features/support/mocha.rb", "lib/templates/api_token", "lib/templates/backup", "lib/templates/gitignore", "lib/templates/help", "lib/webbynode.rb", "lib/webbynode/api_client.rb", "lib/webbynode/application.rb", "lib/webbynode/attribute_accessors.rb", "lib/webbynode/command.rb", "lib/webbynode/commands/add_backup.rb", "lib/webbynode/commands/add_key.rb", "lib/webbynode/commands/addons.rb", "lib/webbynode/commands/alias.rb", "lib/webbynode/commands/apps.rb", "lib/webbynode/commands/change_dns.rb", "lib/webbynode/commands/config.rb", "lib/webbynode/commands/delete.rb", "lib/webbynode/commands/help.rb", "lib/webbynode/commands/init.rb", "lib/webbynode/commands/open.rb", "lib/webbynode/commands/push.rb", "lib/webbynode/commands/remote.rb", "lib/webbynode/commands/restart.rb", "lib/webbynode/commands/start.rb", "lib/webbynode/commands/stop.rb", "lib/webbynode/commands/tasks.rb", "lib/webbynode/commands/version.rb", "lib/webbynode/commands/webbies.rb", "lib/webbynode/engines/all.rb", "lib/webbynode/engines/django.rb", "lib/webbynode/engines/engine.rb", "lib/webbynode/engines/nodejs.rb", "lib/webbynode/engines/php.rb", "lib/webbynode/engines/rack.rb", "lib/webbynode/engines/rails.rb", "lib/webbynode/engines/rails3.rb", "lib/webbynode/gemfile.rb", "lib/webbynode/git.rb", "lib/webbynode/io.rb", "lib/webbynode/notify.rb", "lib/webbynode/option.rb", "lib/webbynode/parameter.rb", "lib/webbynode/properties.rb", "lib/webbynode/push_and.rb", "lib/webbynode/remote_executor.rb", "lib/webbynode/server.rb", "lib/webbynode/ssh.rb", "lib/webbynode/ssh_keys.rb", "lib/webbynode/updater.rb", "spec/fixtures/aliases", "spec/fixtures/api/credentials", "spec/fixtures/api/dns", "spec/fixtures/api/dns_a_record", "spec/fixtures/api/dns_a_record_already_exists", "spec/fixtures/api/dns_a_record_error", "spec/fixtures/api/dns_new_zone", "spec/fixtures/api/webbies", "spec/fixtures/api/webbies_unauthorized", "spec/fixtures/api/webby", "spec/fixtures/commands/tasks/after_push", "spec/fixtures/fixture_helpers", "spec/fixtures/git/config/210.11.13.12", "spec/fixtures/git/config/67.23.79.31", "spec/fixtures/git/config/67.23.79.32", "spec/fixtures/git/config/config", "spec/fixtures/git/config/config_5", "spec/fixtures/git/config/new_210.11.13.12", "spec/fixtures/git/config/new_67.23.79.31", "spec/fixtures/git/config/new_67.23.79.32", "spec/fixtures/git/config/new_config", "spec/fixtures/git/status/clean", "spec/fixtures/git/status/dirty", "spec/fixtures/pushand", "spec/fixtures/settings.py", "spec/spec_helper.rb", "spec/webbynode/api_client_spec.rb", "spec/webbynode/application_spec.rb", "spec/webbynode/command_spec.rb", "spec/webbynode/commands/add_backup_spec.rb", "spec/webbynode/commands/add_key_spec.rb", "spec/webbynode/commands/addons_spec.rb", "spec/webbynode/commands/alias_spec.rb", "spec/webbynode/commands/apps_spec.rb", "spec/webbynode/commands/change_dns_spec.rb", "spec/webbynode/commands/config_spec.rb", "spec/webbynode/commands/delete_spec.rb", "spec/webbynode/commands/help_spec.rb", "spec/webbynode/commands/init_spec.rb", "spec/webbynode/commands/open_spec.rb", "spec/webbynode/commands/push_spec.rb", "spec/webbynode/commands/remote_spec.rb", "spec/webbynode/commands/tasks_spec.rb", "spec/webbynode/commands/version_spec.rb", "spec/webbynode/commands/webbies_spec.rb", "spec/webbynode/engines/django_spec.rb", "spec/webbynode/engines/engine_spec.rb", "spec/webbynode/engines/nodejs_spec.rb", "spec/webbynode/engines/php_spec.rb", "spec/webbynode/engines/rack_spec.rb", "spec/webbynode/engines/rails3_spec.rb", "spec/webbynode/engines/rails_spec.rb", "spec/webbynode/gemfile_spec.rb", "spec/webbynode/git_spec.rb", "spec/webbynode/io_spec.rb", "spec/webbynode/option_spec.rb", "spec/webbynode/parameter_spec.rb", "spec/webbynode/properties_spec.rb", "spec/webbynode/push_and_spec.rb", "spec/webbynode/remote_executor_spec.rb", "spec/webbynode/server_spec.rb", "spec/webbynode/ssh_spec.rb", "webbynode.gemspec"]
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.homepage = %q{http://webbynode.com}
         
     | 
| 
       16 
16 
     | 
    
         
             
              s.post_install_message = %q{
         
     | 
| 
       17 
17 
     | 
    
         
             
            -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: webbynode
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
       5 
     | 
    
         
            -
              prerelease:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 31098205
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: true
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
      
 9 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 10 
     | 
    
         
            +
              - beta
         
     | 
| 
      
 11 
     | 
    
         
            +
              version: 1.0.3.beta
         
     | 
| 
       11 
12 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
13 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
14 
     | 
    
         
             
            - Felipe Coury
         
     | 
| 
         @@ -15,7 +16,7 @@ autorequire: 
     | 
|
| 
       15 
16 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
17 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-08- 
     | 
| 
      
 19 
     | 
    
         
            +
            date: 2010-08-11 00:00:00 -03:00
         
     | 
| 
       19 
20 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
21 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
22 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -156,6 +157,7 @@ extra_rdoc_files: 
     | 
|
| 
       156 
157 
     | 
    
         
             
            - lib/webbynode/engines/all.rb
         
     | 
| 
       157 
158 
     | 
    
         
             
            - lib/webbynode/engines/django.rb
         
     | 
| 
       158 
159 
     | 
    
         
             
            - lib/webbynode/engines/engine.rb
         
     | 
| 
      
 160 
     | 
    
         
            +
            - lib/webbynode/engines/nodejs.rb
         
     | 
| 
       159 
161 
     | 
    
         
             
            - lib/webbynode/engines/php.rb
         
     | 
| 
       160 
162 
     | 
    
         
             
            - lib/webbynode/engines/rack.rb
         
     | 
| 
       161 
163 
     | 
    
         
             
            - lib/webbynode/engines/rails.rb
         
     | 
| 
         @@ -220,6 +222,7 @@ files: 
     | 
|
| 
       220 
222 
     | 
    
         
             
            - lib/webbynode/engines/all.rb
         
     | 
| 
       221 
223 
     | 
    
         
             
            - lib/webbynode/engines/django.rb
         
     | 
| 
       222 
224 
     | 
    
         
             
            - lib/webbynode/engines/engine.rb
         
     | 
| 
      
 225 
     | 
    
         
            +
            - lib/webbynode/engines/nodejs.rb
         
     | 
| 
       223 
226 
     | 
    
         
             
            - lib/webbynode/engines/php.rb
         
     | 
| 
       224 
227 
     | 
    
         
             
            - lib/webbynode/engines/rack.rb
         
     | 
| 
       225 
228 
     | 
    
         
             
            - lib/webbynode/engines/rails.rb
         
     | 
| 
         @@ -284,6 +287,7 @@ files: 
     | 
|
| 
       284 
287 
     | 
    
         
             
            - spec/webbynode/commands/webbies_spec.rb
         
     | 
| 
       285 
288 
     | 
    
         
             
            - spec/webbynode/engines/django_spec.rb
         
     | 
| 
       286 
289 
     | 
    
         
             
            - spec/webbynode/engines/engine_spec.rb
         
     | 
| 
      
 290 
     | 
    
         
            +
            - spec/webbynode/engines/nodejs_spec.rb
         
     | 
| 
       287 
291 
     | 
    
         
             
            - spec/webbynode/engines/php_spec.rb
         
     | 
| 
       288 
292 
     | 
    
         
             
            - spec/webbynode/engines/rack_spec.rb
         
     | 
| 
       289 
293 
     | 
    
         
             
            - spec/webbynode/engines/rails3_spec.rb
         
     |