fission 0.3.0 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +1 -1
  4. data/lib/fission.rb +5 -6
  5. data/lib/fission/cli.rb +77 -7
  6. data/lib/fission/command.rb +43 -1
  7. data/lib/fission/command/clone.rb +19 -20
  8. data/lib/fission/command/delete.rb +29 -25
  9. data/lib/fission/command/snapshot_create.rb +11 -26
  10. data/lib/fission/command/snapshot_list.rb +13 -19
  11. data/lib/fission/command/snapshot_revert.rb +11 -26
  12. data/lib/fission/command/start.rb +11 -25
  13. data/lib/fission/command/status.rb +26 -10
  14. data/lib/fission/command/stop.rb +10 -21
  15. data/lib/fission/command/suspend.rb +21 -21
  16. data/lib/fission/command_helpers.rb +21 -0
  17. data/lib/fission/config.rb +35 -0
  18. data/lib/fission/fusion.rb +11 -3
  19. data/lib/fission/lease.rb +148 -0
  20. data/lib/fission/metadata.rb +55 -2
  21. data/lib/fission/response.rb +76 -0
  22. data/lib/fission/ui.rb +49 -0
  23. data/lib/fission/version.rb +1 -1
  24. data/lib/fission/vm.rb +653 -75
  25. data/spec/contexts/command.rb +12 -0
  26. data/spec/fission/cli_spec.rb +4 -11
  27. data/spec/fission/command/clone_spec.rb +45 -45
  28. data/spec/fission/command/delete_spec.rb +56 -43
  29. data/spec/fission/command/snapshot_create_spec.rb +29 -51
  30. data/spec/fission/command/snapshot_list_spec.rb +25 -26
  31. data/spec/fission/command/snapshot_revert_spec.rb +27 -53
  32. data/spec/fission/command/start_spec.rb +25 -69
  33. data/spec/fission/command/status_spec.rb +48 -13
  34. data/spec/fission/command/stop_spec.rb +25 -42
  35. data/spec/fission/command/suspend_spec.rb +54 -49
  36. data/spec/fission/command_helpers_spec.rb +30 -0
  37. data/spec/fission/command_spec.rb +19 -0
  38. data/spec/fission/config_spec.rb +24 -0
  39. data/spec/fission/fusion_spec.rb +6 -6
  40. data/spec/fission/lease_spec.rb +176 -0
  41. data/spec/fission/metadata_spec.rb +8 -8
  42. data/spec/fission/response_spec.rb +81 -0
  43. data/spec/fission/vm_spec.rb +869 -193
  44. data/spec/fission_spec.rb +0 -6
  45. data/spec/helpers/command_helpers.rb +12 -0
  46. data/spec/helpers/response_helpers.rb +21 -0
  47. data/spec/matchers/be_a_successful_response.rb +7 -0
  48. data/spec/matchers/be_an_unsuccessful_response.rb +10 -0
  49. data/spec/spec_helper.rb +7 -0
  50. metadata +24 -5
data/spec/fission_spec.rb CHANGED
@@ -6,10 +6,4 @@ describe Fission do
6
6
  Fission.config.should be_a Fission::Config
7
7
  end
8
8
  end
9
-
10
- describe "ui" do
11
- it "should load a ui object" do
12
- Fission.ui.should be_a Fission::UI
13
- end
14
- end
15
9
  end
@@ -0,0 +1,12 @@
1
+ module CommandHelpers
2
+ def it_should_not_accept_arguments_of(args, command_name)
3
+ it "should output an error and the help when #{args.count} arguments are passed in" do
4
+ subject.should_receive(:help)
5
+
6
+ command = subject.new args
7
+ lambda { command.execute }.should raise_error SystemExit
8
+
9
+ @string_io.string.should match /Incorrect arguments for #{command_name} command/
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ module ResponseHelpers
2
+ def stub_response_mock_with(args={})
3
+ args.each_pair do |method, data|
4
+ stub!(method).and_return(data)
5
+ end
6
+ end
7
+
8
+ def stub_as_successful(data=nil)
9
+ stub_response_mock_with :code => 0,
10
+ :message => '',
11
+ :successful? => true,
12
+ :data => data
13
+ end
14
+
15
+ def stub_as_unsuccessful
16
+ stub_response_mock_with :code => 1,
17
+ :message => 'it blew up',
18
+ :successful? => false,
19
+ :data => nil
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ RSpec::Matchers.define :be_a_successful_response do
2
+ match do |actual|
3
+ actual.successful? == true &&
4
+ actual.code == 0 &&
5
+ actual.message == ''
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ RSpec::Matchers.define :be_an_unsuccessful_response do |message|
2
+ message ||= 'it blew up'
3
+
4
+ match do |actual|
5
+ actual.successful? == false &&
6
+ actual.code == 1 &&
7
+ actual.message == message &&
8
+ actual.data == nil
9
+ end
10
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,10 @@
1
1
  require 'rspec'
2
2
  require 'fission'
3
3
  require 'fakefs/safe'
4
+
5
+ ['contexts', 'helpers', 'matchers'].each do |dir|
6
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),dir,'*.rb'))].each {|f| require f}
7
+ end
8
+
9
+ include ResponseHelpers
10
+ include CommandHelpers
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fission
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.3.0
4
+ prerelease: 6
5
+ version: 0.4.0.beta.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tommy Bishop
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-17 00:00:00 Z
13
+ date: 2011-10-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: CFPropertyList
@@ -77,15 +77,19 @@ files:
77
77
  - lib/fission/command/status.rb
78
78
  - lib/fission/command/stop.rb
79
79
  - lib/fission/command/suspend.rb
80
+ - lib/fission/command_helpers.rb
80
81
  - lib/fission/config.rb
81
82
  - lib/fission/core_ext/class.rb
82
83
  - lib/fission/core_ext/file.rb
83
84
  - lib/fission/core_ext/object.rb
84
85
  - lib/fission/fusion.rb
86
+ - lib/fission/lease.rb
85
87
  - lib/fission/metadata.rb
88
+ - lib/fission/response.rb
86
89
  - lib/fission/ui.rb
87
90
  - lib/fission/version.rb
88
91
  - lib/fission/vm.rb
92
+ - spec/contexts/command.rb
89
93
  - spec/fission/cli_spec.rb
90
94
  - spec/fission/command/clone_spec.rb
91
95
  - spec/fission/command/delete_spec.rb
@@ -96,13 +100,20 @@ files:
96
100
  - spec/fission/command/status_spec.rb
97
101
  - spec/fission/command/stop_spec.rb
98
102
  - spec/fission/command/suspend_spec.rb
103
+ - spec/fission/command_helpers_spec.rb
99
104
  - spec/fission/command_spec.rb
100
105
  - spec/fission/config_spec.rb
101
106
  - spec/fission/fusion_spec.rb
107
+ - spec/fission/lease_spec.rb
102
108
  - spec/fission/metadata_spec.rb
109
+ - spec/fission/response_spec.rb
103
110
  - spec/fission/ui_spec.rb
104
111
  - spec/fission/vm_spec.rb
105
112
  - spec/fission_spec.rb
113
+ - spec/helpers/command_helpers.rb
114
+ - spec/helpers/response_helpers.rb
115
+ - spec/matchers/be_a_successful_response.rb
116
+ - spec/matchers/be_an_unsuccessful_response.rb
106
117
  - spec/spec_helper.rb
107
118
  homepage: https://github.com/thbishop/fission
108
119
  licenses: []
@@ -121,9 +132,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
132
  required_rubygems_version: !ruby/object:Gem::Requirement
122
133
  none: false
123
134
  requirements:
124
- - - ">="
135
+ - - ">"
125
136
  - !ruby/object:Gem::Version
126
- version: "0"
137
+ version: 1.3.1
127
138
  requirements: []
128
139
 
129
140
  rubyforge_project: fission
@@ -132,6 +143,7 @@ signing_key:
132
143
  specification_version: 3
133
144
  summary: Command line tool to manage VMware Fusion VMs
134
145
  test_files:
146
+ - spec/contexts/command.rb
135
147
  - spec/fission/cli_spec.rb
136
148
  - spec/fission/command/clone_spec.rb
137
149
  - spec/fission/command/delete_spec.rb
@@ -142,11 +154,18 @@ test_files:
142
154
  - spec/fission/command/status_spec.rb
143
155
  - spec/fission/command/stop_spec.rb
144
156
  - spec/fission/command/suspend_spec.rb
157
+ - spec/fission/command_helpers_spec.rb
145
158
  - spec/fission/command_spec.rb
146
159
  - spec/fission/config_spec.rb
147
160
  - spec/fission/fusion_spec.rb
161
+ - spec/fission/lease_spec.rb
148
162
  - spec/fission/metadata_spec.rb
163
+ - spec/fission/response_spec.rb
149
164
  - spec/fission/ui_spec.rb
150
165
  - spec/fission/vm_spec.rb
151
166
  - spec/fission_spec.rb
167
+ - spec/helpers/command_helpers.rb
168
+ - spec/helpers/response_helpers.rb
169
+ - spec/matchers/be_a_successful_response.rb
170
+ - spec/matchers/be_an_unsuccessful_response.rb
152
171
  - spec/spec_helper.rb