bake-bundler 0.1.0 → 0.3.3

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: 3941301d7c18a70facd801d775a2c790148f1a44ef55051c5534573daef0d718
4
- data.tar.gz: '08baac5d1674e2deec4000dd67703029c4a40c41a8e4d9e163277087eba60009'
3
+ metadata.gz: cdf1d8c97869fe6d1134df6ffbcfd3541970efa673b81074d7f12ec69ec24f8a
4
+ data.tar.gz: 1a6b73ecf3ce8601311e3ba018300d96914a8d313efd9012feb4c24b0563beef
5
5
  SHA512:
6
- metadata.gz: ac6315e94eea735104cddc272240e35a4cb0357479f3c05c7d743b9093a2ea9af29cbd17c2cad29356782f30d56d50b848fb3182f9474f17e3fac832f830d81b
7
- data.tar.gz: 45634c01ec7d8b5fadc4ee1f0d1205f28a326d43b9de1dfebb9ab5a049d4688de23dadcfa95d81293390ab75ad61de4f4c06f1a3f2adb48557bd880ccdde0864
6
+ metadata.gz: 6a98e46c84082ddfaf476b62b4b7e7452651e7ab815697ed12f15611c437204e1bf3fdf2c13973bfdae619eb3df14fb1e945879f26b2ae479304364232370668
7
+ data.tar.gz: 4bae74ce05eb65f128c8b5d1a60672ef200bdc291de0033c62ad5a56ae02f76855937cd323729130b00a46d061dc93854ffe90f69192719faccdf76516ef2d63
@@ -8,13 +8,15 @@ def initialize(context)
8
8
  @built_gem_path = nil
9
9
  end
10
10
 
11
+ attr :helper
12
+
11
13
  # Build the gem into the pkg directory.
12
14
  def build
13
15
  @built_gem_path ||= @helper.build_gem
14
16
  end
15
17
 
16
18
  # Build and install the gem into system gems.
17
- # @param local [Boolean] only use locally available caches.
19
+ # @parameter local [Boolean] only use locally available caches.
18
20
  def install(local: false)
19
21
  path = self.build
20
22
 
@@ -37,8 +39,3 @@ def release(remote: nil)
37
39
  end
38
40
  end
39
41
 
40
- private
41
-
42
- def instance
43
-
44
- end
@@ -0,0 +1,78 @@
1
+
2
+ # Increment the patch number of the current version.
3
+ def patch
4
+ release([nil, nil, 1], message: "Patch version bump.")
5
+ end
6
+
7
+ # Increment the minor number of the current version.
8
+ def minor
9
+ release([nil, 1, 0], message: "Minor version bump.")
10
+ end
11
+
12
+ # Increment the major number of the current version.
13
+ def major
14
+ release([1, 0, 0], message: "Major version bump.")
15
+ end
16
+
17
+ VERSION_PATTERN = /VERSION = ['"](?<value>\d+\.\d+\.\d+)(?<pre>.*?)['"]/
18
+
19
+ # Scans the files listed in the gemspec for a file named `version.rb`. Extracts the VERSION constant and updates it according to the version bump. Commits the changes to git using the specified message.
20
+ #
21
+ # @parameter bump [Array(Integer | Nil)] the version bump to apply before publishing, e.g. `0,1,0` to increment minor version number.
22
+ # @parameter message [String] the git commit message to use.
23
+ def increment(bump, message: "Bump version.")
24
+ release = context.lookup('bundler:release')
25
+ helper = release.instance.helper
26
+ gemspec = helper.gemspec
27
+
28
+ version_path = gemspec.files.grep(/version.rb/).first
29
+
30
+ Console.logger.info(self) {"Preparing to update #{version_path}..."}
31
+
32
+ lines = File.readlines(version_path)
33
+ version = nil
34
+
35
+ lines.each do |line|
36
+ if match = line.match(VERSION_PATTERN)
37
+ version = match[:value].split(/\./).map(&:to_i)
38
+ bump.each_with_index do |increment, index|
39
+ if increment == 1
40
+ version[index] += 1
41
+ elsif increment == 0
42
+ version[index] = 0
43
+ end
44
+ end
45
+
46
+ line.sub!(match[:value], version.join('.'))
47
+ end
48
+ end
49
+
50
+ if version
51
+ File.write(version_path, lines.join)
52
+
53
+ system("git", "add", version_path, chdir: context.root)
54
+ system("git", "commit", "-m", message, chdir: context.root)
55
+
56
+ version_string = version.join('.')
57
+
58
+ Console.logger.info(self) {"Updated version to #{version_string}"}
59
+
60
+ # Ensure that any subsequent tasks use the correct version!
61
+ gemspec.version = Gem::Version.new(version_string)
62
+ else
63
+ raise "Could not find version number!"
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ def release(*arguments, **options)
70
+ release = context.lookup('bundler:release')
71
+ helper = release.instance.helper
72
+
73
+ helper.guard_clean
74
+
75
+ increment(*arguments, **options)
76
+
77
+ release.call
78
+ end
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Bake
24
24
  module Bundler
25
- VERSION = "0.1.0"
25
+ VERSION = "0.3.3"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-25 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bake
@@ -16,34 +16,45 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
27
- description:
26
+ version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
28
42
  email:
29
- - samuel.williams@oriontransfer.co.nz
30
43
  executables: []
31
44
  extensions: []
32
45
  extra_rdoc_files: []
33
46
  files:
34
- - ".gitignore"
35
- - ".rspec"
36
- - Gemfile
37
- - README.md
38
- - bake-bundler.gemspec
39
47
  - bake/bundler.rb
48
+ - bake/bundler/release.rb
40
49
  - lib/bake/bundler.rb
41
50
  - lib/bake/bundler/helper.rb
42
51
  - lib/bake/bundler/version.rb
43
52
  homepage: https://github.com/ioquatix/bake-bundler
44
- licenses: []
45
- metadata: {}
46
- post_install_message:
53
+ licenses:
54
+ - MIT
55
+ metadata:
56
+ funding_uri: https://github.com/sponsors/ioquatix/
57
+ post_install_message:
47
58
  rdoc_options: []
48
59
  require_paths:
49
60
  - lib
@@ -58,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
69
  - !ruby/object:Gem::Version
59
70
  version: '0'
60
71
  requirements: []
61
- rubygems_version: 3.0.6
62
- signing_key:
72
+ rubygems_version: 3.1.2
73
+ signing_key:
63
74
  specification_version: 4
64
75
  summary: Provides recipes for bundler.
65
76
  test_files: []
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
- Gemfile.lock
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in bake-bundler.gemspec
4
- gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
data/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Bake::Bundler
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bake/bundler`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'bake-bundler'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install bake-bundler
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bake-bundler.
36
-
@@ -1,23 +0,0 @@
1
- require_relative 'lib/bake/bundler/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "bake-bundler"
5
- spec.version = Bake::Bundler::VERSION
6
- spec.authors = ["Samuel Williams"]
7
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
8
-
9
- spec.summary = "Provides recipes for bundler."
10
- spec.homepage = "https://github.com/ioquatix/bake-bundler"
11
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12
-
13
- # Specify which files should be added to the gem when it is released.
14
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
15
- spec.files = Dir.chdir(__dir__) do
16
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- end
18
-
19
- spec.add_dependency "bake", "~> 0.7"
20
-
21
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
- end