shelly 0.1.40 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,3 +3,5 @@ rvm:
3
3
  - 1.9.2
4
4
  - 1.8.7
5
5
  - ree
6
+ - jruby-18mode
7
+ - jruby-19mode
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## 0.1.39 / 2013-01-08
1
+ ## 0.2.0 / 2013-01-10
2
+
3
+ * [feature] shelly now works on JRuby
4
+ * [feature] only valid YAML is accepted in Cloudfiles
5
+ * [feature] shelly-dependencies is no longer a dependency, add thin to Gemfile separately
6
+
7
+ ## 0.1.40 / 2013-01-08
2
8
 
3
9
  * [improvement] `shelly deploys pending` fetches references from origin before displaying the list of commits.
4
10
 
data/lib/shelly.rb CHANGED
@@ -4,9 +4,6 @@ require "core_ext/hash"
4
4
  require "core_ext/string"
5
5
 
6
6
  require "yaml"
7
- if YAML.const_defined?(:ENGINE)
8
- YAML::ENGINE.yamler = 'syck'
9
- end
10
7
 
11
8
  require "shelly/helpers"
12
9
  require "shelly/model"
@@ -414,10 +414,6 @@ We have been notified about it. We will be adding new resources shortly}
414
414
  print_check(structure.gem?("thin"), "Gem 'thin' is present",
415
415
  "Gem 'thin' is missing in the Gemfile", :show_fulfilled => verbose)
416
416
 
417
- print_check(structure.gem?("rake"), "Gem 'rake' is present",
418
- "Gem 'rake' is missing in the Gemfile", :show_fulfilled => verbose)
419
-
420
-
421
417
  print_check(structure.gem?("rake"), "Gem 'rake' is present",
422
418
  "Gem 'rake' is missing in the Gemfile", :show_fulfilled => verbose)
423
419
 
@@ -27,7 +27,7 @@ module Shelly
27
27
  @email = current_user.email
28
28
  @thin = @size == "small" ? 2 : 4
29
29
  template = File.read(template_path)
30
- cloudfile = ERB.new(template, 0, "%<>-")
30
+ cloudfile = ERB.new(template, nil, "%<>-")
31
31
  cloudfile.result(binding)
32
32
  end
33
33
 
@@ -41,6 +41,20 @@ module Shelly
41
41
  def content
42
42
  return unless present?
43
43
  @content ||= YAML.load(File.open(path))
44
+ rescue Psych::SyntaxError => e
45
+ # Using $stdout.puts so that it can be stubbed out on jruby.
46
+ $stdout.puts "Your Cloudfile has invalid YAML syntax."
47
+ $stdout.puts "You are seeing this message because we stopped supporting invalid YAML that was allowed in Ruby 1.8."
48
+ $stdout.puts ""
49
+ $stdout.puts "The most likely reason is a string starting with '*' in the domains array. The solution is to surround such strings with quotes, e.g.:"
50
+ $stdout.puts "domains:"
51
+ $stdout.puts " - \"*.example.com\""
52
+ $stdout.puts ""
53
+ $stdout.puts "The original YAML error message was:"
54
+ $stdout.puts " #{e.message}"
55
+ $stdout.puts ""
56
+ $stdout.puts "If you need any assistance, feel free to contact support@shellycloud.com"
57
+ exit 1
44
58
  end
45
59
 
46
60
  # Internal: Path to Cloudfile in current directory
@@ -1,4 +1,3 @@
1
- require 'grit'
2
1
  require 'bundler'
3
2
 
4
3
  module Shelly
@@ -52,12 +51,9 @@ module Shelly
52
51
 
53
52
  def repo_paths
54
53
  @repo_paths ||= begin
55
- repo = Grit::Repo.new(".")
56
- # Select files from repo which are unchanged, added or modified
57
- # and then return their paths
58
- repo.status.files.map(&:last).select { |status|
59
- status.type.nil? || status.type == 'A' || status.type == 'M'
60
- }.map(&:path)
54
+ files = `git ls-files`.split("\n")
55
+ deleted_files = `git ls-files -d`.split("\n")
56
+ files - deleted_files
61
57
  end
62
58
  end
63
59
  end
@@ -4,8 +4,12 @@
4
4
  monitoring_email: <%= @email %>
5
5
  domains:
6
6
  <%- @domains.each do |domain| -%>
7
+ <%- if domain.start_with?("*") -%>
8
+ - "<%= domain %>"
9
+ <%- else -%>
7
10
  - <%= domain %>
8
11
  <%- end -%>
12
+ <%- end -%>
9
13
  servers:
10
14
  app1:
11
15
  size: <%= @size %>
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.1.40"
2
+ VERSION = "0.2.0"
3
3
  end
data/shelly.gemspec CHANGED
@@ -27,9 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_runtime_dependency "rest-client"
28
28
  s.add_runtime_dependency "json"
29
29
  s.add_runtime_dependency "progressbar"
30
- s.add_runtime_dependency "grit"
31
30
  s.add_runtime_dependency "launchy"
32
- s.add_runtime_dependency "shelly-dependencies", "~> 0.2.1"
33
31
 
34
32
  s.files = `git ls-files`.split("\n")
35
33
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require "spec_helper"
3
3
  require "shelly/cli/main"
4
- require "grit"
5
4
 
6
5
  describe Shelly::CLI::Main do
7
6
  before do
@@ -10,17 +10,6 @@ describe Shelly::Cloudfile do
10
10
  @cloudfile = Shelly::Cloudfile.new
11
11
  end
12
12
 
13
- it "should allow improper yaml that works with syck" do
14
- yaml = %Q{domains:
15
- - *.example.com
16
- - example.com
17
- }
18
- expect {
19
- yaml = YAML.load(yaml)
20
- }.to_not raise_error
21
- yaml.should == {"domains" => ["*.example.com", "example.com"]}
22
- end
23
-
24
13
  describe "#content" do
25
14
  it "should fetch and parse file content" do
26
15
  content = <<-config
@@ -55,6 +44,27 @@ config
55
44
  }
56
45
  }
57
46
  end
47
+
48
+ if RUBY_VERSION >= "1.9"
49
+ it "prints error and quits when 1.9 incompatible syntax is used" do
50
+ $stdout.stub(:puts)
51
+
52
+ content = <<-config
53
+ foo-staging:
54
+ domains:
55
+ - foo-staging.winniecloud.com
56
+ - *.foo-staging.com
57
+ config
58
+
59
+ File.open("/projects/foo/Cloudfile", "w") { |f| f << content }
60
+
61
+ $stdout.should_receive(:puts).with("Your Cloudfile has invalid YAML syntax.")
62
+
63
+ expect {
64
+ @cloudfile.content
65
+ }.to raise_error(SystemExit)
66
+ end
67
+ end
58
68
  end
59
69
 
60
70
  describe "#clouds" do
@@ -86,7 +96,7 @@ config
86
96
  describe "#generate" do
87
97
  before do
88
98
  @cloudfile.code_name = "foo-staging"
89
- @cloudfile.domains = ["foo-staging.winniecloud.com", "foo.example.com"]
99
+ @cloudfile.domains = ["foo-staging.winniecloud.com", "*.foo.example.com"]
90
100
  @cloudfile.databases = ["postgresql", "mongodb"]
91
101
  @cloudfile.ruby_version = "1.9.3"
92
102
  @cloudfile.environment = "production"
@@ -104,7 +114,7 @@ foo-staging:
104
114
  monitoring_email: bob@example.com
105
115
  domains:
106
116
  - foo-staging.winniecloud.com
107
- - foo.example.com
117
+ - "*.foo.example.com"
108
118
  servers:
109
119
  app1:
110
120
  size: large
@@ -132,7 +142,7 @@ foo-staging:
132
142
  monitoring_email: bob@example.com
133
143
  domains:
134
144
  - foo-staging.winniecloud.com
135
- - foo.example.com
145
+ - "*.foo.example.com"
136
146
  servers:
137
147
  app1:
138
148
  size: small
@@ -3,10 +3,7 @@ require "spec_helper"
3
3
  describe Shelly::StructureValidator do
4
4
  before do
5
5
  @validator = Shelly::StructureValidator.new
6
- statuses = [mock(:type => nil, :path => "Gemfile"),
7
- mock(:type => nil, :path => "Gemfile.lock"),
8
- mock(:type => nil, :path => "config.ru")]
9
- Grit::Repo.stub_chain(:new, :status, :files, :map => statuses)
6
+ @validator.stub(:repo_paths => ["Gemfile", "Gemfile.lock", "config.ru"])
10
7
  end
11
8
 
12
9
  describe "#gemfile?" do
@@ -18,9 +15,7 @@ describe Shelly::StructureValidator do
18
15
 
19
16
  context "when Gemfile doesn't exist" do
20
17
  it "should return false" do
21
- Grit::Repo.stub_chain(:new, :status, :files,
22
- :map => [mock(:type => 'D', :path => "Gemfile"),
23
- mock(:type => nil, :path => "Gemfile.lock")])
18
+ @validator.stub(:repo_paths => ["Gemfile.lock"])
24
19
  @validator.gemfile?.should == false
25
20
  end
26
21
  end
@@ -35,9 +30,7 @@ describe Shelly::StructureValidator do
35
30
 
36
31
  context "when Gemfile.lock doesn't exist" do
37
32
  it "should return false" do
38
- Grit::Repo.stub_chain(:new, :status, :files,
39
- :map => [mock(:type => nil, :path => "Gemfile"),
40
- mock(:type => 'D' , :path => "Gemfile.lock")])
33
+ @validator.stub(:repo_paths => ["Gemfile"])
41
34
  @validator.gemfile_lock?.should == false
42
35
  end
43
36
  end
@@ -52,7 +45,7 @@ describe Shelly::StructureValidator do
52
45
 
53
46
  context "when config.ru doesn't exist" do
54
47
  it "should return false" do
55
- Grit::Repo.stub_chain(:new, :status, :files, :map => [])
48
+ @validator.stub(:repo_paths => ["Gemfile.lock"])
56
49
  @validator.config_ru?.should == false
57
50
  end
58
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.40
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-08 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -219,22 +219,6 @@ dependencies:
219
219
  - - ! '>='
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
- - !ruby/object:Gem::Dependency
223
- name: grit
224
- requirement: !ruby/object:Gem::Requirement
225
- none: false
226
- requirements:
227
- - - ! '>='
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- type: :runtime
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
- requirements:
235
- - - ! '>='
236
- - !ruby/object:Gem::Version
237
- version: '0'
238
222
  - !ruby/object:Gem::Dependency
239
223
  name: launchy
240
224
  requirement: !ruby/object:Gem::Requirement
@@ -251,22 +235,6 @@ dependencies:
251
235
  - - ! '>='
252
236
  - !ruby/object:Gem::Version
253
237
  version: '0'
254
- - !ruby/object:Gem::Dependency
255
- name: shelly-dependencies
256
- requirement: !ruby/object:Gem::Requirement
257
- none: false
258
- requirements:
259
- - - ~>
260
- - !ruby/object:Gem::Version
261
- version: 0.2.1
262
- type: :runtime
263
- prerelease: false
264
- version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
- requirements:
267
- - - ~>
268
- - !ruby/object:Gem::Version
269
- version: 0.2.1
270
238
  description: Tool for managing applications and clouds at shellycloud.com
271
239
  email:
272
240
  - devs@shellycloud.com
@@ -349,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
349
317
  version: '0'
350
318
  segments:
351
319
  - 0
352
- hash: -2056349295390869621
320
+ hash: -2034292821512918677
353
321
  required_rubygems_version: !ruby/object:Gem::Requirement
354
322
  none: false
355
323
  requirements:
@@ -358,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
326
  version: '0'
359
327
  segments:
360
328
  - 0
361
- hash: -2056349295390869621
329
+ hash: -2034292821512918677
362
330
  requirements: []
363
331
  rubyforge_project: shelly
364
332
  rubygems_version: 1.8.24