shelly 0.0.50.pre2 → 0.0.50
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/lib/shelly/app.rb +4 -20
- data/lib/shelly/cli/main.rb +8 -14
- data/lib/shelly/version.rb +1 -1
- data/spec/shelly/app_spec.rb +4 -31
- data/spec/shelly/cli/main_spec.rb +12 -41
- metadata +32 -32
data/lib/shelly/app.rb
CHANGED
@@ -13,16 +13,12 @@ module Shelly
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_git_remote
|
16
|
-
system("git remote rm
|
17
|
-
system("git remote add
|
18
|
-
end
|
19
|
-
|
20
|
-
def git_remote_exist?
|
21
|
-
IO.popen("git remote").read.include?(code_name)
|
16
|
+
system("git remote rm production > /dev/null 2>&1")
|
17
|
+
system("git remote add production #{git_url}")
|
22
18
|
end
|
23
19
|
|
24
20
|
def remove_git_remote
|
25
|
-
system("git remote rm
|
21
|
+
system("git remote rm production > /dev/null 2>&1")
|
26
22
|
end
|
27
23
|
|
28
24
|
def generate_cloudfile
|
@@ -106,19 +102,7 @@ module Shelly
|
|
106
102
|
end
|
107
103
|
|
108
104
|
def self.guess_code_name
|
109
|
-
|
110
|
-
if Cloudfile.present?
|
111
|
-
clouds = Cloudfile.new.clouds
|
112
|
-
if clouds.grep(/staging/).present?
|
113
|
-
guessed = "production"
|
114
|
-
production_clouds = clouds.grep(/production/)
|
115
|
-
production_clouds.sort.each do |cloud|
|
116
|
-
cloud =~ /production(\d*)/
|
117
|
-
guessed = "production#{$1.to_i+1}"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
"#{File.basename(Dir.pwd)}-#{guessed || 'staging'}"
|
105
|
+
File.basename(Dir.pwd)
|
122
106
|
end
|
123
107
|
|
124
108
|
def collaborations
|
data/lib/shelly/cli/main.rb
CHANGED
@@ -85,14 +85,8 @@ module Shelly
|
|
85
85
|
@app.domains = options["domains"] || ["#{@app.code_name}.shellyapp.com"]
|
86
86
|
@app.create
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
say "Adding remote #{@app} #{@app.git_url}", :green
|
91
|
-
@app.add_git_remote
|
92
|
-
else
|
93
|
-
say "You have to manually add git remote:"
|
94
|
-
say "`git remote add NAME #{@app.git_url}`"
|
95
|
-
end
|
88
|
+
say "Adding remote production #{@app.git_url}", :green
|
89
|
+
@app.add_git_remote
|
96
90
|
|
97
91
|
say "Creating Cloudfile", :green
|
98
92
|
@app.create_cloudfile
|
@@ -106,7 +100,7 @@ module Shelly
|
|
106
100
|
end
|
107
101
|
|
108
102
|
info_adding_cloudfile_to_repository
|
109
|
-
info_deploying_to_shellycloud
|
103
|
+
info_deploying_to_shellycloud
|
110
104
|
|
111
105
|
rescue Client::ValidationException => e
|
112
106
|
e.each_error { |error| say_error error, :with_exit => false }
|
@@ -350,8 +344,8 @@ module Shelly
|
|
350
344
|
end
|
351
345
|
|
352
346
|
def ask_for_code_name
|
353
|
-
default_code_name = Shelly::App.guess_code_name
|
354
|
-
code_name = ask("Cloud code name (#{
|
347
|
+
default_code_name = "#{Shelly::App.guess_code_name}-production"
|
348
|
+
code_name = ask("Cloud code name (#{default_code_name} - default):")
|
355
349
|
code_name.blank? ? default_code_name : code_name
|
356
350
|
end
|
357
351
|
|
@@ -375,15 +369,15 @@ module Shelly
|
|
375
369
|
say " git status"
|
376
370
|
end
|
377
371
|
|
378
|
-
def info_deploying_to_shellycloud
|
372
|
+
def info_deploying_to_shellycloud
|
379
373
|
say_new_line
|
380
374
|
say "When you make sure all settings are correct please issue following commands:", :green
|
381
375
|
say " git add ."
|
382
376
|
say ' git commit -m "Application added to Shelly Cloud"'
|
383
377
|
say " git push"
|
384
378
|
say_new_line
|
385
|
-
say "Deploy to
|
386
|
-
say " git push
|
379
|
+
say "Deploy to production using:", :green
|
380
|
+
say " git push production master"
|
387
381
|
say_new_line
|
388
382
|
end
|
389
383
|
end
|
data/lib/shelly/version.rb
CHANGED
data/spec/shelly/app_spec.rb
CHANGED
@@ -12,27 +12,8 @@ describe Shelly::App do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe ".guess_code_name" do
|
15
|
-
|
16
|
-
|
17
|
-
Shelly::App.guess_code_name.should == "foo-staging"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "with Cloudfile" do
|
22
|
-
it "should return production" do
|
23
|
-
File.open("Cloudfile", 'w') {|f| f.write("foo-staging:\n") }
|
24
|
-
Shelly::App.guess_code_name.should == "foo-production"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should return production" do
|
28
|
-
File.open("Cloudfile", 'w') {|f| f.write("winnie-test:\n") }
|
29
|
-
Shelly::App.guess_code_name.should == "foo-staging"
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should return productionNUMBER" do
|
33
|
-
File.open("Cloudfile", 'w') {|f| f.write("foo-staging:\nfoo-production:\n") }
|
34
|
-
Shelly::App.guess_code_name.should == "foo-production1"
|
35
|
-
end
|
15
|
+
it "should return name of current working directory" do
|
16
|
+
Shelly::App.guess_code_name.should == "foo"
|
36
17
|
end
|
37
18
|
end
|
38
19
|
|
@@ -50,24 +31,16 @@ describe Shelly::App do
|
|
50
31
|
end
|
51
32
|
|
52
33
|
it "should try to remove existing git remote" do
|
53
|
-
@app.should_receive(:system).with("git remote rm
|
34
|
+
@app.should_receive(:system).with("git remote rm production > /dev/null 2>&1")
|
54
35
|
@app.add_git_remote
|
55
36
|
end
|
56
37
|
|
57
38
|
it "should add git remote with proper name and git repository" do
|
58
|
-
@app.should_receive(:system).with("git remote add
|
39
|
+
@app.should_receive(:system).with("git remote add production git@git.shellycloud.com:foo-staging.git")
|
59
40
|
@app.add_git_remote
|
60
41
|
end
|
61
42
|
end
|
62
43
|
|
63
|
-
describe "git_remote_exist" do
|
64
|
-
it "should return true if git remote exist" do
|
65
|
-
io = mock(:read => "origin\nfoo-staging")
|
66
|
-
IO.should_receive(:popen).with("git remote").and_return(io)
|
67
|
-
@app.git_remote_exist?.should be_true
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
44
|
describe "#configs" do
|
72
45
|
it "should get configs from client" do
|
73
46
|
@client.should_receive(:app_configs).with("foo-staging").and_return(config_response)
|
@@ -274,7 +274,6 @@ OUT
|
|
274
274
|
Shelly::App.stub(:new).and_return(@app)
|
275
275
|
@client.stub(:token).and_return("abc")
|
276
276
|
@app.stub(:attributes).and_return({"trial" => false})
|
277
|
-
@app.stub(:git_remote_exist?).and_return(false)
|
278
277
|
end
|
279
278
|
|
280
279
|
# This spec tests inside_git_repository? hook
|
@@ -329,7 +328,7 @@ OUT
|
|
329
328
|
end
|
330
329
|
|
331
330
|
it "should use code name provided by user" do
|
332
|
-
$stdout.should_receive(:print).with("Cloud code name (foo-
|
331
|
+
$stdout.should_receive(:print).with("Cloud code name (foo-production - default): ")
|
333
332
|
@app.should_receive(:code_name=).with("mycodename")
|
334
333
|
fake_stdin(["mycodename", ""]) do
|
335
334
|
invoke(@main, :add)
|
@@ -338,8 +337,8 @@ OUT
|
|
338
337
|
|
339
338
|
context "when user provided empty code name" do
|
340
339
|
it "should use 'current_dirname-purpose' as default" do
|
341
|
-
$stdout.should_receive(:print).with("Cloud code name (foo-
|
342
|
-
@app.should_receive(:code_name=).with("foo-
|
340
|
+
$stdout.should_receive(:print).with("Cloud code name (foo-production - default): ")
|
341
|
+
@app.should_receive(:code_name=).with("foo-production")
|
343
342
|
fake_stdin(["", ""]) do
|
344
343
|
invoke(@main, :add)
|
345
344
|
end
|
@@ -394,7 +393,7 @@ OUT
|
|
394
393
|
$stdout.should_receive(:puts).with(green "Billing information")
|
395
394
|
$stdout.should_receive(:puts).with("Cloud created with 20 Euro credit.")
|
396
395
|
$stdout.should_receive(:puts).with("Remember to provide billing details before trial ends.")
|
397
|
-
$stdout.should_receive(:puts).with("http://example.com/apps/foo-
|
396
|
+
$stdout.should_receive(:puts).with("http://example.com/apps/foo-production/billing/edit")
|
398
397
|
|
399
398
|
fake_stdin(["", ""]) do
|
400
399
|
invoke(@main, :add)
|
@@ -416,7 +415,7 @@ OUT
|
|
416
415
|
@app.should_receive(:create).and_raise(exception)
|
417
416
|
$stdout.should_receive(:puts).with("\e[31mCode name has been already taken\e[0m")
|
418
417
|
$stdout.should_receive(:puts).with("\e[31mFix erros in the below command and type it again to create your cloud\e[0m")
|
419
|
-
$stdout.should_receive(:puts).with("\e[31mshelly add --code-name=foo-
|
418
|
+
$stdout.should_receive(:puts).with("\e[31mshelly add --code-name=foo-production --databases=postgresql --domains=foo-production.shellyapp.com\e[0m")
|
420
419
|
lambda {
|
421
420
|
fake_stdin(["", ""]) do
|
422
421
|
invoke(@main, :add)
|
@@ -437,39 +436,11 @@ OUT
|
|
437
436
|
}.should raise_error(SystemExit)
|
438
437
|
end
|
439
438
|
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
invoke(@main, :add)
|
446
|
-
end
|
447
|
-
end
|
448
|
-
|
449
|
-
context "does exist" do
|
450
|
-
before do
|
451
|
-
@app.stub(:git_remote_exist?).and_return(true)
|
452
|
-
end
|
453
|
-
|
454
|
-
it "should ask if one exist and overwrite" do
|
455
|
-
$stdout.should_receive(:print).with("Git remote foooo exists, overwrite (yes/no): ")
|
456
|
-
$stdout.should_receive(:puts).with(green "Adding remote foooo git@git.shellycloud.com:foooo.git")
|
457
|
-
@app.should_receive(:add_git_remote)
|
458
|
-
fake_stdin(["foooo", "", "yes"]) do
|
459
|
-
invoke(@main, :add)
|
460
|
-
end
|
461
|
-
end
|
462
|
-
|
463
|
-
it "should ask if one exist and not overwrite" do
|
464
|
-
$stdout.should_receive(:print).with("Git remote foooo exists, overwrite (yes/no): ")
|
465
|
-
$stdout.should_receive(:puts).with("You have to manually add git remote:")
|
466
|
-
$stdout.should_receive(:puts).with("`git remote add NAME git@git.shellycloud.com:foooo.git`")
|
467
|
-
@app.should_not_receive(:add_git_remote)
|
468
|
-
fake_stdin(["foooo", "", "no"]) do
|
469
|
-
invoke(@main, :add)
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
439
|
+
it "should add git remote" do
|
440
|
+
$stdout.should_receive(:puts).with("\e[32mAdding remote production git@git.shellycloud.com:foooo.git\e[0m")
|
441
|
+
@app.should_receive(:add_git_remote)
|
442
|
+
fake_stdin(["foooo", ""]) do
|
443
|
+
invoke(@main, :add)
|
473
444
|
end
|
474
445
|
end
|
475
446
|
|
@@ -495,8 +466,8 @@ OUT
|
|
495
466
|
$stdout.should_receive(:puts).with(" git add .")
|
496
467
|
$stdout.should_receive(:puts).with(' git commit -m "Application added to Shelly Cloud"')
|
497
468
|
$stdout.should_receive(:puts).with(" git push")
|
498
|
-
$stdout.should_receive(:puts).with("\e[32mDeploy to
|
499
|
-
$stdout.should_receive(:puts).with(" git push
|
469
|
+
$stdout.should_receive(:puts).with("\e[32mDeploy to production using:\e[0m")
|
470
|
+
$stdout.should_receive(:puts).with(" git push production master")
|
500
471
|
fake_stdin(["foooo", "none"]) do
|
501
472
|
invoke(@main, :add)
|
502
473
|
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.50
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.50
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Shelly Cloud team
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70296043444020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.8.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70296043444020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70296043443600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70296043443600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: guard
|
38
|
-
requirement: &
|
38
|
+
requirement: &70296043443140 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70296043443140
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard-rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70296043442720 !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: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70296043442720
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &70296043442300 !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: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70296043442300
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ruby_gntp
|
71
|
-
requirement: &
|
71
|
+
requirement: &70296043441840 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70296043441840
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rb-fsevent
|
82
|
-
requirement: &
|
82
|
+
requirement: &70296043441420 !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: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70296043441420
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: fakefs
|
93
|
-
requirement: &
|
93
|
+
requirement: &70296043441000 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70296043441000
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: fakeweb
|
104
|
-
requirement: &
|
104
|
+
requirement: &70296043440580 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70296043440580
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: wijet-thor
|
115
|
-
requirement: &
|
115
|
+
requirement: &70296043440080 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 0.14.7
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70296043440080
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rest-client
|
126
|
-
requirement: &
|
126
|
+
requirement: &70296043439660 !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: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70296043439660
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: json
|
137
|
-
requirement: &
|
137
|
+
requirement: &70296043439200 !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: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70296043439200
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: progressbar
|
148
|
-
requirement: &
|
148
|
+
requirement: &70296043438780 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :runtime
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70296043438780
|
157
157
|
description: Tool for managing applications and clouds at shellycloud.com
|
158
158
|
email:
|
159
159
|
- support@shellycloud.com
|
@@ -226,12 +226,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
226
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
227
|
none: false
|
228
228
|
requirements:
|
229
|
-
- - ! '
|
229
|
+
- - ! '>='
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version:
|
231
|
+
version: '0'
|
232
232
|
requirements: []
|
233
233
|
rubyforge_project: shelly
|
234
|
-
rubygems_version: 1.8.
|
234
|
+
rubygems_version: 1.8.17
|
235
235
|
signing_key:
|
236
236
|
specification_version: 3
|
237
237
|
summary: Shelly Cloud command line tool
|