pessimize 0.0.2

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.
@@ -0,0 +1,239 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.13)
5
+ actionpack (= 3.2.13)
6
+ mail (~> 2.5.3)
7
+ actionpack (3.2.13)
8
+ activemodel (= 3.2.13)
9
+ activesupport (= 3.2.13)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.4)
13
+ rack (~> 1.4.5)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.2.1)
17
+ activemodel (3.2.13)
18
+ activesupport (= 3.2.13)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.13)
21
+ activemodel (= 3.2.13)
22
+ activesupport (= 3.2.13)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.13)
26
+ activemodel (= 3.2.13)
27
+ activesupport (= 3.2.13)
28
+ activesupport (3.2.13)
29
+ i18n (= 0.6.1)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ bcrypt-ruby (3.0.1)
33
+ binman (3.3.1)
34
+ opener (>= 0.1.0, < 1)
35
+ builder (3.0.4)
36
+ capistrano (2.15.4)
37
+ highline
38
+ net-scp (>= 1.0.0)
39
+ net-sftp (>= 2.0.0)
40
+ net-ssh (>= 2.0.14)
41
+ net-ssh-gateway (>= 1.1.0)
42
+ capybara (2.0.3)
43
+ mime-types (>= 1.16)
44
+ nokogiri (>= 1.3.3)
45
+ rack (>= 1.0.0)
46
+ rack-test (>= 0.5.4)
47
+ selenium-webdriver (~> 2.0)
48
+ xpath (~> 1.0.0)
49
+ childprocess (0.3.9)
50
+ ffi (~> 1.0, >= 1.0.11)
51
+ ci_reporter (1.6.3)
52
+ builder (>= 2.1.2)
53
+ climate_control (0.0.3)
54
+ activesupport (>= 3.0)
55
+ cocaine (0.5.1)
56
+ climate_control (>= 0.0.3, < 1.0)
57
+ coffee-rails (3.2.2)
58
+ coffee-script (>= 2.2.0)
59
+ railties (~> 3.2.0)
60
+ coffee-script (2.2.0)
61
+ coffee-script-source
62
+ execjs
63
+ coffee-script-source (1.6.2)
64
+ daemons (1.1.9)
65
+ devise (2.2.4)
66
+ bcrypt-ruby (~> 3.0)
67
+ orm_adapter (~> 0.1)
68
+ railties (~> 3.1)
69
+ warden (~> 1.2.1)
70
+ diff-lcs (1.2.4)
71
+ erubis (2.7.0)
72
+ eventmachine (1.0.3)
73
+ execjs (1.4.0)
74
+ multi_json (~> 1.0)
75
+ factory_girl (4.2.0)
76
+ activesupport (>= 3.0.0)
77
+ factory_girl_rails (4.2.1)
78
+ factory_girl (~> 4.2.0)
79
+ railties (>= 3.0.0)
80
+ ffi (1.9.0)
81
+ grit (2.5.0)
82
+ diff-lcs (~> 1.1)
83
+ mime-types (~> 1.15)
84
+ posix-spawn (~> 0.3.6)
85
+ highline (1.6.19)
86
+ hike (1.2.3)
87
+ i18n (0.6.1)
88
+ journey (1.0.4)
89
+ jquery-rails (2.2.2)
90
+ railties (>= 3.0, < 5.0)
91
+ thor (>= 0.14, < 2.0)
92
+ json (1.7.7)
93
+ listen (0.7.3)
94
+ mail (2.5.4)
95
+ mime-types (~> 1.16)
96
+ treetop (~> 1.4.8)
97
+ metaclass (0.0.1)
98
+ mime-types (1.23)
99
+ mini_portile (0.5.0)
100
+ mocha (0.14.0)
101
+ metaclass (~> 0.0.1)
102
+ multi_json (1.7.7)
103
+ net-scp (1.1.1)
104
+ net-ssh (>= 2.6.5)
105
+ net-sftp (2.1.2)
106
+ net-ssh (>= 2.6.5)
107
+ net-ssh (2.6.7)
108
+ net-ssh-gateway (1.2.0)
109
+ net-ssh (>= 2.6.5)
110
+ nokogiri (1.6.0)
111
+ mini_portile (~> 0.5.0)
112
+ opener (0.1.0)
113
+ orm_adapter (0.4.0)
114
+ paperclip (3.4.2)
115
+ activemodel (>= 3.0.0)
116
+ activerecord (>= 3.0.0)
117
+ activesupport (>= 3.0.0)
118
+ cocaine (~> 0.5.0)
119
+ mime-types
120
+ pg (0.15.1)
121
+ polyglot (0.3.3)
122
+ posix-spawn (0.3.6)
123
+ rack (1.4.5)
124
+ rack-cache (1.2)
125
+ rack (>= 0.4)
126
+ rack-ssl (1.3.3)
127
+ rack
128
+ rack-test (0.6.2)
129
+ rack (>= 1.0)
130
+ rails (3.2.13)
131
+ actionmailer (= 3.2.13)
132
+ actionpack (= 3.2.13)
133
+ activerecord (= 3.2.13)
134
+ activeresource (= 3.2.13)
135
+ activesupport (= 3.2.13)
136
+ bundler (~> 1.0)
137
+ railties (= 3.2.13)
138
+ railties (3.2.13)
139
+ actionpack (= 3.2.13)
140
+ activesupport (= 3.2.13)
141
+ rack-ssl (~> 1.3.2)
142
+ rake (>= 0.8.7)
143
+ rdoc (~> 3.4)
144
+ thor (>= 0.14.6, < 2.0)
145
+ rake (10.0.4)
146
+ rb-inotify (0.9.0)
147
+ ffi (>= 0.5.0)
148
+ rdoc (3.12.2)
149
+ json (~> 1.4)
150
+ rubyzip (0.9.9)
151
+ rvm-capistrano (1.3.1)
152
+ capistrano (>= 2.0.0)
153
+ sass (3.2.9)
154
+ sass-rails (3.2.6)
155
+ railties (~> 3.2.0)
156
+ sass (>= 3.1.10)
157
+ tilt (~> 1.3)
158
+ selenium-webdriver (2.33.0)
159
+ childprocess (>= 0.2.5)
160
+ multi_json (~> 1.0)
161
+ rubyzip
162
+ websocket (~> 1.0.4)
163
+ shoulda (3.5.0)
164
+ shoulda-context (~> 1.0, >= 1.0.1)
165
+ shoulda-matchers (>= 1.4.1, < 3.0)
166
+ shoulda-context (1.1.2)
167
+ shoulda-matchers (2.2.0)
168
+ activesupport (>= 3.0.0)
169
+ simplecov (0.7.1)
170
+ multi_json (~> 1.0)
171
+ simplecov-html (~> 0.7.1)
172
+ simplecov-html (0.7.1)
173
+ simplecov-rcov (0.2.3)
174
+ simplecov (>= 0.4.1)
175
+ simplecov-rcov-text (0.0.2)
176
+ sprockets (2.2.2)
177
+ hike (~> 1.2)
178
+ multi_json (~> 1.0)
179
+ rack (~> 1.0)
180
+ tilt (~> 1.1, != 1.3.0)
181
+ sqlite3 (1.3.7)
182
+ strong_parameters (0.2.1)
183
+ actionpack (~> 3.0)
184
+ activemodel (~> 3.0)
185
+ railties (~> 3.0)
186
+ test-unit (2.0.9)
187
+ thin (1.5.1)
188
+ daemons (>= 1.0.9)
189
+ eventmachine (>= 0.12.6)
190
+ rack (>= 1.0.0)
191
+ thor (0.18.1)
192
+ tilt (1.4.1)
193
+ tork (19.3.1)
194
+ binman (~> 3.0)
195
+ diff-lcs (~> 1.1)
196
+ json (~> 1.6)
197
+ listen (~> 0.7)
198
+ treetop (1.4.14)
199
+ polyglot
200
+ polyglot (>= 0.3.1)
201
+ tzinfo (0.3.37)
202
+ uglifier (2.1.1)
203
+ execjs (>= 0.3.0)
204
+ multi_json (~> 1.0, >= 1.0.2)
205
+ warden (1.2.1)
206
+ rack (>= 1.0)
207
+ websocket (1.0.7)
208
+ xpath (1.0.0)
209
+ nokogiri (~> 1.3)
210
+
211
+ PLATFORMS
212
+ ruby
213
+
214
+ DEPENDENCIES
215
+ capistrano (~> 2.15.4)
216
+ capybara (~> 2.0.0)
217
+ ci_reporter (= 1.6.3)
218
+ coffee-rails (~> 3.2.1)
219
+ devise (~> 2.2.4)
220
+ factory_girl_rails (~> 4.0)
221
+ grit (~> 2.5.0)
222
+ jquery-rails (~> 2.2.1)
223
+ mocha (~> 0.14.0)
224
+ paperclip (~> 3.0)
225
+ pg (~> 0.15.1)
226
+ rails (= 3.2.13)
227
+ rb-inotify
228
+ rvm-capistrano (~> 1.3.0)
229
+ sass-rails (~> 3.2.3)
230
+ shoulda (~> 3.5.0)
231
+ simplecov
232
+ simplecov-rcov
233
+ simplecov-rcov-text
234
+ sqlite3 (~> 1.3.7)
235
+ strong_parameters (~> 0.2.1)
236
+ test-unit (~> 2.0.0)
237
+ thin (~> 1.5.1)
238
+ tork
239
+ uglifier (>= 1.0.3)
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/declaration'
3
+
4
+ module Pessimize
5
+ describe Declaration do
6
+ context "creating a 'source' declaration" do
7
+ subject { Declaration.new 'source', 'https://rubygems.org' }
8
+ its(:to_code) { should == 'source "https://rubygems.org"' }
9
+ end
10
+
11
+ context "creating a 'source' declaration with a symbol value" do
12
+ subject { Declaration.new 'source', :rubygems }
13
+ its(:to_code) { should == 'source :rubygems' }
14
+ end
15
+
16
+ context "creating a 'git' declaration" do
17
+ subject { Declaration.new 'git', 'git://github.com/wycats/thor.git', :tag => "v0.13.4" }
18
+ its(:to_code) { should == 'git "git://github.com/wycats/thor.git", {:tag=>"v0.13.4"}' }
19
+ end
20
+ end
21
+ end
data/spec/dsl_spec.rb ADDED
@@ -0,0 +1,108 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/dsl'
3
+
4
+ module Pessimize
5
+ describe DSL do
6
+ let(:collector) { double "collector" }
7
+ let(:dsl) { DSL.new collector }
8
+
9
+ shared_examples "a collector receiving a gem" do |definition, *args|
10
+ context "the collector" do
11
+ it "should receive the gem message with correct arguments" do
12
+ collector.should_receive(:add_gem).with(*args)
13
+ dsl.parse definition
14
+ end
15
+ end
16
+ end
17
+
18
+ context "with a string containing a gem definition" do
19
+ it_behaves_like "a collector receiving a gem", "gem 'monkey'", 'monkey'
20
+ end
21
+
22
+ context "with a string containing a gem definition with multiple arguments" do
23
+ it_behaves_like "a collector receiving a gem",
24
+ "gem 'hippo', '~> 2.0.0', :require => false",
25
+ 'hippo', '~> 2.0.0', :require => false
26
+ end
27
+
28
+ context "with a string containing multiple gem definitions" do
29
+ let(:definition) { <<-EOD
30
+ gem 'ponies', '>= 3.0.0'
31
+ gem 'shark', :require => false
32
+ EOD
33
+ }
34
+ context "the collector" do
35
+ it "should receive the gem message with correct arguments" do
36
+ collector.should_receive(:add_gem).with('ponies', '>= 3.0.0')
37
+ collector.should_receive(:add_gem).with('shark', :require => false)
38
+ dsl.parse definition
39
+ end
40
+ end
41
+ end
42
+
43
+ context "with a string containing a group definition" do
44
+ let(:definition) { <<-EOD
45
+ group :test do
46
+ gem 'ponies', '>= 3.0.0'
47
+ end
48
+ EOD
49
+ }
50
+ context "the collector" do
51
+ it "should receive the grouped gem message with correct arguments" do
52
+ collector.should_receive(:add_grouped_gem).with(:test, 'ponies', '>= 3.0.0')
53
+ dsl.parse definition
54
+ end
55
+ end
56
+ end
57
+
58
+ context "with a string containing a group definition and multiple gems" do
59
+ let(:definition) { <<-EOD
60
+ group :development do
61
+ gem 'ponies', '>= 3.0.0'
62
+ gem 'badgers', '~> 1.3.2', :require => false
63
+ end
64
+
65
+ gem 'ostriches', '0.0.1'
66
+ EOD
67
+ }
68
+ context "the collector" do
69
+ it "should receive the grouped gem message with correct arguments" do
70
+ collector.should_receive(:add_grouped_gem).with(:development, 'ponies', '>= 3.0.0')
71
+ collector.should_receive(:add_grouped_gem).with(:development, 'badgers', '~> 1.3.2', :require => false)
72
+ collector.should_receive(:add_gem).with('ostriches', '0.0.1')
73
+ dsl.parse definition
74
+ end
75
+ end
76
+ end
77
+
78
+ context "with a string containing a source declaration and a gem" do
79
+ let(:definition) { <<-EOD
80
+ source "https://rubygems.org"
81
+ gem 'ostriches', '0.0.1'
82
+ EOD
83
+ }
84
+ context "the collector" do
85
+ it "should receive the grouped gem message with correct arguments" do
86
+ collector.should_receive(:add_declaration).with('source', 'https://rubygems.org')
87
+ collector.should_receive(:add_gem).with('ostriches', '0.0.1')
88
+ dsl.parse definition
89
+ end
90
+ end
91
+ end
92
+
93
+ context "with a string containing a git declaration and something unknown" do
94
+ let(:definition) { <<-EOD
95
+ git 'git://github.com/wycats/thor.git', :tag => 'v0.13.4'
96
+ unknown 'sausages'
97
+ EOD
98
+ }
99
+ context "the collector" do
100
+ it "should receive the grouped gem message with correct arguments" do
101
+ collector.should_receive(:add_declaration).with('git', 'git://github.com/wycats/thor.git', :tag => 'v0.13.4')
102
+ collector.should_receive(:add_declaration).with('unknown', 'sausages')
103
+ dsl.parse definition
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/gem_collection'
3
+
4
+ module Pessimize
5
+ describe GemCollection do
6
+ let(:collection) { GemCollection.new }
7
+
8
+ describe "#add_gem" do
9
+ context "adding a gem with a version" do
10
+ before { collection.add_gem('ponies', '>= 0.3.0') }
11
+ let(:gem) { collection.all.first }
12
+ subject { gem }
13
+
14
+ it { should be_a Gem }
15
+ its(:name) { should == 'ponies' }
16
+ its(:version) { should == '>= 0.3.0' }
17
+
18
+ it "should be the same as the first gem in the global group" do
19
+ subject.should === collection.gems[:global].first
20
+ end
21
+
22
+ context "after setting the version" do
23
+ before { gem.version = '~> 0.3.1' }
24
+
25
+ its(:version) { should == '~> 0.3.1' }
26
+ end
27
+ end
28
+
29
+ context "adding a gem with options" do
30
+ before { collection.add_gem('ponies', :git => 'git@github.com:rails/rails.git') }
31
+ subject { collection.all.first }
32
+
33
+ it { should be_a Gem }
34
+ its(:name) { should == 'ponies' }
35
+ its(:options) { should == {:git=>'git@github.com:rails/rails.git'} }
36
+
37
+ it "should be the same as the first gem in the global group" do
38
+ subject.should === collection.gems[:global].first
39
+ end
40
+ end
41
+ end
42
+
43
+ describe "#add_grouped_gem" do
44
+ context "adding a gem in the development group" do
45
+ before { collection.add_grouped_gem(:development, 'ponies', '~> 0.2.3') }
46
+ subject { collection.all.first }
47
+
48
+ it { should be_a Gem }
49
+ its(:name) { should == 'ponies' }
50
+ its(:version) { should == '~> 0.2.3' }
51
+
52
+ it "should be the same as the first gem in the development group" do
53
+ subject.should === collection.gems[:development].first
54
+ end
55
+ end
56
+
57
+ context "adding a gem in the production group" do
58
+ before { collection.add_grouped_gem(:production, 'badger', '~> 1.4.1') }
59
+ subject { collection.all.first }
60
+
61
+ it { should be_a Gem }
62
+ its(:name) { should == 'badger' }
63
+ its(:version) { should == '~> 1.4.1' }
64
+
65
+ it "should be the same as the first gem in the production group" do
66
+ subject.should === collection.gems[:production].first
67
+ end
68
+ end
69
+ end
70
+
71
+ describe "#add_declaration" do
72
+ context "adding a source declaration" do
73
+ before { collection.add_declaration('source', 'https://rubygems.org') }
74
+ subject { collection.declarations.first }
75
+
76
+ it { should be_a Declaration }
77
+ its(:name) { should == 'source' }
78
+ its(:to_code) { should == 'source "https://rubygems.org"' }
79
+ end
80
+
81
+ context "adding a git declaration" do
82
+ before { collection.add_declaration('git', 'git://github.com/wycats/thor.git', :tag => 'v0.13.4') }
83
+ subject { collection.declarations.first }
84
+
85
+ it { should be_a Declaration }
86
+ its(:name) { should == 'git' }
87
+ its(:to_code) { should == 'git "git://github.com/wycats/thor.git", {:tag=>"v0.13.4"}' }
88
+ end
89
+ end
90
+ end
91
+ end
data/spec/gem_spec.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/gem.rb'
3
+
4
+ module Pessimize
5
+ describe Gem do
6
+ context "creating with the name as the only parameter" do
7
+ let(:gem) { Gem.new 'ponies' }
8
+ subject { gem }
9
+
10
+ its(:name) { should == 'ponies' }
11
+ its(:to_code) { should == 'gem "ponies"' }
12
+
13
+ context "setting the version" do
14
+ before { gem.version = '~> 3.0.0' }
15
+
16
+ its(:version) { should == '~> 3.0.0' }
17
+ its(:to_code) { should == 'gem "ponies", "~> 3.0.0"' }
18
+ end
19
+ end
20
+
21
+ context "creating with a name and version string" do
22
+ subject { Gem.new 'trolls', '>= 3.0' }
23
+
24
+ its(:name) { should == 'trolls' }
25
+ its(:version) { should == '>= 3.0' }
26
+ its(:to_code) { should == 'gem "trolls", ">= 3.0"' }
27
+ end
28
+
29
+ context "creating with a name and options hash" do
30
+ subject { Gem.new 'slow_loris', :require => false, :path => '/a/b/c' }
31
+ its(:name) { should == 'slow_loris' }
32
+ its(:options) { should == {:require => false, :path => '/a/b/c'} }
33
+ its(:to_code) { should == 'gem "slow_loris", {:require=>false, :path=>"/a/b/c"}' }
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/gemfile_lock_version_parser'
3
+
4
+ module Pessimize
5
+
6
+ describe GemfileLockVersionParser do
7
+ shared_examples "a gemfile lock parser" do |lock_file, expected_versions|
8
+
9
+ let(:parser) { GemfileLockVersionParser.new }
10
+
11
+ before do
12
+ parser.call lock_file
13
+ end
14
+
15
+ subject { parser.versions }
16
+
17
+ its "versions should match" do
18
+ expected_versions.each do |name, version|
19
+ subject[name].should == version
20
+ end
21
+ end
22
+ end
23
+
24
+ context "with an example lock file" do
25
+ it_behaves_like "a gemfile lock parser",
26
+ data_file('Gemfile.lock.example'),
27
+ { 'diff-lcs' => '1.2.4',
28
+ 'rake' => '10.0.4',
29
+ 'rspec' => '2.13.0',
30
+ 'rspec-core' => '2.13.1',
31
+ 'rspec-expectations' => '2.13.0',
32
+ 'rspec-mocks' => '2.13.1' }
33
+ end
34
+
35
+ context "with a larger example lock file" do
36
+ it_behaves_like "a gemfile lock parser",
37
+ data_file('Gemfile.lock.example2'),
38
+ { 'actionmailer' => '3.2.13',
39
+ 'activesupport' => '3.2.13',
40
+ 'arel' => '3.0.2',
41
+ 'binman' => '3.3.1',
42
+ 'capistrano' => '2.15.4',
43
+ 'capybara' => '2.0.3',
44
+ 'childprocess' => '0.3.9',
45
+ 'climate_control' => '0.0.3',
46
+ 'ci_reporter' => '1.6.3',
47
+ 'rails' => '3.2.13' }
48
+ end
49
+ end
50
+ end