rhcp_shell 0.0.4 → 0.0.5

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 (3) hide show
  1. data/bin/rhcp_shell +26 -21
  2. data/lib/version.rb +1 -1
  3. metadata +1 -1
data/bin/rhcp_shell CHANGED
@@ -12,32 +12,37 @@ require 'base_shell'
12
12
  require 'rhcp_shell_backend'
13
13
  require 'version'
14
14
 
15
- class RhcpShell
16
-
15
+ module RHCP
16
+ class Shell
17
+
18
+ def initialize()
19
+
20
+ end
21
+
17
22
  HELP_STRING = <<EOF
18
23
 
19
24
  RHCP Command Shell v #{RhcpShell::Version.to_s} (using RHCP library v #{RHCP::Version.to_s})
20
25
 
21
26
  Usage:
22
- rhcp_shell.rb [--hostname=<hostname>] [--username=<username> --password=<password>]
27
+ rhcp_shell.rb [--hostname=<hostname>] [--username=<username> --password=<password>]
23
28
  [--help]
24
-
29
+
25
30
  Options:
26
- --hostname=<hostname>
31
+ --hostname=<hostname>
27
32
  the URL to the RHCP server you want to connect against, e.g.
28
33
  http://server.local.network/rhcp
29
34
  If the specified hostname does not start with "http", it is automatically expanded to
30
35
  http://<hostname>:42000/rhcp
31
36
  You can optionally specify a port number to connect against like this:
32
37
  http://myserver:42000
33
- If you do not specify a hostname, the shell will try to connect against
38
+ If you do not specify a hostname, the shell will try to connect against
34
39
  http://localhost:42000
35
-
36
- --username/--password
40
+
41
+ --username/--password
37
42
  the authentication data you want to use for connecting to the RHCP server
38
-
43
+
39
44
  --help
40
- displays this help screen.
45
+ displays this help screen.
41
46
 
42
47
  EOF
43
48
 
@@ -48,7 +53,7 @@ EOF
48
53
  [ '--password', '-p', GetoptLong::REQUIRED_ARGUMENT ],
49
54
  [ '--hostname', GetoptLong::REQUIRED_ARGUMENT ]
50
55
  )
51
-
56
+
52
57
  options = Hash.new
53
58
  opts.each do |opt, arg|
54
59
  case opt
@@ -61,23 +66,23 @@ EOF
61
66
  options[$1] = arg
62
67
  end
63
68
  end
64
-
69
+
65
70
  host = options["hostname"]
66
71
  if host == nil then
67
- host = "http://localhost:42000"
72
+ host = "http://localhost:42000"
68
73
  else
69
74
  if host !~ /http:/ then
70
75
  host = "http://#{host}:42000/rhcp"
71
- end
76
+ end
72
77
  end
73
78
  $logger.debug "now connecting to #{host}"
74
-
79
+
75
80
  # TODO add interactive query for password!
76
-
81
+
77
82
  begin
78
83
  url = URI.parse(host)
79
84
  @http_broker = RHCP::Client::HttpBroker.new(url)
80
-
85
+
81
86
  backend = RHCPShellBackend.new(@http_broker)
82
87
  backend.banner = <<EOF
83
88
  Good morning, this is the generic RHCP Shell (v #{RhcpShell::Version.to_s}, using RHCP library v #{RHCP::Version.to_s})
@@ -86,7 +91,7 @@ If you want to exit this shell, please press Ctrl+C or type "exit".
86
91
 
87
92
  EOF
88
93
  $logger.debug "backend has been instantiated : #{backend}"
89
-
94
+
90
95
  shell = BaseShell.new(backend)
91
96
  shell.run
92
97
  rescue => ex
@@ -95,14 +100,14 @@ EOF
95
100
  puts ex.backtrace.join("\n")
96
101
  end
97
102
  end
98
- end
99
-
103
+ end
104
+ end
100
105
 
101
106
  if $0 == __FILE__
102
107
  # TODO introduce something like the RAILS_ENVs
103
108
  $logger = Logger.new("rhcp_shell.log")
104
109
  RHCP::ModuleHelper.instance().logger = $logger
105
110
 
106
- shell = RhcpShell.new
111
+ shell = RHCP::Shell.new
107
112
  shell.run
108
113
  end
data/lib/version.rb CHANGED
@@ -5,7 +5,7 @@ module RhcpShell #:nodoc:
5
5
 
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- TINY = 4
8
+ TINY = 5
9
9
 
10
10
  def Version.to_s
11
11
  [ MAJOR, MINOR, TINY ].join(".")
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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Traeder