pessimizer 1.0.0

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)
data/spec/gem_spec.rb ADDED
@@ -0,0 +1,114 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/gem'
3
+
4
+ module Pessimize
5
+ describe Gem do
6
+ context "creating a gem with just a name" do
7
+ let(:gem) { Gem.new(Ripper.lex('gem "monkey"')) }
8
+ subject { gem }
9
+
10
+ its(:name) { should == "monkey" }
11
+ its(:version) { should be_nil }
12
+ its(:to_s) { should == 'gem "monkey"' }
13
+
14
+ context "after setting the version" do
15
+ before do
16
+ gem.version = "~> 2.3.5"
17
+ end
18
+
19
+ its(:to_s) { should == 'gem "monkey", "~> 2.3.5"' }
20
+ end
21
+ end
22
+
23
+ context "creating a gem with a name and version" do
24
+ let(:gem) { Gem.new(Ripper.lex('gem "monkey", "~> 3.0"')) }
25
+ subject { gem }
26
+
27
+ its(:name) { should == "monkey" }
28
+ its(:version) { should == "~> 3.0" }
29
+ its(:to_s) { should == 'gem "monkey", "~> 3.0"' }
30
+
31
+ context "after setting the version" do
32
+ before do
33
+ gem.version = "~> 1.0"
34
+ end
35
+
36
+ its(:to_s) { should == 'gem "monkey", "~> 1.0"' }
37
+ end
38
+ end
39
+
40
+ context "creating a gem with a name and git url" do
41
+ let(:gem) { Gem.new(Ripper.lex('gem "something", git: git@somewhere.org:project.git')) }
42
+ subject { gem }
43
+
44
+ its(:name) { should == "something" }
45
+ its(:version) { should be_nil }
46
+
47
+ context "after setting the version" do
48
+ before do
49
+ gem.version = "~> 0.0.1"
50
+ end
51
+
52
+ its(:to_s) { should == 'gem "something", "~> 0.0.1", git: git@somewhere.org:project.git' }
53
+ end
54
+
55
+ end
56
+
57
+ context "creating a gem with a name, version and options" do
58
+ let(:gem) { Gem.new(Ripper.lex('gem "blah", "2.0.0beta", group: :development')) }
59
+ subject { gem }
60
+
61
+ its(:name) { should == "blah" }
62
+ its(:version) { should == "2.0.0beta" }
63
+
64
+ context "after setting the version" do
65
+ before do
66
+ gem.version = "~> 2.1"
67
+ end
68
+
69
+ its(:to_s) { should == 'gem "blah", "~> 2.1", group: :development' }
70
+ end
71
+
72
+ end
73
+
74
+ context "creating a gem with a comment" do
75
+ let(:gem) { Gem.new(Ripper.lex('gem "blah" # It blahs')) }
76
+ subject { gem }
77
+
78
+ its(:name) { should == "blah" }
79
+
80
+ context "after setting the version" do
81
+ before do
82
+ gem.version = "~> 2.1"
83
+ end
84
+
85
+ its(:to_s) { should == 'gem "blah", "~> 2.1" # It blahs' }
86
+ end
87
+
88
+ end
89
+
90
+ context "creating a gem using new lines for arguments" do
91
+ let(:gem_string) { <<GEM.strip
92
+ gem "blah",
93
+ "2.0.0beta",
94
+ group: :development
95
+ GEM
96
+ }
97
+
98
+ let(:gem) { Gem.new(Ripper.lex(gem_string)) }
99
+ subject { gem }
100
+
101
+ its(:name) { should == "blah" }
102
+ its(:version) { should == "2.0.0beta" }
103
+
104
+ context "after setting the version" do
105
+ before do
106
+ gem.version = "~> 2.1"
107
+ end
108
+
109
+ its(:to_s) { should == %Q(gem "blah",\n "~> 2.1",\n group: :development) }
110
+ end
111
+
112
+ end
113
+ end
114
+ 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
@@ -0,0 +1,254 @@
1
+ require 'spec_helper'
2
+ require 'pessimize/gemfile'
3
+
4
+ module Pessimize
5
+ describe Gemfile do
6
+ context "with a single gem definition" do
7
+ let(:gem_defn) { <<-GEM
8
+ source "https://rubygems.org"
9
+
10
+ gem "monkey"
11
+ GEM
12
+ }
13
+
14
+ subject(:gemfile) { Gemfile.new(gem_defn) }
15
+
16
+ its(:to_s) { should == gem_defn }
17
+
18
+ describe "#gems" do
19
+ subject(:gems) { gemfile.gems }
20
+
21
+ its(:length) { should == 1 }
22
+
23
+ describe "the first gem" do
24
+ subject { gems.first }
25
+
26
+ its(:name) { should == "monkey" }
27
+ end
28
+ end
29
+ end
30
+
31
+ context "with a gem definition and group" do
32
+ let(:gem_defn) { <<-GEM
33
+ source "https://rubygems.org"
34
+
35
+ group :development do
36
+ gem "monkey"
37
+ end
38
+ GEM
39
+ }
40
+
41
+ subject(:gemfile) { Gemfile.new(gem_defn) }
42
+
43
+ its(:to_s) { should == gem_defn }
44
+
45
+ describe "#gems" do
46
+ subject(:gems) { gemfile.gems }
47
+
48
+ its(:length) { should == 1 }
49
+
50
+ describe "the first gem" do
51
+ subject { gems.first }
52
+
53
+ its(:name) { should == "monkey" }
54
+ end
55
+ end
56
+ end
57
+
58
+ context "with multiple gem definitions" do
59
+
60
+ let(:gem_defn) { <<-GEM
61
+ source "https://rubygems.org"
62
+
63
+ gem "monkey", "2.0.0"
64
+
65
+ gem "thor", ">= 1.3.0"
66
+ GEM
67
+ }
68
+
69
+ subject(:gemfile) { Gemfile.new(gem_defn) }
70
+
71
+ its(:to_s) { should == gem_defn }
72
+
73
+ describe "#gems" do
74
+ subject(:gems) { gemfile.gems }
75
+
76
+ its(:length) { should == 2 }
77
+
78
+ describe "the first gem" do
79
+ subject(:gem) { gems[0] }
80
+
81
+ its(:name) { should == "monkey" }
82
+ its(:version) { should == "2.0.0" }
83
+ its(:to_s) { should == ' "monkey", "2.0.0"' }
84
+
85
+ context "setting the version" do
86
+ before do
87
+ gem.version = "~> 2.0.0"
88
+ end
89
+
90
+ its(:to_s) { should == ' "monkey", "~> 2.0.0"' }
91
+ end
92
+ end
93
+
94
+ describe "the second gem" do
95
+ subject { gems[1] }
96
+
97
+ its(:name) { should == "thor" }
98
+ its(:version) { should == ">= 1.3.0" }
99
+ end
100
+ end
101
+
102
+ context "after setting the gem versions" do
103
+ before do
104
+ gemfile.gems.each do |gem|
105
+ gem.version = "~> 1.0.0"
106
+ end
107
+ end
108
+
109
+ let(:expected_defn) { <<-GEM
110
+ source "https://rubygems.org"
111
+
112
+ gem "monkey", "~> 1.0.0"
113
+
114
+ gem "thor", "~> 1.0.0"
115
+ GEM
116
+ }
117
+
118
+ its(:to_s) { should == expected_defn }
119
+ end
120
+ end
121
+
122
+ context "with multiple gem definitions spanning multiple lines" do
123
+
124
+ let(:gem_defn) { <<-GEM
125
+ source "https://rubygems.org"
126
+
127
+ gem "monkey",
128
+ "2.0.0"
129
+
130
+ gem "thor",
131
+ ">= 1.3.0"
132
+ GEM
133
+ }
134
+
135
+ subject(:gemfile) { Gemfile.new(gem_defn) }
136
+
137
+ its(:to_s) { should == gem_defn }
138
+
139
+ describe "#gems" do
140
+ subject(:gems) { gemfile.gems }
141
+
142
+ its(:length) { should == 2 }
143
+
144
+ describe "the first gem" do
145
+ subject(:gem) { gems[0] }
146
+
147
+ its(:name) { should == "monkey" }
148
+ its(:version) { should == "2.0.0" }
149
+ its(:to_s) { should == %Q( "monkey",\n "2.0.0") }
150
+
151
+ context "setting the version" do
152
+ before do
153
+ gem.version = "~> 2.0.0"
154
+ end
155
+
156
+ its(:to_s) { should == %Q( "monkey",\n "~> 2.0.0") }
157
+ end
158
+ end
159
+
160
+ describe "the second gem" do
161
+ subject { gems[1] }
162
+
163
+ its(:name) { should == "thor" }
164
+ its(:version) { should == ">= 1.3.0" }
165
+ end
166
+ end
167
+
168
+ context "after setting the gem versions" do
169
+ before do
170
+ gemfile.gems.each do |gem|
171
+ gem.version = "~> 1.0.0"
172
+ end
173
+ end
174
+
175
+ let(:expected_defn) { <<-GEM
176
+ source "https://rubygems.org"
177
+
178
+ gem "monkey",
179
+ "~> 1.0.0"
180
+
181
+ gem "thor",
182
+ "~> 1.0.0"
183
+ GEM
184
+ }
185
+
186
+ its(:to_s) { should == expected_defn }
187
+ end
188
+ end
189
+
190
+ context "with multiple gem definitions separated with comments" do
191
+
192
+ let(:gem_defn) { <<-GEM
193
+ source "https://rubygems.org"
194
+
195
+ gem "monkey", "2.0.0" # a comment to throw things off
196
+
197
+ gem "thor", ">= 1.3.0"
198
+ GEM
199
+ }
200
+
201
+ subject(:gemfile) { Gemfile.new(gem_defn) }
202
+
203
+ its(:to_s) { should == gem_defn }
204
+
205
+ describe "#gems" do
206
+ subject(:gems) { gemfile.gems }
207
+
208
+ its(:length) { should == 2 }
209
+
210
+ describe "the first gem" do
211
+ subject(:gem) { gems[0] }
212
+
213
+ its(:name) { should == "monkey" }
214
+ its(:version) { should == "2.0.0" }
215
+ its(:to_s) { should == ' "monkey", "2.0.0" ' }
216
+
217
+ context "setting the version" do
218
+ before do
219
+ gem.version = "~> 2.0.0"
220
+ end
221
+
222
+ its(:to_s) { should == ' "monkey", "~> 2.0.0" ' }
223
+ end
224
+ end
225
+
226
+ describe "the second gem" do
227
+ subject { gems[1] }
228
+
229
+ its(:name) { should == "thor" }
230
+ its(:version) { should == ">= 1.3.0" }
231
+ end
232
+ end
233
+
234
+ context "after setting the gem versions" do
235
+ before do
236
+ gemfile.gems.each do |gem|
237
+ gem.version = "~> 1.0.0"
238
+ end
239
+ end
240
+
241
+ let(:expected_defn) { <<-GEM
242
+ source "https://rubygems.org"
243
+
244
+ gem "monkey", "~> 1.0.0" # a comment to throw things off
245
+
246
+ gem "thor", "~> 1.0.0"
247
+ GEM
248
+ }
249
+
250
+ its(:to_s) { should == expected_defn }
251
+ end
252
+ end
253
+ end
254
+ end