rhcp_shell 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -1
- data/Rakefile +8 -3
- data/lib/rhcp_shell.rb +25 -11
- data/rhcp_shell.sh +4 -0
- metadata +2 -2
- data/start_shell.sh +0 -3
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -4,8 +4,11 @@ require 'rake/rdoctask'
|
|
4
4
|
require 'rake/packagetask'
|
5
5
|
require 'rake/gempackagetask'
|
6
6
|
|
7
|
+
$LOAD_PATH.push('lib')
|
8
|
+
require File.join(File.dirname(__FILE__), 'lib', 'rhcp_shell.rb')
|
9
|
+
|
7
10
|
PKG_NAME = 'rhcp_shell'
|
8
|
-
PKG_VERSION =
|
11
|
+
PKG_VERSION = RhcpShell::Version.to_s
|
9
12
|
|
10
13
|
desc "Default Task"
|
11
14
|
task :default => [ :test ]
|
@@ -55,10 +58,12 @@ task :lines do
|
|
55
58
|
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
56
59
|
end
|
57
60
|
|
58
|
-
|
61
|
+
task :coverage do
|
62
|
+
system "rcov -I lib/ -I test/ -x rcov.rb -x var/lib -x lib/shell_backend.rb test/*test.rb"
|
63
|
+
end
|
59
64
|
|
60
65
|
task :update_manifest do
|
61
|
-
system "rake check_manifest 2>/dev/null | grep -vE 'qooxdoo|nbproject|coverage' | grep -E '^\+' | grep -vE '^$' | grep -v '(in ' | grep -vE '^\+\+\+' | cut -b 2-200
|
66
|
+
system "rake check_manifest 2>/dev/null | grep -vE 'qooxdoo|nbproject|coverage' | grep -E '^\+' | grep -vE '^$' | grep -v '(in ' | grep -vE '^\+\+\+' | cut -b 2-200 >> Manifest.txt"
|
62
67
|
end
|
63
68
|
|
64
69
|
require 'rubygems'
|
data/lib/rhcp_shell.rb
CHANGED
@@ -11,14 +11,26 @@ require 'rhcp'
|
|
11
11
|
require 'base_shell'
|
12
12
|
require 'rhcp_shell_backend'
|
13
13
|
|
14
|
-
# TODO version number
|
15
|
-
SHELL_VERSION = "0.1"
|
16
|
-
|
17
14
|
class RhcpShell
|
15
|
+
|
16
|
+
class Version
|
17
|
+
|
18
|
+
include Singleton
|
19
|
+
|
20
|
+
MAJOR = 0
|
21
|
+
MINOR = 0
|
22
|
+
TINY = 2
|
23
|
+
|
24
|
+
def Version.to_s
|
25
|
+
[ MAJOR, MINOR, TINY ].join(".")
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
end
|
18
30
|
|
19
31
|
HELP_STRING = <<EOF
|
20
32
|
|
21
|
-
RHCP Command Shell v #{
|
33
|
+
RHCP Command Shell v #{RhcpShell::Version.to_s} (using RHCP library v #{RHCP::Version.to_s})
|
22
34
|
|
23
35
|
Usage:
|
24
36
|
rhcp_shell.rb [--hostname=<hostname>] [--username=<username> --password=<password>]
|
@@ -82,7 +94,7 @@ EOF
|
|
82
94
|
|
83
95
|
backend = RHCPShellBackend.new(@http_broker)
|
84
96
|
backend.banner = <<EOF
|
85
|
-
Good morning, this is the generic RHCP Shell.
|
97
|
+
Good morning, this is the generic RHCP Shell (v #{RhcpShell::Version.to_s}, using RHCP library v #{RHCP::Version.to_s})
|
86
98
|
Press <tab> for command completion or type "help" for a list of commands.
|
87
99
|
If you want to exit this shell, please press Ctrl+C or type "exit".
|
88
100
|
|
@@ -92,7 +104,7 @@ EOF
|
|
92
104
|
shell = BaseShell.new(backend)
|
93
105
|
shell.run
|
94
106
|
rescue => ex
|
95
|
-
puts "There occurred an HTTP error while connecting to the RHCP: #{ex}"
|
107
|
+
puts "There occurred an HTTP error while connecting to the RHCP server: #{ex}"
|
96
108
|
puts "Please connect against another server or fix the connection problem."
|
97
109
|
puts ex.backtrace.join("\n")
|
98
110
|
end
|
@@ -100,9 +112,11 @@ EOF
|
|
100
112
|
end
|
101
113
|
|
102
114
|
|
103
|
-
|
104
|
-
|
105
|
-
|
115
|
+
if $0 == __FILE__
|
116
|
+
# TODO introduce something like the RAILS_ENVs
|
117
|
+
$logger = Logger.new("rhcp_shell.log")
|
118
|
+
RHCP::ModuleHelper.instance().logger = $logger
|
106
119
|
|
107
|
-
shell = RhcpShell.new
|
108
|
-
shell.run
|
120
|
+
shell = RhcpShell.new
|
121
|
+
shell.run
|
122
|
+
end
|
data/rhcp_shell.sh
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhcp_shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp T.
|
@@ -43,7 +43,7 @@ files:
|
|
43
43
|
- lib/rhcp_shell.rb
|
44
44
|
- lib/rhcp_shell_backend.rb
|
45
45
|
- lib/shell_backend.rb
|
46
|
-
-
|
46
|
+
- rhcp_shell.sh
|
47
47
|
- test/rhcp_shell_backend_test.rb
|
48
48
|
- test/setup_test_registry.rb
|
49
49
|
has_rdoc: true
|
data/start_shell.sh
DELETED