ssc 0.2.0 → 0.3.0

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.
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 2
7
+ - 3
9
8
  - 0
10
- version: 0.2.0
9
+ version: 0.3.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ratan Sebastian
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-07-20 00:00:00 +02:00
17
+ date: 2011-08-15 00:00:00 +02:00
19
18
  default_executable: ssc
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 7
30
28
  segments:
31
29
  - 3
32
30
  - 1
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 43
46
43
  segments:
47
44
  - 0
48
45
  - 14
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 3
62
58
  segments:
63
59
  - 0
64
60
  version: "0"
@@ -72,7 +68,6 @@ dependencies:
72
68
  requirements:
73
69
  - - ">="
74
70
  - !ruby/object:Gem::Version
75
- hash: 3
76
71
  segments:
77
72
  - 0
78
73
  version: "0"
@@ -86,7 +81,6 @@ dependencies:
86
81
  requirements:
87
82
  - - ~>
88
83
  - !ruby/object:Gem::Version
89
- hash: 23
90
84
  segments:
91
85
  - 1
92
86
  - 0
@@ -102,7 +96,6 @@ dependencies:
102
96
  requirements:
103
97
  - - ~>
104
98
  - !ruby/object:Gem::Version
105
- hash: 15
106
99
  segments:
107
100
  - 1
108
101
  - 6
@@ -118,7 +111,6 @@ dependencies:
118
111
  requirements:
119
112
  - - ">="
120
113
  - !ruby/object:Gem::Version
121
- hash: 3
122
114
  segments:
123
115
  - 0
124
116
  version: "0"
@@ -142,20 +134,20 @@ files:
142
134
  - lib/directory_manager.rb
143
135
  - lib/handlers/all.rb
144
136
  - lib/handlers/appliance.rb
137
+ - lib/handlers/build.rb
145
138
  - lib/handlers/file.rb
146
139
  - lib/handlers/helper.rb
147
140
  - lib/handlers/package.rb
148
141
  - lib/handlers/repository.rb
149
142
  - lib/handlers/template.rb
150
143
  - lib/ssc.rb
151
- - test/handlers/test_appliance.rb
152
- - test/handlers/test_helper.rb
153
- - test/handlers/test_repository.rb
154
- - test/handlers/test_template.rb
144
+ - ssc.gemspec
155
145
  - test/helper.rb
156
- - test/test_argument_parser.rb
157
- - test/test_directory_manager.rb
158
- - test/test_ssc.rb
146
+ - test/integration/test_appliance.rb
147
+ - test/integration/test_file.rb
148
+ - test/integration/test_package.rb
149
+ - test/integration/test_repository.rb
150
+ - test/unit/test_directory_manager.rb
159
151
  has_rdoc: true
160
152
  homepage: http://github.com/rjsvaljean/ssc
161
153
  licenses:
@@ -170,7 +162,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
162
  requirements:
171
163
  - - ">="
172
164
  - !ruby/object:Gem::Version
173
- hash: 3
174
165
  segments:
175
166
  - 0
176
167
  version: "0"
@@ -179,14 +170,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
170
  requirements:
180
171
  - - ">="
181
172
  - !ruby/object:Gem::Version
182
- hash: 3
183
173
  segments:
184
174
  - 0
185
175
  version: "0"
186
176
  requirements: []
187
177
 
188
178
  rubyforge_project:
189
- rubygems_version: 1.5.2
179
+ rubygems_version: 1.3.7
190
180
  signing_key:
191
181
  specification_version: 3
192
182
  summary: Command-line client for Suse Studio
@@ -1,20 +0,0 @@
1
- require 'helper'
2
-
3
- class TestHandlerAppliance < Test::Unit::TestCase
4
- context "SSC::Handler::Template" do
5
- context "#list" do
6
- setup do
7
- @handler= SSC::Handler::Appliance.new()
8
- @handler.stubs(:connect)
9
- end
10
-
11
- should "call find(:all) on StudioApi::Appliance" do
12
- mock_app_list= mock('appliance list')
13
- mock_app_list.stubs(:collect)
14
- mock_app_list.stubs(:empty?)
15
- StudioApi::Appliance.expects(:find).with(:all).returns(mock_app_list)
16
- @handler.list
17
- end
18
- end
19
- end
20
- end
@@ -1,45 +0,0 @@
1
- require 'helper'
2
-
3
- class TestHandlerHelper < Test::Unit::TestCase
4
- context "SSC::Handler::Helper" do
5
- setup do
6
- class TestObject
7
- include SSC::Handler::Helper
8
- end
9
-
10
- @objekt= TestObject.new
11
- end
12
-
13
- context "#connect" do
14
- should "create connection and configure StudioApi to use it" do
15
- mock_connection= mock('connection')
16
- StudioApi::Connection.expects(:new)
17
- .with('user', 'pass', 'https://susestudio.com/api/v1/user',
18
- {:proxy => 'proxy'})
19
- .returns(mock_connection)
20
- StudioApi::Util.expects(:configure_studio_connection).with(mock_connection)
21
- @objekt.connect('user', 'pass', {:proxy => 'proxy', :another_option => 'value'})
22
- end
23
- end
24
-
25
- context "#filter_options" do
26
- should "return a hash of only the specified keys" do
27
- out= @objekt.filter_options({:a => 'a', :b => 'b'}, [:a])
28
- assert_equal({:a => 'a'}, out)
29
- end
30
- end
31
-
32
- context "#require_appliance_id" do
33
- should "raise and error if the appliance id option is not passed" do
34
- assert_raise(RuntimeError) { @objekt.require_appliance_id({}) }
35
- end
36
-
37
- should "not raise error if appliance id is provided" do
38
- StudioApi::Appliance.expects(:find).with(1).returns(nil)
39
- assert_nothing_raised do
40
- @objekt.require_appliance_id(:appliance_id=>1) {|i| i}
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,20 +0,0 @@
1
- require 'helper'
2
-
3
- class TestHandlerRepository < Test::Unit::TestCase
4
- context "SSC::Handler::Repository" do
5
- setup do
6
- @handler= SSC::Handler::Repository.new()
7
- @handler.stubs(:connect)
8
- end
9
- context "#search" do
10
-
11
- should "call .find(:all, params_hash) on StudioApi::Repository" do
12
- mock_collection= mock('collection')
13
- mock_collection.stubs(:collect)
14
- StudioApi::Repository.expects(:find).with(:all, :params => {:filter => 'chess', :base_system => '11.1'}).returns(mock_collection)
15
- @handler.instance_variable_set('@options', {:base_system => '11.1'})
16
- @handler.search('chess')
17
- end
18
- end
19
- end
20
- end
@@ -1,27 +0,0 @@
1
- require 'helper'
2
-
3
- class TestTemplateHandler < Test::Unit::TestCase
4
- context "SSC::Handler::Template" do
5
- context "#list" do
6
- setup do
7
- @handler= SSC::Handler::Template.new()
8
- @handler.stubs(:connect)
9
- end
10
-
11
- should "call .find(:all) on StudioApi::TemplateSet" do
12
- mock_template= mock('template_list')
13
- mock_template.stubs(:collect)
14
- StudioApi::TemplateSet.expects(:find).with(:all).returns(mock_template)
15
- @handler.list
16
- end
17
-
18
- should "return a list of strings of type 'template.id: template.name'" do
19
- mock_template= StudioApi::TemplateSet.new(:name => 'Template Name')
20
- StudioApi::TemplateSet.stubs(:find).with(:all).returns([mock_template])
21
- assert_equal ["Template Name"],
22
- @handler.list
23
- end
24
-
25
- end
26
- end
27
- end
@@ -1,55 +0,0 @@
1
- require 'helper'
2
-
3
- class TestArgumentParser < Test::Unit::TestCase
4
- context "SSC::ArgumentParser" do
5
-
6
- context "when arguments are good" do
7
- setup do
8
- @parser= SSC::ArgumentParser.new(['appliance', 'create', 'act_arg1', 'act_arg2', '--option', 'value', '-o', 'v', '--flag', '-f'])
9
- end
10
-
11
- should "set @klass to Appliance" do
12
- assert_equal SSC::Handler::Appliance, @parser.klass
13
- end
14
-
15
- should "set @action to create" do
16
- assert_equal 'create', @parser.action
17
- end
18
-
19
- should "set @options to option hash" do
20
- assert_equal({:option => 'value',
21
- :o => 'v',
22
- :flag => true,
23
- :f => true }, @parser.options)
24
- end
25
-
26
- should "set @action_arguments to argument array" do
27
- #only one of the arguments must be taken since create take only one argument
28
- assert_equal(['act_arg1'], @parser.action_arguments)
29
- end
30
-
31
- should "have the entire list if arity of the method is -1(splat)" do
32
- parser= SSC::ArgumentParser.new(['repository', 'add', 'act_arg1', 'act_arg2'])
33
- assert_equal(['act_arg1', 'act_arg2'], parser.action_arguments )
34
- end
35
-
36
- end
37
- end
38
-
39
- context "when handler is unknown" do
40
- should "raise UnkownOptionError" do
41
- assert_raise(SSC::UnkownOptionError) do
42
- SSC::ArgumentParser.new(['apliance', 'create'])
43
- end
44
- end
45
- end
46
-
47
- context "when handler method is unknown" do
48
- should "raise UnkownOptionError" do
49
- assert_raise(SSC::UnkownOptionError) do
50
- SSC::ArgumentParser.new(['appliance', 'unkown_method'])
51
- end
52
- end
53
- end
54
-
55
- end
@@ -1,40 +0,0 @@
1
- require 'helper'
2
- require 'fileutils'
3
-
4
- class TestDirectoryManager < Test::Unit::TestCase
5
- context "SSC::DirectoryManager" do
6
- setup do
7
- class B; include SSC::DirectoryManager; end
8
- @app_dir= B.create_appliance_directory('test_dir','user','pass',1)
9
- Dir.chdir('test_dir')
10
- class A
11
- include SSC::DirectoryManager
12
- manage 'software'
13
- end
14
- end
15
-
16
- should "set the @@local_source variable correctly" do
17
- assert_equal File.join(@app_dir, 'software'), A.class_variable_get('@@local_source')
18
- end
19
-
20
- context "#save" do
21
- should "save data to the local cache file" do
22
- A.new.save(['some', 'data'])
23
- assert_equal "some\ndata\n", File.read('software')
24
- end
25
- end
26
-
27
- context "#read" do
28
- should "fetch data from local_source" do
29
- A.new.save(['some', 'data'])
30
- assert_equal ['some', 'data'], A.new.read
31
- end
32
- end
33
-
34
- end
35
-
36
- def teardown
37
- Dir.chdir('..')
38
- FileUtils.rm_r('test_dir')
39
- end
40
- end
data/test/test_ssc.rb DELETED
@@ -1,39 +0,0 @@
1
- require 'helper'
2
-
3
- class TestSsc < Test::Unit::TestCase
4
- context "SSC::Base" do
5
- setup do
6
- File.open('.sscrc', 'w') {|f| f.write("username: user\npassword: pass")}
7
- @client= SSC::Base.new(['appliance', 'create', '--option', 'value',
8
- '-o', 'v', '--flag', '-f'])
9
- @specific_client= SSC::Base.new(['appliance', 'create',
10
- '--username', 'user1',
11
- '--password', 'pass1'])
12
- FileUtils.rm('.sscrc')
13
- end
14
-
15
- context "when username and password are passed in the command line" do
16
- should "override username and password in ./.sscrc" do
17
- assert_equal({:username => 'user1', :password => 'pass1'},
18
- @specific_client.instance_variable_get('@options'))
19
- end
20
- end
21
-
22
- should "initialize handler class correctly" do
23
- assert_equal SSC::Handler::Appliance,
24
- @client.instance_variable_get('@klass')
25
- end
26
-
27
- should "initialize @args with an ArgumentParser object" do
28
- args= @client.instance_variable_get('@args')
29
- assert_equal SSC::ArgumentParser, args.class
30
- end
31
-
32
- should "initialize @config with the config from .sscrc" do
33
- options= @client.instance_variable_get('@options')
34
- assert_equal('user', options[:username])
35
- assert_equal('pass', options[:password])
36
- end
37
-
38
- end
39
- end