schmersion 1.0.1 → 1.1.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
2
  SHA256:
3
- metadata.gz: 8c75727a3611c7485ca5240461a417012ea8e735c54584712dc0b45081687d1a
4
- data.tar.gz: 12f59b6094e30ab452bcb7c3d04255a6370584a30b3b624e172bc3ca8407a806
3
+ metadata.gz: ebf5ec763672ffaed1a267587ce8901017d5844335535841be3a8ba678b9fcb5
4
+ data.tar.gz: db476ffab17ae0a13ea736ca7e86477e43a53fac15d3fa0b240e9e6d192da738
5
5
  SHA512:
6
- metadata.gz: b107052a62a00324d103749e3f3b6a940fbd7644ccdac1727cbb08e8ee89c89dba2c46d58d0e3e84b4149f39d3a18306b227a9bc04bf477739438ddd6cbb0b0e
7
- data.tar.gz: f008d0d940f346852a8ab405df12bdedc7a536fea5acb1a9eefaeb6ce3853762482493c1d47b598fb5da3a1b6bf7f68a09c8a4af25b2c3a3835fd3b5fde3dedb
6
+ metadata.gz: 3cb9ab527fb3eb7b32cab65570a2ccfe09371e99cc918c648e8b6986aff9747a30be9b75c72d09300f4ea8f8a496f8d15d8acc86e80805fe81a1dce4ce1ba621
7
+ data.tar.gz: 70025c3989baa3aa52a2d6563905eaea3afe6af9c2576ecb1af1207f94740e26a2bcdb6489ba8ba03c01787587e014b323296c0b0d3a322d7100f84072022c16
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.1.0
@@ -3,6 +3,11 @@
3
3
 
4
4
  $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
5
 
6
+ if [nil, '0', 'no', 'false'].include?(ENV['SCHMERSION_DISABLE_AUTO_BUNDLE_EXEC'])
7
+ require 'schmersion/auto_bundle_exec'
8
+ Schmersion::AutoBundleExec.when_bundled(:schmersion)
9
+ end
10
+
6
11
  require 'schmersion'
7
12
  require 'swamp/cli'
8
13
  require 'git'
@@ -24,7 +24,8 @@ command :pending do
24
24
  from: context.options[:from],
25
25
  to: context.options[:to],
26
26
  version_options: {
27
- pre: context.options[:pre]
27
+ pre: context.options[:pre],
28
+ breaking_change_not_major: repo.config.version_options[:breaking_change_not_major]
28
29
  }
29
30
  )
30
31
 
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+
5
+ module Schmersion
6
+ class AutoBundleExec
7
+
8
+ attr_reader :gems
9
+ attr_reader :pwd
10
+ attr_reader :bin
11
+ attr_reader :argv
12
+
13
+ def self.when_bundled(gems = [], pwd = Dir.pwd, bin = $PROGRAM_NAME, argv = ARGV)
14
+ return if ENV['BUNDLE_BIN_PATH']
15
+
16
+ gems = Array(gems).compact
17
+ return if gems.empty?
18
+
19
+ instance = new(gems, pwd, bin, argv)
20
+ return unless instance.bundled_dir?
21
+
22
+ instance.re_exec if gems.all? { |gem| instance.bundled?(gem) }
23
+ end
24
+
25
+ def initialize(gems, pwd, bin, argv)
26
+ @gems = gems
27
+ @pwd = pwd
28
+ @bin = bin
29
+ @argv = argv
30
+ check_dir
31
+ end
32
+
33
+ def bundled_dir?
34
+ @is_bundled_dir
35
+ end
36
+
37
+ def bundled?(gem)
38
+ gem_list.include?(" #{gem} ")
39
+ end
40
+
41
+ def re_exec
42
+ Kernel.exec(
43
+ { 'SCHMERSION_DISABLE_AUTO_BUNDLE_EXEC' => '1' },
44
+ 'bundle', 'exec', bin, *argv
45
+ )
46
+ end
47
+
48
+ private
49
+
50
+ attr_reader :gem_list
51
+
52
+ def check_dir
53
+ @gem_list, status = Open3.capture2e('bundle list')
54
+ @is_bundled_dir = status.success?
55
+ end
56
+
57
+ end
58
+ end
@@ -126,7 +126,7 @@ module Schmersion
126
126
 
127
127
  def hook_file_contents(command)
128
128
  <<~FILE
129
- #!/bin/bash
129
+ #!/usr/bin/env bash
130
130
 
131
131
  #{path_to_schmersion} #{command} $1 $2 $3
132
132
  FILE
@@ -95,17 +95,18 @@ module Schmersion
95
95
  return if skip?(:tag) && skip?(:commit)
96
96
 
97
97
  print 'Now run '
98
- print "git push --follow-tags origin #{@repo.current_branch}".cyan
98
+ print "git push --tags origin #{@repo.current_branch}".cyan
99
99
  puts ' to publish'
100
100
  end
101
101
 
102
102
  def version
103
103
  @version ||= begin
104
+ puts @repo.config.version_options
104
105
  @repo.pending_version(
105
106
  override_version: @options[:version],
106
107
  version_options: {
107
108
  pre: @options[:pre],
108
- breaking_change_not_major: @repo.config.version_options['breaking_change_not_major']
109
+ breaking_change_not_major: @repo.config.version_options[:breaking_change_not_major]
109
110
  }
110
111
  )[1]
111
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schmersion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
@@ -162,6 +162,7 @@ files:
162
162
  - cli/setup-linting.rb
163
163
  - cli/versions.rb
164
164
  - lib/schmersion.rb
165
+ - lib/schmersion/auto_bundle_exec.rb
165
166
  - lib/schmersion/commit.rb
166
167
  - lib/schmersion/commit_parser.rb
167
168
  - lib/schmersion/config.rb
@@ -183,7 +184,8 @@ files:
183
184
  - lib/schmersion/version.rb
184
185
  - lib/schmersion/version_calculator.rb
185
186
  homepage: https://github.com/krystal/schmersion
186
- licenses: []
187
+ licenses:
188
+ - MIT
187
189
  metadata: {}
188
190
  post_install_message:
189
191
  rdoc_options: []
@@ -193,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
195
  requirements:
194
196
  - - ">="
195
197
  - !ruby/object:Gem::Version
196
- version: '2.6'
198
+ version: '2.5'
197
199
  required_rubygems_version: !ruby/object:Gem::Requirement
198
200
  requirements:
199
201
  - - ">="