pessimize 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0fe16d5f3ed338da50ef9e974677d68d3a81ed29
4
- data.tar.gz: 77d7c52462e561032b06ce9e2561e61e24e3f247
2
+ SHA256:
3
+ metadata.gz: 328cf58068b89a4af991c612192c32186ae9974c5ef2aa31f1bf468c3eddc1c5
4
+ data.tar.gz: 27ed693f8fc6fe7b1c933a8eababcc1bb22e1c5128fc5863a31ec67eee6d46be
5
5
  SHA512:
6
- metadata.gz: d43cd538191fb744cf15419cd975e490a03e50238cb3454862311c187e15bc056738bafea92f5469c7746da214fba5aa034939b542f99bf9ea07e8cc11e6e881
7
- data.tar.gz: 4edc8c8f15b4c704c12696290e747deaa0e17078d6df97e1113b1d71091adbddbaa7b3a1808379896be4ad04a9eb88c9c18855157a2566c9ef60b2dc4425c172
6
+ metadata.gz: 13bc8764d75d8066c3760bf49ca05bcba94120549f9fe3b550780905eed9dcd40bff4d6912ca66e30f9b736777f607de6d4af945da24220f47e489316f6cbea7
7
+ data.tar.gz: 2d78c2c8d96ce6dff47a2b952538773f0ed5a5494aaf86bcf9ed8fd89c425218924c8a7141e80a9f159929830ec1cb6df99f57eacf94888a773421d150b5550c
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ === Pessimize 0.5.0
2
+ * Fix deprecation warnings related to the `trollop` gem being renamed to `optimist`
3
+ * Ensure compatibility with Ruby 3.2 by handling the removal of the deprecated `File.exists?` method
4
+ * Remove potentially NSFW word from Readme (PR #28)
5
+ * Ignore pre-release gems (PR #17)
6
+ * Update versions for development gems, rake and rspec
7
+
1
8
  === Pessimize 0.4.0
2
9
  * Specify version of codeclimate-test-reporter to avert a breaking change (introduced in 1.0.0)
3
10
  * Fix documentation link for pessimistic operator (issue #19)
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  Anyone who works with a Gemfile, i.e. a project that uses [bundler][1].
10
10
 
11
11
  ### What does it do?
12
- Pessimize adds version numbers with the pessimistic constraint operator (`~>`, a.k.a. "spermy" operator) to all gems in your `Gemfile`.
12
+ Pessimize adds version numbers with the pessimistic constraint operator (`~>`) to all gems in your `Gemfile`.
13
13
 
14
14
  ### Why?
15
15
  You should be using `~> x.x` to limit the version numbers of your gems, otherwise `bundle update` could potentially break your application. Read the section on "why bundle update can be dangerous" for a more detailed description, or take a look at the [rubygems explanation][2].
@@ -9,7 +9,7 @@ module Pessimize
9
9
  end
10
10
 
11
11
  def gemfile?
12
- File.exists? gemfile
12
+ File.exist? gemfile
13
13
  end
14
14
 
15
15
  def gemfile_contents
@@ -17,7 +17,7 @@ module Pessimize
17
17
  end
18
18
 
19
19
  def gemfile_lock?
20
- File.exists? gemfile_lock
20
+ File.exist? gemfile_lock
21
21
  end
22
22
 
23
23
  def backup_gemfile!
@@ -1,6 +1,6 @@
1
1
  require 'pessimize/file_manager'
2
2
  require 'pessimize/pessimizer'
3
- require 'trollop'
3
+ require 'optimist'
4
4
 
5
5
  module Pessimize
6
6
  class Shell
@@ -23,7 +23,7 @@ module Pessimize
23
23
  end
24
24
 
25
25
  def cli_options
26
- Trollop::options do
26
+ Optimist::options do
27
27
  version "pessimize #{VERSION} (c) #{Time.now.year} Jon Cairns"
28
28
  banner <<-EOS
29
29
  Usage: pessimize [options]
@@ -43,7 +43,7 @@ Options:
43
43
  def check_options!(options)
44
44
  constraints = %w(minor patch)
45
45
  unless constraints.include? options[:version_constraint]
46
- Trollop::die :version_constraint, "must be one of #{constraints.join("|")}"
46
+ Optimist::die :version_constraint, "must be one of #{constraints.join("|")}"
47
47
  end
48
48
  end
49
49
 
@@ -1,3 +1,3 @@
1
1
  module Pessimize
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -3,8 +3,12 @@ module Pessimize
3
3
  def call(gems, versions, version_constraint)
4
4
  gems.each do |gem|
5
5
  if versions.has_key? gem.name
6
- version_parts = versions[gem.name].split('.')
7
- version = version_constraint == 'minor' ? version_parts.first(2).join('.') : version_parts.join('.')
6
+ version = versions[gem.name]
7
+ if !::Gem::Version.new(version).prerelease?
8
+ version_parts = versions[gem.name].split('.')
9
+ version_parts = version_constraint == 'minor' ? version_parts.first(2) : version_parts
10
+ version = version_parts.join('.')
11
+ end
8
12
  gem.version = "~> #{version}"
9
13
  end
10
14
  end
data/pessimize.gemspec CHANGED
@@ -15,9 +15,10 @@ This is for people who work with projects that use bundler, such as rails projec
15
15
  gem.homepage = "https://github.com/joonty/pessimize"
16
16
 
17
17
  gem.add_dependency 'bundler'
18
- gem.add_dependency 'trollop'
19
- gem.add_development_dependency 'rspec', '~> 2.13.0'
20
- gem.add_development_dependency 'rake', '~> 10.0.3'
18
+ gem.add_dependency 'optimist'
19
+ gem.add_development_dependency 'rspec', '~> 3.4.0'
20
+ gem.add_development_dependency 'rspec-its'
21
+ gem.add_development_dependency 'rake', '~> 13.0.6'
21
22
  gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.6.0'
22
23
 
23
24
  gem.files = `git ls-files`.split($/)
@@ -25,7 +25,7 @@ describe "running pessimize" do
25
25
 
26
26
  context "the Gemfile.backup" do
27
27
  it "should be created" do
28
- File.exists?(tmp_path + 'Gemfile.backup').should be_true
28
+ File.exist?(tmp_path + 'Gemfile.backup').should be_truthy
29
29
  end
30
30
 
31
31
  it "should be the same as the original Gemfile" do
@@ -63,13 +63,13 @@ describe "running pessimize" do
63
63
 
64
64
  context "the Gemfile.backup" do
65
65
  it "should not exist" do
66
- File.exists?(tmp_path + 'Gemfile.backup').should be_false
66
+ File.exist?(tmp_path + 'Gemfile.backup').should be_falsey
67
67
  end
68
68
  end
69
69
 
70
70
  context "the Gemfile.lock.backup" do
71
71
  it "should not exist" do
72
- File.exists?(tmp_path + 'Gemfile.lock.backup').should be_false
72
+ File.exist?(tmp_path + 'Gemfile.lock.backup').should be_falsey
73
73
  end
74
74
  end
75
75
 
@@ -561,13 +561,13 @@ GIT
561
561
  specs:
562
562
  pessimize (0.2.0)
563
563
  bundler
564
- trollop
564
+ optimist
565
565
 
566
566
  GEM
567
567
  remote: https://rubygems.org/
568
568
  specs:
569
569
  json (1.8.0)
570
- trollop (2.1.2)
570
+ optimist (3.0.1)
571
571
  sqlite3 (1.3.7)
572
572
  EOD
573
573
 
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'codeclimate-test-reporter'
2
2
  CodeClimate::TestReporter.start
3
3
  require 'rspec'
4
+ require 'rspec/its'
4
5
  require 'pessimize'
5
6
  require 'open3'
6
7
  require 'ripper'
@@ -13,6 +14,7 @@ RSpec.configure do |c|
13
14
  c.filter_run_excluding :exclude_platform => lambda { |platform|
14
15
  RUBY_PLATFORM.to_s == platform.to_s
15
16
  }
17
+ c.expect_with(:rspec) { |config| config.syntax = :should }
16
18
  end
17
19
 
18
20
  module IntegrationHelper
@@ -24,6 +24,20 @@ module Pessimize
24
24
  its(:version) { should == '~> 2.2' }
25
25
  end
26
26
 
27
+ context "with a gem, version hash with prerelease version, and minor constraint" do
28
+ let(:gems) { [ gem('example') ] }
29
+ let(:versions) { { 'example' => '2.2.3.rc1' } }
30
+ let(:mapper) { VersionMapper.new }
31
+
32
+ before do
33
+ mapper.call gems, versions, 'minor'
34
+ end
35
+
36
+ subject { gems.first }
37
+
38
+ its(:version) { should == '~> 2.2.3.rc1' }
39
+ end
40
+
27
41
  context "with multiple gems, version hash and minor constraint" do
28
42
  let(:gems) { [ gem('example'), gem('fish', '1.3.2') ] }
29
43
  let(:versions) { { 'example' => '1.4.9', 'fish' => '2.3.0' } }
@@ -81,5 +95,19 @@ module Pessimize
81
95
  its(:version) { should == '~> 2.3.0' }
82
96
  end
83
97
  end
98
+
99
+ context "with a gem, version hash with prerelease version, and patch constraint" do
100
+ let(:gems) { [ gem('example') ] }
101
+ let(:versions) { { 'example' => '2.2.3.rc1' } }
102
+ let(:mapper) { VersionMapper.new }
103
+
104
+ before do
105
+ mapper.call gems, versions, 'patch'
106
+ end
107
+
108
+ subject { gems.first }
109
+
110
+ its(:version) { should == '~> 2.2.3.rc1' }
111
+ end
84
112
  end
85
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pessimize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Cairns
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-20 00:00:00.000000000 Z
11
+ date: 2023-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: trollop
28
+ name: optimist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -44,28 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.13.0
47
+ version: 3.4.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.13.0
54
+ version: 3.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-its
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 10.0.3
75
+ version: 13.0.6
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 10.0.3
82
+ version: 13.0.6
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: codeclimate-test-reporter
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -138,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
152
  - !ruby/object:Gem::Version
139
153
  version: '0'
140
154
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.5.2.1
155
+ rubygems_version: 3.1.6
143
156
  signing_key:
144
157
  specification_version: 4
145
158
  summary: Add the pessimistic constraint operator to all gems in your Gemfile, restricting