capsh 0.2.0 → 0.3.0

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.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/capsh +5 -22
  3. data/capsh.gemspec +3 -2
  4. data/lib/capsh.rb +30 -0
  5. metadata +3 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/bin/capsh CHANGED
@@ -1,30 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
- require "rubygems"
3
- require "capistrano"
4
- require "capistrano/shell"
5
-
6
- module Ext
7
- def current_task
8
- super || task_list(true).first
9
- end
10
- end
11
-
12
- cfg = Capistrano::Configuration.new
13
- cfg.set :ssh_options, { :forward_agent => true, :auth_methods => "publickey" }
2
+ require File.join(File.dirname(__FILE__), "..", "lib", "capsh")
14
3
 
15
4
  hosts = ARGV.reject{|a| a.include?("=") }
16
5
 
17
- ARGV.select{|a| a.include?("=") }.each do |flag|
6
+ flags = ARGV.select{|a| a.include?("=") }.inject({}) do |hash, flag|
18
7
  if flag =~ /--(.*)=(.*)/
19
- cfg.set $1.to_sym, $2
8
+ hash[$1.to_sym] = $2
20
9
  end
10
+ hash
21
11
  end
22
12
 
23
- cfg.role :app, *hosts
24
- cfg.task :hello do
25
- end
26
-
27
- cfg.extend(Ext)
28
-
29
- Capistrano::Shell.run(cfg)
30
-
13
+ Capsh.new(hosts, flags).run
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{capsh}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyle Maxwell"]
@@ -24,7 +24,8 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "bin/capsh",
27
- "capsh.gemspec"
27
+ "capsh.gemspec",
28
+ "lib/capsh.rb"
28
29
  ]
29
30
  s.homepage = %q{http://github.com/fizx/capsh}
30
31
  s.rdoc_options = ["--charset=UTF-8"]
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "capistrano"
4
+ require "capistrano/shell"
5
+
6
+ class Capsh
7
+ module Ext
8
+ def current_task
9
+ super || task_list(true).first
10
+ end
11
+ end
12
+
13
+ attr_reader :cfg
14
+
15
+ def initialize(hosts, options = {}, cfg = Capistrano::Configuration.new)
16
+ @cfg = cfg
17
+ cfg.set :ssh_options, { :forward_agent => true, :auth_methods => "publickey" }
18
+ cfg.extend(Ext)
19
+ options.each do |k, v|
20
+ cfg.set(k, v)
21
+ end
22
+ cfg.role :app, *hosts
23
+ cfg.task :a_fake_caph_task do
24
+ end
25
+ end
26
+
27
+ def run()
28
+ Capistrano::Shell.run(cfg)
29
+ end
30
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kyle Maxwell
@@ -47,6 +47,7 @@ files:
47
47
  - VERSION
48
48
  - bin/capsh
49
49
  - capsh.gemspec
50
+ - lib/capsh.rb
50
51
  has_rdoc: true
51
52
  homepage: http://github.com/fizx/capsh
52
53
  licenses: []