cloudfactory 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/lib/cf/cli/line.rb CHANGED
@@ -81,7 +81,8 @@ module Cf # :nodoc: all
81
81
  end
82
82
  }
83
83
 
84
- desc "line create", "takes the yaml file at line.yml and creates a new line at http://cloudfactory.com"
84
+ method_option :force, :type => :boolean, :default => false, :aliases => "-f", :desc => "force to overwrite the line if the line already exists, default is false"
85
+ desc "line create", "takes the line.yml and creates a new line at http://cloudfactory.com"
85
86
  def create
86
87
  line_source = Dir.pwd
87
88
  yaml_source = "#{line_source}/line.yml"
@@ -100,10 +101,23 @@ module Cf # :nodoc: all
100
101
  line_title = line_dump['title'].parameterize
101
102
  line_description = line_dump['description']
102
103
  line_department = line_dump['department']
104
+
105
+ line = CF::Line.info(line_title)
106
+ if line.error.blank? && options.force?
107
+ rollback(line.title)
108
+ elsif line.error.blank?
109
+ say("This line already exist.", :yellow)
110
+ override = agree("Do you want to override? [y/n] ")
111
+ if override
112
+ say("Deleting the line forcefuly..", :yellow)
113
+ rollback(line.title)
114
+ else
115
+ say("Line creation aborted!!", :yellow) and exit(1)
116
+ end
117
+ end
103
118
  line = CF::Line.new(line_title, line_department, :description => line_description)
104
-
105
119
  say "Creating new assembly line: #{line.title}", :green
106
- display_error(line_title, "#{line.errors}") if line.errors.present?
120
+ say("Error: #{line.errors}", :red) and exit(1) if line.errors.present?
107
121
 
108
122
  say "Adding InputFormats", :green
109
123
 
@@ -212,8 +226,7 @@ module Cf # :nodoc: all
212
226
  say " ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁", :white
213
227
  say "Line was successfully created.", :green
214
228
  say "View your line at http://#{CF.account_name}.#{CF.api_url.split("/")[-2]}/lines/#{CF.account_name}/#{line.title}", :yellow
215
- say "\nNow you can do production runs with: cf production start <your_run_title>", :green
216
- say "Note: Make sure your-run-title.csv file is in the input directory.", :green
229
+ say "\nNow you can do production runs with: cf production start <your-run-title>", :green
217
230
  end
218
231
 
219
232
  desc "line list", "List your lines"
data/lib/cf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CF # :nodoc: all
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
@@ -2,15 +2,11 @@ module Cf # :nodoc: all
2
2
  module Generators # :nodoc: all
3
3
  class InstallGenerator < Rails::Generators::Base # :nodoc: all
4
4
  source_root File.expand_path("../templates", __FILE__)
5
- # argument :account_name, :required => true,
6
- # :desc => "The account name that you used to signup at http://cloudfactory.com"
7
- argument :api_key, :required => true,
8
- :desc => "Your API key(s) can be found at http://cloudfactory.com/account#settings"
9
5
 
10
6
  desc "Creates a CF initializer"
11
7
  def generate_initializer
12
8
  say_status("Generating", "CloudFactory initializer", :green)
13
- template "cloud_factory.rb", "config/initializers/cloud_factory.rb"
9
+ template "cloudfactory.rb", "config/initializers/cloudfactory.rb"
14
10
  end
15
11
 
16
12
  def show_readme
@@ -1,8 +1,8 @@
1
1
  # CloudFactory Initializer
2
2
  require 'cf'
3
3
  CF.configure do |config|
4
+ config.api_key = "your-api-key"
5
+ config.account_name = "your-account-name"
4
6
  config.api_version = "v1"
5
- config.api_key = "<%= api_key %>"
6
7
  config.api_url = "http://cloudfactory.com/api/"
7
- config.api_url = "your-account-name"
8
8
  end
@@ -10,7 +10,6 @@ module Cf # :nodoc: all
10
10
  describe InstallGenerator, "using custom matcher" do
11
11
  include GeneratorSpec::TestCase
12
12
  destination File.expand_path("../tmp", __FILE__)
13
- arguments %w(valid_api_key)
14
13
 
15
14
  before do
16
15
  prepare_destination
@@ -22,9 +21,9 @@ module Cf # :nodoc: all
22
21
  destination_root.should have_structure {
23
22
  directory "config" do
24
23
  directory "initializers" do
25
- file "cloud_factory.rb" do
24
+ file "cloudfactory.rb" do
26
25
  contains "# CloudFactory Initializer"
27
- contains "valid_api_key"
26
+ contains "your-api-key"
28
27
  end
29
28
  end
30
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &2156538240 !ruby/object:Gem::Requirement
16
+ requirement: &2154512680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156538240
24
+ version_requirements: *2154512680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2156537740 !ruby/object:Gem::Requirement
27
+ requirement: &2154540320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2156537740
35
+ version_requirements: *2154540320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hashie
38
- requirement: &2156537240 !ruby/object:Gem::Requirement
38
+ requirement: &2154539820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2156537240
46
+ version_requirements: *2154539820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &2156536860 !ruby/object:Gem::Requirement
49
+ requirement: &2154539440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2156536860
57
+ version_requirements: *2154539440
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: json
60
- requirement: &2156684620 !ruby/object:Gem::Requirement
60
+ requirement: &2154538980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2156684620
68
+ version_requirements: *2154538980
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &2156684120 !ruby/object:Gem::Requirement
71
+ requirement: &2154538480 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.14.6
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2156684120
79
+ version_requirements: *2154538480
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: highline
82
- requirement: &2156683700 !ruby/object:Gem::Requirement
82
+ requirement: &2154538060 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2156683700
90
+ version_requirements: *2154538060
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: httparty
93
- requirement: &2156683160 !ruby/object:Gem::Requirement
93
+ requirement: &2154537520 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.7.8
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2156683160
101
+ version_requirements: *2154537520
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: terminal-table
104
- requirement: &2156682660 !ruby/object:Gem::Requirement
104
+ requirement: &2154537020 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 1.4.2
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2156682660
112
+ version_requirements: *2154537020
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: millisami-csv-hash
115
- requirement: &2156682280 !ruby/object:Gem::Requirement
115
+ requirement: &2154536640 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2156682280
123
+ version_requirements: *2154536640
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: ruby-debug19
126
- requirement: &2156681820 !ruby/object:Gem::Requirement
126
+ requirement: &2154536180 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *2156681820
134
+ version_requirements: *2154536180
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: aruba
137
- requirement: &2156681400 !ruby/object:Gem::Requirement
137
+ requirement: &2154535760 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2156681400
145
+ version_requirements: *2154535760
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: rails
148
- requirement: &2156680900 !ruby/object:Gem::Requirement
148
+ requirement: &2154535260 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ~>
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: 3.0.3
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *2156680900
156
+ version_requirements: *2154535260
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: bundler
159
- requirement: &2156680400 !ruby/object:Gem::Requirement
159
+ requirement: &2154534760 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ~>
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: 1.0.0
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *2156680400
167
+ version_requirements: *2154534760
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: generator_spec
170
- requirement: &2156679940 !ruby/object:Gem::Requirement
170
+ requirement: &2154534300 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ~>
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: 0.8.3
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2156679940
178
+ version_requirements: *2154534300
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: rspec-rails
181
- requirement: &2156679560 !ruby/object:Gem::Requirement
181
+ requirement: &2154533920 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2156679560
189
+ version_requirements: *2154533920
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: cucumber
192
- requirement: &2156679100 !ruby/object:Gem::Requirement
192
+ requirement: &2154533460 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: '0'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2156679100
200
+ version_requirements: *2154533460
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rdoc
203
- requirement: &2156678600 !ruby/object:Gem::Requirement
203
+ requirement: &2154532960 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ~>
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: 3.5.3
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *2156678600
211
+ version_requirements: *2154532960
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: vcr
214
- requirement: &2156678180 !ruby/object:Gem::Requirement
214
+ requirement: &2154532540 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ! '>='
@@ -219,10 +219,10 @@ dependencies:
219
219
  version: '0'
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *2156678180
222
+ version_requirements: *2154532540
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rake
225
- requirement: &2156677720 !ruby/object:Gem::Requirement
225
+ requirement: &2154548440 !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
228
  - - ! '>='
@@ -230,10 +230,10 @@ dependencies:
230
230
  version: '0'
231
231
  type: :development
232
232
  prerelease: false
233
- version_requirements: *2156677720
233
+ version_requirements: *2154548440
234
234
  - !ruby/object:Gem::Dependency
235
235
  name: webmock
236
- requirement: &2156677300 !ruby/object:Gem::Requirement
236
+ requirement: &2154548020 !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements:
239
239
  - - ! '>='
@@ -241,10 +241,10 @@ dependencies:
241
241
  version: '0'
242
242
  type: :development
243
243
  prerelease: false
244
- version_requirements: *2156677300
244
+ version_requirements: *2154548020
245
245
  - !ruby/object:Gem::Dependency
246
246
  name: timecop
247
- requirement: &2156676880 !ruby/object:Gem::Requirement
247
+ requirement: &2154547600 !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements:
250
250
  - - ! '>='
@@ -252,7 +252,7 @@ dependencies:
252
252
  version: '0'
253
253
  type: :development
254
254
  prerelease: false
255
- version_requirements: *2156676880
255
+ version_requirements: *2154547600
256
256
  description: A Ruby wrapper and CLI for to interact with Cloudfactory.com REST API
257
257
  email:
258
258
  - info@cloudfactory.com
@@ -319,7 +319,7 @@ files:
319
319
  - lib/generators/cf/form/templates/cf_form.html.erb
320
320
  - lib/generators/cf/install/install_generator.rb
321
321
  - lib/generators/cf/install/templates/README
322
- - lib/generators/cf/install/templates/cloud_factory.rb
322
+ - lib/generators/cf/install/templates/cloudfactory.rb
323
323
  - spec/account_spec.rb
324
324
  - spec/badge_spec.rb
325
325
  - spec/concept_tagging_robot_spec.rb