buzz 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.
- data/Gemfile +6 -0
- data/Gemfile.lock +27 -0
- data/VERSION +1 -1
- data/buzz.gemspec +8 -2
- data/features/exit.feature +13 -0
- data/features/help.feature +18 -0
- data/features/step_definitions/terminal_steps.rb +16 -0
- data/features/support/env.rb +2 -0
- data/lib/channel.rb +22 -2
- data/spec/channel_spec.rb +17 -0
- data/spec/spec_helper.rb +16 -0
- metadata +9 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,8 +2,24 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
addressable (2.3.4)
|
5
|
+
aruba (0.5.2)
|
6
|
+
childprocess (~> 0.3.6)
|
7
|
+
cucumber (>= 1.1.1)
|
8
|
+
rspec-expectations (>= 2.7.0)
|
9
|
+
builder (3.2.0)
|
10
|
+
childprocess (0.3.9)
|
11
|
+
ffi (~> 1.0, >= 1.0.11)
|
5
12
|
crack (0.3.2)
|
13
|
+
cucumber (1.2.5)
|
14
|
+
builder (>= 2.1.2)
|
15
|
+
diff-lcs (>= 1.1.3)
|
16
|
+
gherkin (~> 2.11.7)
|
17
|
+
multi_json (~> 1.3)
|
18
|
+
diff-lcs (1.2.1)
|
6
19
|
extensions (0.6.0)
|
20
|
+
ffi (1.7.0)
|
21
|
+
gherkin (2.11.8)
|
22
|
+
multi_json (~> 1.3)
|
7
23
|
git (1.2.5)
|
8
24
|
jeweler (1.8.4)
|
9
25
|
bundler (~> 1.0)
|
@@ -11,9 +27,18 @@ GEM
|
|
11
27
|
rake
|
12
28
|
rdoc
|
13
29
|
json (1.7.7)
|
30
|
+
multi_json (1.7.2)
|
14
31
|
rake (10.0.4)
|
15
32
|
rdoc (4.0.1)
|
16
33
|
json (~> 1.4)
|
34
|
+
rspec (2.13.0)
|
35
|
+
rspec-core (~> 2.13.0)
|
36
|
+
rspec-expectations (~> 2.13.0)
|
37
|
+
rspec-mocks (~> 2.13.0)
|
38
|
+
rspec-core (2.13.0)
|
39
|
+
rspec-expectations (2.13.0)
|
40
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
+
rspec-mocks (2.13.0)
|
17
42
|
sif (0.1.0)
|
18
43
|
thor (0.18.1)
|
19
44
|
vcr (2.4.0)
|
@@ -25,10 +50,12 @@ PLATFORMS
|
|
25
50
|
ruby
|
26
51
|
|
27
52
|
DEPENDENCIES
|
53
|
+
aruba
|
28
54
|
bundler
|
29
55
|
extensions
|
30
56
|
jeweler (~> 1.8.4)
|
31
57
|
rake
|
58
|
+
rspec
|
32
59
|
sif (~> 0.1.0)
|
33
60
|
thor
|
34
61
|
vcr
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/buzz.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "buzz"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["George McIntosh"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-22"
|
13
13
|
s.description = "A growing suite of tools for doing handy admin tasks etc with Spacewalk"
|
14
14
|
s.email = "george@georgemcintosh.com"
|
15
15
|
s.executables = ["buzz"]
|
@@ -29,9 +29,15 @@ Gem::Specification.new do |s|
|
|
29
29
|
"buzz",
|
30
30
|
"buzz.gemspec",
|
31
31
|
"conf/.buzz",
|
32
|
+
"features/exit.feature",
|
33
|
+
"features/help.feature",
|
34
|
+
"features/step_definitions/terminal_steps.rb",
|
35
|
+
"features/support/env.rb",
|
32
36
|
"lib/buzz.rb",
|
33
37
|
"lib/channel.rb",
|
34
38
|
"lib/system.rb",
|
39
|
+
"spec/channel_spec.rb",
|
40
|
+
"spec/spec_helper.rb",
|
35
41
|
"test/helper.rb",
|
36
42
|
"test/test_buzz.rb"
|
37
43
|
]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: exit statuses
|
2
|
+
|
3
|
+
In order to specify expected exit statuws
|
4
|
+
As a developer using Cucumber
|
5
|
+
I want to use the "the exit status should be" step
|
6
|
+
|
7
|
+
Scenario: exit status of 0
|
8
|
+
When I run "ruby -h"
|
9
|
+
Then the exit status should be 0
|
10
|
+
|
11
|
+
Scenario: non-zero exit status
|
12
|
+
When I run "ruby -e 'exit 55'"
|
13
|
+
Then the exit status should be 55
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Get help
|
2
|
+
|
3
|
+
|
4
|
+
Scenario: Help
|
5
|
+
Given I provide no options
|
6
|
+
Then I should see
|
7
|
+
"""
|
8
|
+
Commands:
|
9
|
+
buzz channel # Manipulate Spacewalk channels
|
10
|
+
buzz help [COMMAND] # Describe available commands or one specific command
|
11
|
+
buzz system # Manipulate Spacewalk systems
|
12
|
+
|
13
|
+
Options:
|
14
|
+
-c, [--config=CONFIG]
|
15
|
+
-h, [--host=HOST]
|
16
|
+
-u, [--username=USERNAME]
|
17
|
+
-p, [--password=PASSWORD]
|
18
|
+
"""
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Given /^I start the app with "([^\"]*)"$/ do |command|
|
2
|
+
@io = StringIO.new
|
3
|
+
@app = Buzz.start(command.split(/\s+/), @io)
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^I provide no options$/) do
|
7
|
+
@app = Buzz.start([])
|
8
|
+
end
|
9
|
+
|
10
|
+
Then(/^I should see$/) do |string|
|
11
|
+
pending # express the regexp above with the code you wish you had
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^the exit status should be (\d+)$/ do |exit_status|
|
15
|
+
@last_exit_status.should == exit_status.to_i
|
16
|
+
end
|
data/lib/channel.rb
CHANGED
@@ -5,6 +5,26 @@ require "xmlrpc/client"
|
|
5
5
|
|
6
6
|
class Channel < Sif::Loader
|
7
7
|
|
8
|
+
desc "Regenerate YUM cache", "This call allows you to force the re-generation of the YUM cache for the specified channel"
|
9
|
+
def refresh(channel_label)
|
10
|
+
server = XMLRPC::Client.new(@spacewalk_server, "/rpc/api", 80)
|
11
|
+
puts "Regenerating YUM cache for #{channel_label}"
|
12
|
+
|
13
|
+
begin
|
14
|
+
key = server.call("auth.login", @username, @password)
|
15
|
+
puts "Using session key #{key}"
|
16
|
+
out = server.call("channel.software.regenerateYumCache",
|
17
|
+
key,
|
18
|
+
channel_label
|
19
|
+
)
|
20
|
+
puts out
|
21
|
+
rescue XMLRPC::FaultException => e
|
22
|
+
puts "Error:"
|
23
|
+
puts e.faultCode
|
24
|
+
puts e.faultString
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
8
28
|
option :name, :aliases => ['-n']
|
9
29
|
option :summary, :aliases => ['-s']
|
10
30
|
option :arch, :aliases => ['-a']
|
@@ -12,7 +32,7 @@ class Channel < Sif::Loader
|
|
12
32
|
option :checksum, :default => 'sha256'
|
13
33
|
desc "Create channel", "Creates a new channel"
|
14
34
|
def create(channel_label)
|
15
|
-
server = XMLRPC::Client.new(
|
35
|
+
server = XMLRPC::Client.new(@spacewalk_server, "/rpc/api", 80)
|
16
36
|
puts "Creating #{channel_label}"
|
17
37
|
puts "Name #{options[:name]}"
|
18
38
|
puts "Summary #{options[:summary]}"
|
@@ -26,7 +46,7 @@ class Channel < Sif::Loader
|
|
26
46
|
checksum = options[:checksum]
|
27
47
|
|
28
48
|
begin
|
29
|
-
key = server.call("auth.login",
|
49
|
+
key = server.call("auth.login", @username, @password)
|
30
50
|
puts "Using session key #{key}"
|
31
51
|
out = server.call("channel.software.create",
|
32
52
|
key,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'buzz'
|
3
|
+
|
4
|
+
describe Channel do
|
5
|
+
describe "#create" do
|
6
|
+
context "when channel label is not provided" do
|
7
|
+
let(:create) { Channel.start(['create']) }
|
8
|
+
|
9
|
+
it "asks for a channel label" do
|
10
|
+
$stdin.should_receive(:create).and_return('fucked')
|
11
|
+
results = capture(:stdout) { create }
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buzz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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: 2013-04-
|
12
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: webmock
|
@@ -159,9 +159,15 @@ files:
|
|
159
159
|
- buzz
|
160
160
|
- buzz.gemspec
|
161
161
|
- conf/.buzz
|
162
|
+
- features/exit.feature
|
163
|
+
- features/help.feature
|
164
|
+
- features/step_definitions/terminal_steps.rb
|
165
|
+
- features/support/env.rb
|
162
166
|
- lib/buzz.rb
|
163
167
|
- lib/channel.rb
|
164
168
|
- lib/system.rb
|
169
|
+
- spec/channel_spec.rb
|
170
|
+
- spec/spec_helper.rb
|
165
171
|
- test/helper.rb
|
166
172
|
- test/test_buzz.rb
|
167
173
|
homepage: http://github.com/georgecodes/buzz
|
@@ -179,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
185
|
version: '0'
|
180
186
|
segments:
|
181
187
|
- 0
|
182
|
-
hash:
|
188
|
+
hash: 4403716605840679846
|
183
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
190
|
none: false
|
185
191
|
requirements:
|