rutty 2.0.0 → 2.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/VERSION +1 -1
- data/bin/rutty +24 -13
- data/lib/rutty.rb +4 -4
- data/lib/rutty/actions.rb +16 -13
- data/lib/rutty/config.rb +2 -2
- data/lib/rutty/consts.rb +5 -2
- data/lib/rutty/nodes.rb +2 -2
- data/lib/rutty/version.rb +1 -1
- data/rutty.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.0
|
data/bin/rutty
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
|
2
4
|
require 'rubygems'
|
3
5
|
require 'commander/import'
|
4
6
|
require 'rutty'
|
@@ -21,13 +23,26 @@ program :help_formatter, Commander::HelpFormatter::TerminalCompact
|
|
21
23
|
|
22
24
|
default_command :dsh
|
23
25
|
|
26
|
+
global_option '-c', '--config DIR', 'Directory to load configs from, defaults to ~/.rutty' do |dir|
|
27
|
+
begin
|
28
|
+
$r.config File.join(dir, Rutty::Consts::GENERAL_CONF_FILE)
|
29
|
+
$r.nodes File.join(dir, Rutty::Consts::NODES_CONF_FILE)
|
30
|
+
rescue Errno::ENOENT => e
|
31
|
+
if e.to_s =~ /No such file or directory - (.*)/
|
32
|
+
raise Rutty::NotInstalledError.new "Unable to find #{$1}. Maybe run `rutty init #{dir}' first?"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
24
37
|
# Commander commands
|
25
38
|
command :init do |c|
|
26
|
-
c.syntax = "rutty init"
|
27
|
-
c.summary = "Creates the default file structure for rutty
|
28
|
-
c.
|
29
|
-
|
30
|
-
|
39
|
+
c.syntax = "rutty init [DIR]"
|
40
|
+
c.summary = "Creates the default file structure for rutty"
|
41
|
+
c.description = "#{c.summary} in the specified DIR. If DIR is not given, defaults to ~/.rutty"
|
42
|
+
c.when_called do |args, options|
|
43
|
+
args.push Rutty::Consts::CONF_DIR if args.empty?
|
44
|
+
|
45
|
+
$r.init args.pop
|
31
46
|
end
|
32
47
|
end
|
33
48
|
|
@@ -43,8 +58,7 @@ command :add_node do |c|
|
|
43
58
|
add_filter_options.call(c)
|
44
59
|
|
45
60
|
c.when_called do |args, options|
|
46
|
-
r
|
47
|
-
r.add_node args, options
|
61
|
+
$r.add_node args, options
|
48
62
|
end
|
49
63
|
end
|
50
64
|
|
@@ -61,8 +75,7 @@ command :list_nodes do |c|
|
|
61
75
|
add_filter_options.call(c)
|
62
76
|
|
63
77
|
c.when_called do |args, options|
|
64
|
-
r
|
65
|
-
r.list_nodes args, options
|
78
|
+
$r.list_nodes args, options
|
66
79
|
end
|
67
80
|
end
|
68
81
|
|
@@ -78,8 +91,7 @@ command :dsh do |c|
|
|
78
91
|
c.option('-d', '--debug', 'Enable debug output')
|
79
92
|
|
80
93
|
c.when_called do |args, options|
|
81
|
-
r
|
82
|
-
r.dsh args, options
|
94
|
+
$r.dsh args, options
|
83
95
|
end
|
84
96
|
end
|
85
97
|
|
@@ -93,8 +105,7 @@ command :scp do |c|
|
|
93
105
|
c.option('-d', '--debug', 'Enable debug output')
|
94
106
|
|
95
107
|
c.when_called do |args, options|
|
96
|
-
r
|
97
|
-
r.dsh args, options
|
108
|
+
$r.dsh args, options
|
98
109
|
end
|
99
110
|
end
|
100
111
|
|
data/lib/rutty.rb
CHANGED
@@ -16,12 +16,12 @@ module Rutty
|
|
16
16
|
include Rutty::Helpers
|
17
17
|
include Rutty::Actions
|
18
18
|
|
19
|
-
def config
|
20
|
-
@config ||= Rutty::Config.load_config
|
19
|
+
def config file = Rutty::Consts::GENERAL_CONF
|
20
|
+
@config ||= Rutty::Config.load_config file
|
21
21
|
end
|
22
22
|
|
23
|
-
def nodes
|
24
|
-
@nodes ||= Rutty::Nodes.load_config
|
23
|
+
def nodes file = Rutty::Consts::NODES_CONF
|
24
|
+
@nodes ||= Rutty::Nodes.load_config file
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/rutty/actions.rb
CHANGED
@@ -2,18 +2,21 @@ require 'rutty/consts'
|
|
2
2
|
|
3
3
|
module Rutty
|
4
4
|
module Actions
|
5
|
-
def init
|
6
|
-
|
7
|
-
|
5
|
+
def init dir
|
6
|
+
general_file = File.join(dir, Rutty::Consts::GENERAL_CONF_FILE)
|
7
|
+
nodes_file = File.join(dir, Rutty::Consts::NODES_CONF_FILE)
|
8
|
+
|
9
|
+
if File.exists? dir
|
10
|
+
log "exists", dir
|
8
11
|
else
|
9
|
-
log "create",
|
10
|
-
Dir.mkdir
|
12
|
+
log "create", dir
|
13
|
+
Dir.mkdir dir
|
11
14
|
end
|
12
15
|
|
13
|
-
if File.exists?
|
14
|
-
log "exists",
|
16
|
+
if File.exists? general_file
|
17
|
+
log "exists", general_file
|
15
18
|
else
|
16
|
-
log "create",
|
19
|
+
log "create", general_file
|
17
20
|
|
18
21
|
defaults_hash = {
|
19
22
|
:user => 'root',
|
@@ -21,17 +24,17 @@ module Rutty
|
|
21
24
|
:port => 22
|
22
25
|
}
|
23
26
|
|
24
|
-
File.open(
|
27
|
+
File.open(general_file, 'w') do |f|
|
25
28
|
YAML.dump(defaults_hash, f)
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
|
-
if File.exists?
|
30
|
-
log "exists",
|
32
|
+
if File.exists? nodes_file
|
33
|
+
log "exists", nodes_file
|
31
34
|
else
|
32
|
-
log "create",
|
35
|
+
log "create", nodes_file
|
33
36
|
|
34
|
-
File.open(
|
37
|
+
File.open(nodes_file, 'w') do |f|
|
35
38
|
YAML.dump([], f)
|
36
39
|
end
|
37
40
|
end
|
data/lib/rutty/config.rb
CHANGED
data/lib/rutty/consts.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
module Rutty
|
2
2
|
module Consts
|
3
|
+
GENERAL_CONF_FILE = 'defaults.yaml'
|
4
|
+
NODES_CONF_FILE = 'nodes.yaml'
|
5
|
+
|
3
6
|
CONF_DIR = File.join(ENV['HOME'], '.rutty')
|
4
|
-
GENERAL_CONF = File.join(CONF_DIR,
|
5
|
-
NODES_CONF = File.join(CONF_DIR,
|
7
|
+
GENERAL_CONF = File.join(CONF_DIR, GENERAL_CONF_FILE)
|
8
|
+
NODES_CONF = File.join(CONF_DIR, NODES_CONF_FILE)
|
6
9
|
end
|
7
10
|
end
|
data/lib/rutty/nodes.rb
CHANGED
@@ -4,9 +4,9 @@ require 'rutty/consts'
|
|
4
4
|
module Rutty
|
5
5
|
class Nodes < Array
|
6
6
|
class << self
|
7
|
-
def load_config
|
7
|
+
def load_config file
|
8
8
|
require 'yaml'
|
9
|
-
Rutty::Nodes.new YAML.load(File.open(
|
9
|
+
Rutty::Nodes.new YAML.load(File.open(file).read)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
data/lib/rutty/version.rb
CHANGED
data/rutty.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rutty}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Josh Lindsey"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-03}
|
13
13
|
s.default_executable = %q{rutty}
|
14
14
|
s.description = %q{
|
15
15
|
RuTTY is a DSH (distributed / dancer's shell) written in Ruby. It's used to run commands
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Lindsey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-03 00:00:00 -04:00
|
19
19
|
default_executable: rutty
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|