rboss 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rboss-cli CHANGED
@@ -35,7 +35,6 @@ servers_file = "#@conf_dir/jboss-cli-servers.yaml"
35
35
  @resources = {}
36
36
  @parameters = {}
37
37
  @servers_file = File.expand_path(servers_file)
38
- @operation = :read_resource
39
38
  save = false
40
39
  params[:jboss_home] = (ENV["RBOSS_CLI_JBOSS_HOME"] or Dir.pwd)
41
40
  params[:host] = '127.0.0.1'
@@ -112,13 +111,15 @@ opts.on('-a', '--args PARAMETERS', Array,
112
111
  end
113
112
 
114
113
  RBoss::Cli::Mappings.resource_mappings.each do |name, config|
115
- if config[:scan]
116
- opts.on("--#{name} [NAMES]", Array, config[:description]) do |resources|
117
- @resources[name] = resources
118
- end
119
- else
120
- opts.on("--#{name}", config[:description]) do
121
- @resources[name] = true
114
+ if config[:description]
115
+ if config[:scan]
116
+ opts.on("--#{name} [NAMES]", Array, config[:description]) do |resources|
117
+ @resources[name] = resources
118
+ end
119
+ else
120
+ opts.on("--#{name}", config[:description]) do
121
+ @resources[name] = true
122
+ end
122
123
  end
123
124
  end
124
125
  end
@@ -152,7 +153,13 @@ if save
152
153
  puts "Configuration saved!"
153
154
  end
154
155
 
155
- puts opts if @resources.empty?
156
+ if @resources.empty? and not @operation
157
+ puts opts
158
+ elsif @resources.empty?
159
+ @resources[''] = true
160
+ elsif not @operation
161
+ @operation = :read_resource
162
+ end
156
163
 
157
164
  def execute_actions
158
165
  begin
@@ -131,7 +131,7 @@ module RBoss
131
131
  end
132
132
  end
133
133
  result = result("#{path}:#{builder}")
134
- puts Yummi::colorize("Result:", :yellow)
134
+ puts Yummi::colorize("Result:", :intense_yellow)
135
135
  #TODO print a table using the returned parameters
136
136
  puts YAML::dump(result)
137
137
  end
@@ -36,18 +36,20 @@ module RBoss
36
36
  name = File.basename(file, '.yaml').gsub('_', '-')
37
37
  mapping = YAML::load_file(file).symbolize_keys
38
38
  @resource_mappings[name] = mapping
39
- mapping[:print].each do |table|
40
- if table[:id]
41
- new_mapping = mapping.dup
42
- new_mapping[:print] = [table]
43
- new_mapping[:description] = table[:title]
44
- new_mapping[:derived] = true
45
- if table[:path]
46
- new_mapping[:path] = table[:path].gsub '${PATH}', mapping[:path]
47
- table[:path] = new_mapping[:path]
39
+ if mapping[:print]
40
+ mapping[:print].each do |table|
41
+ if table[:id]
42
+ new_mapping = mapping.dup
43
+ new_mapping[:print] = [table]
44
+ new_mapping[:description] = table[:title]
45
+ new_mapping[:derived] = true
46
+ if table[:path]
47
+ new_mapping[:path] = table[:path].gsub '${PATH}', mapping[:path]
48
+ table[:path] = new_mapping[:path]
49
+ end
50
+ new_key = "#{name}-#{table[:id]}"
51
+ @resource_mappings[new_key] = new_mapping
48
52
  end
49
- new_key = "#{name}-#{table[:id]}"
50
- @resource_mappings[new_key] = new_mapping
51
53
  end
52
54
  end
53
55
  end
@@ -65,6 +67,9 @@ module RBoss
65
67
  if File.exist? file
66
68
  load_resources file
67
69
  end
70
+ @resource_mappings[''] = {
71
+ :path => ''
72
+ }
68
73
  end
69
74
 
70
75
  module_function :load_resources,
@@ -30,7 +30,7 @@ module RBoss
30
30
  @invoker = invoker
31
31
  @context = {
32
32
  :name => '',
33
- :read_resource => 'read-resource(include-runtime=true)'
33
+ :read_resource => 'read-resource(include-runtime=true,recursive=true)'
34
34
  }
35
35
  @context[:path] = parse(@config[:path])
36
36
  @tables = []
@@ -49,6 +49,7 @@ module RBoss
49
49
  def read_resource(resources, arguments)
50
50
  resources ||= scan
51
51
  params = @config[:print]
52
+ return unless params
52
53
  params.each do |p|
53
54
  table_builder = RBoss::TableBuilder::new p
54
55
  table_builder.add_name_column if scannable?
@@ -70,7 +71,7 @@ module RBoss
70
71
  end
71
72
 
72
73
  def read_operation_names(resource_name, arguments)
73
- operations = Yummi::colorize('Operations:', :yellow)
74
+ operations = Yummi::colorize('Operations:', :intense_yellow)
74
75
  operations << $/
75
76
  with resource_name do
76
77
  result = @invoker.result("#{@context[:path]}:read-operation-names")
@@ -197,7 +198,7 @@ module RBoss
197
198
  end
198
199
 
199
200
  def get_data(config)
200
- command = parse((config[:command] or '${PATH}:read-resource(include-runtime=true)'))
201
+ command = parse((config[:command] or "${PATH}:#{@context[:read_resource]}"))
201
202
  begin
202
203
  result = @invoker.result(command)
203
204
  data = []
data/lib/rboss/version.rb CHANGED
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module RBoss
24
- VERSION = "0.8.0"
24
+ VERSION = "0.8.1"
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rboss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-01 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "Rboss gives you a set of command line tools to configure a JBoss instance\n
15
15
  \ and use jboss-cli and twiddle wrapped by an elegant interface"