bleetz 1.1 → 1.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/lib/bleetz.rb +11 -11
- data/lib/bleetz/conf.rb +7 -7
- metadata +58 -47
data/lib/bleetz.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'net/ssh'
|
3
3
|
require 'yaml'
|
4
|
-
require 'bleetz/conf.rb'
|
5
|
-
require 'bleetz/object.rb'
|
6
4
|
|
7
5
|
class Bleetz
|
8
6
|
|
9
|
-
VERSION = "1.
|
7
|
+
VERSION = "1.2"
|
10
8
|
|
11
9
|
USAGE = <<-EOF
|
12
|
-
Usage: bleetz [-c conf_file -h -l -s][[-t -v -c conf_file]
|
10
|
+
Usage: bleetz [-c conf_file -h -l -s][[-t -v -c conf_file] action]
|
13
11
|
|
14
12
|
-c <conf_file> - Specify a special bleetz configuration file.
|
15
13
|
-h - Help.
|
16
|
-
-l - List available
|
14
|
+
-l - List available action(s) defined in bleetz configuration file.
|
17
15
|
-s - Test ssh connection defined in bleetz conf.
|
18
|
-
-t <
|
16
|
+
-t <action_name> - Test actions (just print command that will be executed.
|
19
17
|
-v - Verbose Mode.
|
20
18
|
-V - Print bleetz version.
|
21
19
|
EOF
|
@@ -26,6 +24,8 @@ EOF
|
|
26
24
|
begin
|
27
25
|
if @file.nil?
|
28
26
|
cnf = YAML::load(File.open("#{Dir.pwd}/.bleetz"))
|
27
|
+
require 'bleetz/conf.rb'
|
28
|
+
require 'bleetz/object.rb'
|
29
29
|
@file = cnf[:config] || cnf['config']
|
30
30
|
end
|
31
31
|
load @file
|
@@ -34,7 +34,7 @@ EOF
|
|
34
34
|
end
|
35
35
|
list if @list
|
36
36
|
test_ssh if @ssh_test
|
37
|
-
abort "You need to specify
|
37
|
+
abort "You need to specify an action." if @action.nil?
|
38
38
|
format_cmds
|
39
39
|
test if @test
|
40
40
|
connect
|
@@ -75,11 +75,11 @@ EOF
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def format_cmds(action = @action)
|
78
|
-
abort "Unknown
|
78
|
+
abort "Unknown action: '#{action}'." unless @@actions.include?(action.to_sym)
|
79
79
|
begin
|
80
80
|
@@actions[action.to_sym].each { |c|
|
81
81
|
if c.is_a? Symbol
|
82
|
-
abort "Undefined
|
82
|
+
abort "Undefined action: :#{c}. You have to define it." unless @@tasks.include?(c)
|
83
83
|
format_cmds(c)
|
84
84
|
else
|
85
85
|
@cmd_to_exec << c
|
@@ -91,7 +91,7 @@ EOF
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def list
|
94
|
-
puts "Available
|
94
|
+
puts "Available actions:"
|
95
95
|
@@tasks.each { |k,v|
|
96
96
|
desc = (v.empty? ? "No desc" : v)
|
97
97
|
puts "#{k}: #{desc}"
|
@@ -145,7 +145,7 @@ EOF
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def version
|
148
|
-
puts "bleetz version #{VERSION}.
|
148
|
+
puts "bleetz version #{VERSION}. Frak yeah !"
|
149
149
|
exit(0)
|
150
150
|
end
|
151
151
|
|
data/lib/bleetz/conf.rb
CHANGED
@@ -8,8 +8,8 @@ module Conf
|
|
8
8
|
base.extend(self)
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
check_main_call(:
|
11
|
+
def action(action, desc = "")
|
12
|
+
check_main_call(:action)
|
13
13
|
@cmds = []
|
14
14
|
yield
|
15
15
|
h = { action.to_sym => @cmds }
|
@@ -24,10 +24,10 @@ module Conf
|
|
24
24
|
@cmds << cmd
|
25
25
|
end
|
26
26
|
|
27
|
-
def call(
|
27
|
+
def call(action)
|
28
28
|
check_sub_call(:call)
|
29
|
-
raise "'call :
|
30
|
-
@cmds <<
|
29
|
+
raise "'call :action_name'. You didn't pass a Symbol." unless action.is_a? Symbol
|
30
|
+
@cmds << action
|
31
31
|
end
|
32
32
|
|
33
33
|
def set(opt, value)
|
@@ -39,12 +39,12 @@ module Conf
|
|
39
39
|
|
40
40
|
def check_main_call(func)
|
41
41
|
method = caller[2][/`([^']*)'/, 1]
|
42
|
-
raise "Main configuration function, you cannot call '#{func}'
|
42
|
+
raise "Main configuration function, you cannot call '#{func}' in '#{method}'." unless method.eql?("load")
|
43
43
|
end
|
44
44
|
|
45
45
|
def check_sub_call(func)
|
46
46
|
method = caller[2][/`([^']*)'/, 1]
|
47
|
-
raise "'#{func}' has to be called in '
|
47
|
+
raise "'#{func}' has to be called in 'action' function." unless method.eql?("action")
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
metadata
CHANGED
@@ -1,84 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bleetz
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
version: "1.2"
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Thibaut Deloffre
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2012-12-14 00:00:00 Z
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
15
20
|
name: highline
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: net-ssh
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
33
23
|
none: false
|
34
|
-
requirements:
|
35
|
-
- -
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
38
31
|
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: net-ssh
|
39
35
|
prerelease: false
|
40
|
-
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
37
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
46
47
|
description: Fast KISS deployment tool
|
47
48
|
email: tib@rocknroot.org
|
48
|
-
executables:
|
49
|
+
executables:
|
49
50
|
- bleetz
|
50
51
|
extensions: []
|
51
|
-
|
52
|
+
|
53
|
+
extra_rdoc_files:
|
52
54
|
- LICENSE.txt
|
53
|
-
files:
|
55
|
+
files:
|
54
56
|
- lib/bleetz.rb
|
55
57
|
- lib/bleetz/conf.rb
|
56
58
|
- lib/bleetz/object.rb
|
57
59
|
- LICENSE.txt
|
58
60
|
- bin/bleetz
|
59
61
|
homepage: https://github.com/TibshoOT/bleetz
|
60
|
-
licenses:
|
62
|
+
licenses:
|
61
63
|
- BSD
|
62
64
|
post_install_message:
|
63
65
|
rdoc_options: []
|
64
|
-
|
66
|
+
|
67
|
+
require_paths:
|
65
68
|
- lib
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
70
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
79
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
78
87
|
requirements: []
|
88
|
+
|
79
89
|
rubyforge_project:
|
80
90
|
rubygems_version: 1.8.24
|
81
91
|
signing_key:
|
82
92
|
specification_version: 3
|
83
93
|
summary: Fast KISS deployment tool
|
84
94
|
test_files: []
|
95
|
+
|