shelly 0.2.22 → 0.2.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWJjMDExOTYxYWQyZmIyODI5NDg0ZTZmZTBkZTFjMzc0NzdjMGU3ZQ==
5
+ data.tar.gz: !binary |-
6
+ ODAxNzQ5ZTAzMTRlMDk2OTZmYzMwZDgxN2Y3MGVhZThhMDIzN2I3Yw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZTJkOGFmYTNmNGIwODljZGY4NTdiNzg4NWUxZDg0Y2YxYjc3YWRlYWQ4YTk3
10
+ M2EyYWM1MmQwOGVmNmIzODM1MTRlNDc1ZWUzNDQyODYyMWI4ZTdlN2ZiNjdm
11
+ MzZiMWQyOTJlYjQxYjZlMWI4YzQxZjJiMmRmODQ5OTljMjZiYjY=
12
+ data.tar.gz: !binary |-
13
+ YmVlMmYwZDBjZmM2YTQzMWQ2NDllMDdjM2ViMzUyZmJjMjdkNDA5ODUzNDdm
14
+ ZjY4YjhmZDlkNTE4NDU5ZDM4MjUwMzBhZDIxOWUzNTFiZjhmYTg0NjhhMjA2
15
+ M2UxNThiMTRjN2Y3MWE1NGE5MTU4YjEyZDBiN2RkNzViNTM2ZWU=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.23 / 2013-05-25
2
+
3
+ * [bug] `shelly add` ask for existing organization if user owns at least one
4
+ * [improvement] Ask for git remote name if default is already taken when adding or setting up cloud
5
+
1
6
  ## 0.2.22 / 2013-05-20
2
7
 
3
8
  * [improvement] default application name is created without -staging/-production suffix
data/lib/shelly/app.rb CHANGED
@@ -39,21 +39,21 @@ module Shelly
39
39
  @databases = dbs - ['none']
40
40
  end
41
41
 
42
- def add_git_remote
43
- system("git remote rm shelly > /dev/null 2>&1")
44
- system("git remote add shelly #{git_url}")
42
+ def add_git_remote(remote_name = 'shelly')
43
+ system("git remote rm #{remote_name} > /dev/null 2>&1")
44
+ system("git remote add #{remote_name} #{git_url}")
45
45
  end
46
46
 
47
- def git_remote_exist?
48
- IO.popen("git remote").read.include?('shelly')
47
+ def git_remote_exist?(remote_name = 'shelly')
48
+ IO.popen("git remote").read.include?(remote_name)
49
49
  end
50
50
 
51
- def git_fetch_remote
52
- system("git fetch shelly > /dev/null 2>&1")
51
+ def git_fetch_remote(remote = 'shelly')
52
+ system("git fetch #{remote} > /dev/null 2>&1")
53
53
  end
54
54
 
55
- def git_add_tracking_branch
56
- system("git checkout -b shelly --track shelly/master > /dev/null 2>&1")
55
+ def git_add_tracking_branch(remote = 'shelly')
56
+ system("git checkout -b #{remote} --track #{remote}/master > /dev/null 2>&1")
57
57
  end
58
58
 
59
59
  def remove_git_remote
@@ -236,7 +236,7 @@ Wait until cloud is in 'turned off' state and try again.}
236
236
  app = multiple_clouds(options[:cloud], "setup")
237
237
  say "Setting up #{app} cloud", :green
238
238
  app.git_url = app.attributes["git_info"]["repository_url"]
239
- if overwrite_remote?(app)
239
+ if overwrite_default_remote?(app)
240
240
  say "git remote add shelly #{app.git_url}"
241
241
  app.add_git_remote
242
242
  say "git fetch shelly"
@@ -244,10 +244,20 @@ Wait until cloud is in 'turned off' state and try again.}
244
244
  say "git checkout -b shelly --track shelly/master"
245
245
  app.git_add_tracking_branch
246
246
  else
247
- say "You have to manually add remote:"
248
- say "`git remote add shelly #{app.git_url}`"
249
- say "`git fetch shelly`"
250
- say "`git checkout -b shelly --track shelly/master`"
247
+ loop do
248
+ remote = ask('Specify remote name:')
249
+ if app.git_remote_exist?(remote)
250
+ say("Remote '#{remote}' already exists")
251
+ else
252
+ say "git remote add #{remote} #{app.git_url}"
253
+ app.add_git_remote(remote)
254
+ say "git fetch shelly"
255
+ app.git_fetch_remote(remote)
256
+ say "git checkout -b shelly --track shelly/master"
257
+ app.git_add_tracking_branch(remote)
258
+ return
259
+ end
260
+ end
251
261
  end
252
262
 
253
263
  say_new_line
@@ -554,21 +564,29 @@ Wait until cloud is in 'turned off' state and try again.}
554
564
  databases.all? { |kind| kinds.include?(kind) }
555
565
  end
556
566
 
557
- def overwrite_remote?(app)
567
+ def overwrite_default_remote?(app)
558
568
  git_remote = app.git_remote_exist?
559
569
  !git_remote or (git_remote and yes?("Git remote shelly exists, overwrite (yes/no): "))
560
570
  end
561
571
 
562
572
  def add_remote(app)
563
- if overwrite_remote?(app)
573
+ remote = if overwrite_default_remote?(app)
564
574
  say "Adding remote shelly #{app.git_url}", :green
565
- app.add_git_remote
566
575
  "shelly"
567
576
  else
568
- say "You have to manually add git remote:"
569
- say "`git remote add NAME #{app.git_url}`"
570
- "NAME"
577
+ loop do
578
+ remote = ask('Specify remote name:')
579
+ if app.git_remote_exist?(remote)
580
+ say("Remote '#{remote}' already exists")
581
+ else
582
+ say "Adding remote #{remote} #{app.git_url}", :green
583
+ return remote
584
+ end
585
+ end
571
586
  end
587
+
588
+ app.add_git_remote(remote)
589
+ remote
572
590
  end
573
591
 
574
592
  def ask_for_password(options = {})
@@ -611,7 +629,7 @@ Wait until cloud is in 'turned off' state and try again.}
611
629
 
612
630
  def ask_for_organization(default_name)
613
631
  organizations = Shelly::User.new.organizations
614
- if organizations.count > 1
632
+ unless organizations.blank?
615
633
  count = organizations.count
616
634
  option_selected = 0
617
635
  loop do
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.2.22"
2
+ VERSION = "0.2.23"
3
3
  end
@@ -484,17 +484,14 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
484
484
  end
485
485
 
486
486
  it "should ask if one exist and not overwrite" do
487
+ @app.stub(:git_remote_exist?).with('test').and_return(false)
487
488
  $stdout.should_receive(:print).with("Git remote shelly exists, overwrite (yes/no): ")
488
- $stdout.should_receive(:puts).with("You have to manually add git remote:")
489
- $stdout.should_receive(:puts).with("`git remote add NAME git@git.shellycloud.com:foooo.git`")
490
- $stdout.should_receive(:puts).with("\e[32mWhen you make sure all settings are correct please issue following commands:\e[0m")
491
- $stdout.should_receive(:puts).with(" git add .")
492
- $stdout.should_receive(:puts).with(' git commit -m "Application added to Shelly Cloud"')
493
- $stdout.should_receive(:puts).with(" git push")
494
- $stdout.should_receive(:puts).with("\e[32mDeploy to your cloud using:\e[0m")
495
- $stdout.should_receive(:puts).with(" git push NAME master")
489
+ $stdout.should_receive(:print).with("Specify remote name: ")
490
+ $stdout.should_receive(:puts).with(green "Adding remote test git@git.shellycloud.com:foooo.git")
491
+ $stdout.should_receive(:puts).with(" git push test master")
492
+
496
493
  @app.should_not_receive(:add_git_remote)
497
- fake_stdin(["foooo", "", "no"]) do
494
+ fake_stdin(["foooo", "", "no", "test"]) do
498
495
  invoke(@main, :add)
499
496
  end
500
497
  end
@@ -581,10 +578,7 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
581
578
 
582
579
  context "ask user for organization" do
583
580
  before do
584
- @client.stub(:organizations).and_return([
585
- {"name" => "aaa"},
586
- {"name" => "ccc"}
587
- ])
581
+ @client.stub(:organizations).and_return([{"name" => "aaa"}])
588
582
  end
589
583
 
590
584
  it "should ask user to choose organization if present and use chosen organization" do
@@ -592,9 +586,8 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
592
586
  $stdout.should_receive(:puts).with("Select organization for this cloud:")
593
587
  $stdout.should_receive(:puts).with("existing organizations:")
594
588
  $stdout.should_receive(:puts).with(" 1) aaa")
595
- $stdout.should_receive(:puts).with(" 2) ccc")
596
589
  $stdout.should_receive(:puts).with("new organization (default as code name):")
597
- $stdout.should_receive(:puts).with(" 3) foooo")
590
+ $stdout.should_receive(:puts).with(" 2) foooo")
598
591
  $stdout.should_receive(:print).with("Option: ")
599
592
  fake_stdin(["foooo", "none", "1"]) do
600
593
  invoke(@main, :add)
@@ -606,11 +599,10 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
606
599
  $stdout.should_receive(:puts).with("Select organization for this cloud:")
607
600
  $stdout.should_receive(:puts).with("existing organizations:")
608
601
  $stdout.should_receive(:puts).with(" 1) aaa")
609
- $stdout.should_receive(:puts).with(" 2) ccc")
610
602
  $stdout.should_receive(:puts).with("new organization (default as code name):")
611
- $stdout.should_receive(:puts).with(" 3) foooo")
603
+ $stdout.should_receive(:puts).with(" 2) foooo")
612
604
  $stdout.should_receive(:print).with("Option: ")
613
- fake_stdin(["foooo", "none", "3"]) do
605
+ fake_stdin(["foooo", "none", "2"]) do
614
606
  invoke(@main, :add)
615
607
  end
616
608
  end
@@ -1113,10 +1105,12 @@ Wait until cloud is in 'turned off' state and try again.")
1113
1105
 
1114
1106
  context "and user answers no" do
1115
1107
  it "should display commands to perform manually" do
1116
- @app.should_not_receive(:add_git_remote)
1117
- @app.should_not_receive(:git_fetch_remote)
1118
- @app.should_not_receive(:git_add_tracking_branch)
1119
- fake_stdin(["no"]) do
1108
+ @app.stub(:git_remote_exist?).with('remote').and_return(false)
1109
+ $stdout.should_receive(:print).with("Specify remote name: ")
1110
+ @app.should_receive(:add_git_remote).with('remote')
1111
+ @app.should_receive(:git_fetch_remote).with('remote')
1112
+ @app.should_receive(:git_add_tracking_branch).with('remote')
1113
+ fake_stdin(["no", "remote"]) do
1120
1114
  invoke(@main, :setup)
1121
1115
  end
1122
1116
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.22
5
- prerelease:
4
+ version: 0.2.23
6
5
  platform: ruby
7
6
  authors:
8
7
  - Shelly Cloud team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-20 00:00:00.000000000 Z
11
+ date: 2013-05-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: guard
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: guard-rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: simplecov
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,34 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ruby_gntp
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rb-fsevent
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
90
107
  requirements:
91
108
  - - ! '>='
92
109
  - !ruby/object:Gem::Version
@@ -94,7 +111,6 @@ dependencies:
94
111
  - !ruby/object:Gem::Dependency
95
112
  name: fakefs
96
113
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
114
  requirements:
99
115
  - - ! '>='
100
116
  - !ruby/object:Gem::Version
@@ -102,7 +118,6 @@ dependencies:
102
118
  type: :development
103
119
  prerelease: false
104
120
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
121
  requirements:
107
122
  - - ! '>='
108
123
  - !ruby/object:Gem::Version
@@ -110,7 +125,6 @@ dependencies:
110
125
  - !ruby/object:Gem::Dependency
111
126
  name: fakeweb
112
127
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
128
  requirements:
115
129
  - - ! '>='
116
130
  - !ruby/object:Gem::Version
@@ -118,7 +132,6 @@ dependencies:
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
135
  requirements:
123
136
  - - ! '>='
124
137
  - !ruby/object:Gem::Version
@@ -126,7 +139,6 @@ dependencies:
126
139
  - !ruby/object:Gem::Dependency
127
140
  name: wijet-thor
128
141
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
142
  requirements:
131
143
  - - ~>
132
144
  - !ruby/object:Gem::Version
@@ -134,7 +146,6 @@ dependencies:
134
146
  type: :runtime
135
147
  prerelease: false
136
148
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
149
  requirements:
139
150
  - - ~>
140
151
  - !ruby/object:Gem::Version
@@ -142,7 +153,6 @@ dependencies:
142
153
  - !ruby/object:Gem::Dependency
143
154
  name: rest-client
144
155
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
156
  requirements:
147
157
  - - ! '>='
148
158
  - !ruby/object:Gem::Version
@@ -150,7 +160,6 @@ dependencies:
150
160
  type: :runtime
151
161
  prerelease: false
152
162
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
163
  requirements:
155
164
  - - ! '>='
156
165
  - !ruby/object:Gem::Version
@@ -158,7 +167,6 @@ dependencies:
158
167
  - !ruby/object:Gem::Dependency
159
168
  name: json
160
169
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
170
  requirements:
163
171
  - - ! '>='
164
172
  - !ruby/object:Gem::Version
@@ -166,7 +174,6 @@ dependencies:
166
174
  type: :runtime
167
175
  prerelease: false
168
176
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
177
  requirements:
171
178
  - - ! '>='
172
179
  - !ruby/object:Gem::Version
@@ -174,7 +181,6 @@ dependencies:
174
181
  - !ruby/object:Gem::Dependency
175
182
  name: progressbar
176
183
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
184
  requirements:
179
185
  - - ! '>='
180
186
  - !ruby/object:Gem::Version
@@ -182,7 +188,6 @@ dependencies:
182
188
  type: :runtime
183
189
  prerelease: false
184
190
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
191
  requirements:
187
192
  - - ! '>='
188
193
  - !ruby/object:Gem::Version
@@ -190,7 +195,6 @@ dependencies:
190
195
  - !ruby/object:Gem::Dependency
191
196
  name: launchy
192
197
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
198
  requirements:
195
199
  - - ! '>='
196
200
  - !ruby/object:Gem::Version
@@ -198,7 +202,6 @@ dependencies:
198
202
  type: :runtime
199
203
  prerelease: false
200
204
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
205
  requirements:
203
206
  - - ! '>='
204
207
  - !ruby/object:Gem::Version
@@ -273,32 +276,46 @@ files:
273
276
  - spec/thor/options_spec.rb
274
277
  homepage: http://shellycloud.com
275
278
  licenses: []
279
+ metadata: {}
276
280
  post_install_message:
277
281
  rdoc_options: []
278
282
  require_paths:
279
283
  - lib
280
284
  required_ruby_version: !ruby/object:Gem::Requirement
281
- none: false
282
285
  requirements:
283
286
  - - ! '>='
284
287
  - !ruby/object:Gem::Version
285
288
  version: '0'
286
- segments:
287
- - 0
288
- hash: -3704020040703191433
289
289
  required_rubygems_version: !ruby/object:Gem::Requirement
290
- none: false
291
290
  requirements:
292
291
  - - ! '>='
293
292
  - !ruby/object:Gem::Version
294
293
  version: '0'
295
- segments:
296
- - 0
297
- hash: -3704020040703191433
298
294
  requirements: []
299
295
  rubyforge_project: shelly
300
- rubygems_version: 1.8.24
296
+ rubygems_version: 2.0.3
301
297
  signing_key:
302
- specification_version: 3
298
+ specification_version: 4
303
299
  summary: Shelly Cloud command line tool
304
- test_files: []
300
+ test_files:
301
+ - spec/helpers.rb
302
+ - spec/input_faker.rb
303
+ - spec/shelly/app_spec.rb
304
+ - spec/shelly/backup_spec.rb
305
+ - spec/shelly/cli/backup_spec.rb
306
+ - spec/shelly/cli/config_spec.rb
307
+ - spec/shelly/cli/deploy_spec.rb
308
+ - spec/shelly/cli/file_spec.rb
309
+ - spec/shelly/cli/main_spec.rb
310
+ - spec/shelly/cli/organization_spec.rb
311
+ - spec/shelly/cli/runner_spec.rb
312
+ - spec/shelly/cli/user_spec.rb
313
+ - spec/shelly/client_spec.rb
314
+ - spec/shelly/cloudfile_spec.rb
315
+ - spec/shelly/download_progress_bar_spec.rb
316
+ - spec/shelly/model_spec.rb
317
+ - spec/shelly/organization_spec.rb
318
+ - spec/shelly/structure_validator_spec.rb
319
+ - spec/shelly/user_spec.rb
320
+ - spec/spec_helper.rb
321
+ - spec/thor/options_spec.rb