screwcap 0.6.1 → 0.6.2

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.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ Hoe.plugin :newgem
11
11
  # Generate all the Rake tasks
12
12
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
13
  $hoe = Hoe.spec 'screwcap' do
14
- self.version = '0.6.1'
14
+ self.version = '0.6.2'
15
15
  self.developer 'Grant Ammons', 'grant@pipelinedeals.com'
16
16
  self.rubyforge_name = self.name # TODO this is default value
17
17
  self.extra_deps = [['net-ssh','>= 2.0.23'],['net-ssh-gateway','>=1.0.1'], ['net-scp','>=1.0.4']]
@@ -5,7 +5,7 @@ class Runner
5
5
  def self.execute! options
6
6
  @@silent = options[:silent]
7
7
  begin
8
- _log "\n*** BEGIN executing task #{options[:name]} on #{options[:server].name} with address #{options[:address]}\n", :color => :blue unless options[:silent] == true
8
+ _log "\nExecuting task named #{options[:name]} on #{options[:server].name}..\n", :color => :blue
9
9
  options[:server].__with_connection_for(options[:address]) do |ssh|
10
10
  options[:commands].each do |command|
11
11
  ret = run_command(command, ssh, options)
@@ -14,10 +14,8 @@ class Runner
14
14
  end
15
15
  rescue Net::SSH::AuthenticationFailed => e
16
16
  raise Net::SSH::AuthenticationFailed, "Authentication failed for server named #{server.name}. Please check your authentication credentials."
17
- #rescue Exception => e
18
- # _errorlog " F: (#{options[:address]}): #{e}", :color => :red
19
17
  ensure
20
- _log "*** END executing task #{options[:name]} on #{options[:server].name} with address #{options[:address]}\n\n", :color => :blue
18
+ _log "\nComplete\n", :color => :blue
21
19
  end
22
20
  options[:commands] # for tests
23
21
  end
@@ -45,29 +43,27 @@ class Runner
45
43
 
46
44
  def self.run_command(command, ssh, options)
47
45
  if command[:type] == :remote
48
- _log " I: (#{options[:address]}): #{command[:command]}\n", :color => :green
49
46
  stdout, stderr, exit_code, exit_signal = ssh_exec! ssh, command[:command]
50
47
  command[:stdout] = stdout
51
48
  command[:stderr] = stderr
52
49
  command[:exit_code] = exit_code
53
- _log(" O: (#{options[:address]}): #{stdout}", :color => :green) unless stdout.nil? or stdout == ""
54
- _errorlog(" O: (#{options[:address]}): #{stderr}", :color => :red) unless stderr.nil? or stderr == ""
55
- _errorlog(" E: (#{options[:address]}): #{command[:command]} return exit code: #{exit_code}\n", :color => :red) if exit_code != 0
50
+ if exit_code == 0
51
+ _log(".", :color => :green)
52
+ else
53
+ _errorlog("\n E: (#{options[:address]}): #{command[:command]} return exit code: #{exit_code}\n", :color => :red) if exit_code != 0
54
+ end
56
55
  return exit_code
57
56
  elsif command[:type] == :local
58
57
  ret = `#{command[:command]}`
59
58
  command[:stdout] = ret
60
59
  if $?.to_i == 0
61
- _log " I: (local): #{command[:command]}\n", :color => :blue
62
- _log " O: (local): #{ret}\n", :color => :blue
60
+ _log(".", :color => :green)
63
61
  else
64
- _log " I: (local): #{command[:command]}\n", :color => :blue
65
- _errorlog " O: (local): #{ret}\n", :color => :red
66
- _errorlog(" E: (local): #{command[:command]} return exit code: #{$?}\n", :color => :red) if $? != 0
62
+ _errorlog("\n E: (local): #{command[:command]} return exit code: #{$?}\n", :color => :red) if $? != 0
67
63
  end
68
64
  return $?
69
65
  elsif command[:type] == :scp
70
- _log " I: (#{options[:address]}): SCP #{command[:local]} to #{options[:server].__user}@#{options[:address]}:#{command[:remote]}\n", :color => :green
66
+ putc "."
71
67
  options[:server].__upload_to!(options[:address], command[:local], command[:remote])
72
68
 
73
69
  # this will need to be improved to allow for :onfailure
data/lib/screwcap.rb CHANGED
@@ -16,7 +16,7 @@ require 'screwcap/sequence'
16
16
  require 'screwcap/task_manager'
17
17
 
18
18
  module Screwcap
19
- VERSION='0.6.1'
19
+ VERSION='0.6.2'
20
20
 
21
21
  class TaskNotFound < RuntimeError; end
22
22
  class NoServersDefined < Exception; end
data/screwcap.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'bundler/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "screwcap"
9
- s.version = "0.6"
9
+ s.version = "0.6.2"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = "Grant Ammons"
12
12
  s.email = ["grant@pipelinedealsco.com"]
data/tasks/rspec.rake CHANGED
@@ -17,5 +17,6 @@ end
17
17
  desc "Run the specs under spec/models"
18
18
  Spec::Rake::SpecTask.new do |t|
19
19
  t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.rcov = true
20
21
  t.spec_files = FileList['spec/**/*_spec.rb']
21
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screwcap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Grant Ammons
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-22 00:00:00 -05:00
18
+ date: 2011-02-26 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency