remote_executor 0.1.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.
data/README ADDED
File without changes
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift( File.join( File.dirname( __FILE__ ), '..', 'lib' ) )
4
+
5
+ require 'rubygems'
6
+ require 'remote_executor'
7
+
8
+
9
+ ##
10
+ # ::Main::
11
+ RemoteExecutor::Cli::execute(
12
+ Choice.choices[:environment],
13
+ Choice.choices[:system],
14
+ Choice.choices[:command]
15
+ )
@@ -0,0 +1,14 @@
1
+ module RemoteExecutor
2
+ class Cli
3
+
4
+ def self.execute( environment, name, command )
5
+
6
+ Config.instance[environment].each do |system|
7
+
8
+ if( system[:name] == name )
9
+ system[:hosts].each { |host| Net::SSH.start( host, 'root', :config=>true ) { |ssh| ssh.exec "#{command}" } }
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module RemoteExecutor
2
+ class Config
3
+ include Singleton
4
+
5
+ def initialize()
6
+ @config = YAML.load_file( Choice.choices[:config] )
7
+ end
8
+
9
+ def [](key)
10
+ @config[key.to_sym] if @config
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,43 @@
1
+ module RemoteExecutor
2
+ Choice.options do
3
+ header ''
4
+ header ' Specific options:'
5
+
6
+ option :config do
7
+ short '-c'
8
+ long '--config=settings.yml'
9
+ desc 'The yaml config file'
10
+ default '../config/settings.yml'
11
+ end
12
+
13
+ option :environment, :required=>true do
14
+ short '-e'
15
+ long '--environment=value'
16
+ desc 'The Environment name'
17
+ valid %w[development preproduction production]
18
+ end
19
+
20
+ option :system, :required=>true do
21
+ short '-s'
22
+ long '--system=value'
23
+ desc 'The System name'
24
+ end
25
+
26
+ option :command, :required=>true do
27
+ short '-c'
28
+ long '--command=value'
29
+ desc 'The Command'
30
+ end
31
+
32
+ separator ''
33
+ separator ' Common options:'
34
+
35
+ option :help do
36
+ short '-h'
37
+ long '--help'
38
+ desc "Show this screen"
39
+ end
40
+
41
+ separator ''
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ module RemoteExecutor
2
+ module Version
3
+
4
+ MAJOR = 0
5
+ MINOR = 1
6
+ PATCH = 0
7
+
8
+ STRING = [MAJOR, MINOR, PATCH ].compact.join( '.' )
9
+ end
10
+
11
+ NAME = 'remote_executor'
12
+ VERSION = Version::STRING
13
+ end
@@ -0,0 +1,6 @@
1
+ begin
2
+ %w[rubygems yaml singleton choice net/ssh].each { |gem| require gem }
3
+ %w[version options_parser config cli].each { |lib| require "remote_executor/#{lib}"}
4
+ rescue LoadException => e
5
+ $stderr.puts e.message
6
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: remote_executor
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Javier Juarez
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-19 00:00:00 +01:00
19
+ default_executable: remote_executor
20
+ dependencies: []
21
+
22
+ description: A little SSH remote command launcher
23
+ email: javier.juarez@gmail.com
24
+ executables:
25
+ - remote_executor
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README
30
+ files:
31
+ - bin/remote_executor
32
+ - lib/remote_executor.rb
33
+ - lib/remote_executor/cli.rb
34
+ - lib/remote_executor/config.rb
35
+ - lib/remote_executor/options_parser.rb
36
+ - lib/remote_executor/version.rb
37
+ - README
38
+ has_rdoc: true
39
+ homepage: http://github.com/jjuarez/remote_executor
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ hash: 3
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.7
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: A very simple gem that helps to launch remote commands over SSH connections
72
+ test_files: []
73
+