rubygems-tasks 0.2.6 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be886af586a0508f6dbe548247677067920db2f38b4590c4cd54f3b96b0449ee
4
- data.tar.gz: 7d3c7deb140448cfebfba8ebbf184eccfe4bc167823f2088192c5e4f0f69acc3
3
+ metadata.gz: 4c796aef54b6d54c6c4afcf50f0588ee2204a5fae8527cee9c4a53f1881bf32d
4
+ data.tar.gz: 275002c2d14b8d6198c23cafb9a348742117fb32addcec9bb9ce879a18d57161
5
5
  SHA512:
6
- metadata.gz: a5906ece048555085e8ec9b5959f262c3d642ee28d8001f8f42221ce53a1c76e39ce41a5e18cdafae1c8ed67fa1ef97b009a28f66b0223c117efba4d78e44f7c
7
- data.tar.gz: '038f3abd105da7c5705632c4e65dc3d268567da424bb5e74411b667b93a940a3ff563a801e2ddee32959d7514e4ba821b39e8db0797fce7819814cd8498b2b9a'
6
+ metadata.gz: 322f40592b51da34f2d6c651214b84b8d5a2e97d49bf9e4b30a1c8a808a2e50698058544e65ff5904edee1ffd13fbc639e211d0132dc12610c9732a117349fa7
7
+ data.tar.gz: b8ecbb198b85d8163ea41c591b8c00efab9ad3c007946316743c35918c166078c5d4a20ee8df3da4496027dd2cd5e3aaa22f79998e21df5250b5a5d7bd240cb8
@@ -9,9 +9,13 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  ruby:
12
- - 3.0
13
- - 3.1
14
- - 3.2
12
+ - '3.0'
13
+ - '3.1'
14
+ - '3.2'
15
+ - '3.3'
16
+ - '3.4'
17
+ - '3.5'
18
+ - '4.0'
15
19
  - jruby
16
20
  - truffleruby
17
21
  name: Ruby ${{ matrix.ruby }}
data/ChangeLog.md CHANGED
@@ -1,3 +1,18 @@
1
+ ### 0.3.0 / 2025-11-28
2
+
3
+ * Added support for Ruby 3.5 and 4.0.
4
+ * Fixed `ostruct` warnings by refactoring code to use plain-Ruby classes
5
+ instead of `OpenStruct`.
6
+ * {Gem::Tasks::Build} is now a class that can be initialized and will
7
+ define all `build:` sub-tasks.
8
+ * {Gem::Tasks::SCM} is now a class that can be initialized and will define
9
+ all `scm:` sub-tasks.
10
+ * {Gem::Tasks::Sign} is now a class that can be initialized and will define
11
+ all `sign:` sub-tasks.
12
+ * {Gem::Tasks::Push#initialize} now accepts the `key:` keyword argument.
13
+ * Switched to keyword arguments.
14
+ * Added `frozen_string_literal: true` to all files.
15
+
1
16
  ### 0.2.6 / 2023-09-07
2
17
 
3
18
  * Fixed `rake install` so that it runs `gem install -q pkg/...` outside of the
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ gemspec
5
5
  group :development do
6
6
  gem 'rake'
7
7
  gem 'rspec', '~> 3.0'
8
+ gem 'redcarpet', platform: :mri
8
9
  gem 'kramdown'
9
10
  gem 'yard', '~> 0.9'
11
+ gem 'yard-spellcheck', require: false
10
12
  end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2020 Hal Brodigan
1
+ Copyright (c) 2011-2025 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -4,125 +4,158 @@
4
4
  [![Code Climate](https://codeclimate.com/github/postmodern/rubygems-tasks.svg)](https://codeclimate.com/github/postmodern/rubygems-tasks)
5
5
 
6
6
  * [Source](https://github.com/postmodern/rubygems-tasks)
7
- * [Issues](https://github.com/postmodern/rubygems-tasks/issues)
8
- * [Email](mailto:postmodern.mod3 at gmail.com)
7
+ * [Forum](https://github.com/postmodern/rubygems-tasks/discussions) |
8
+ [Issues](https://github.com/postmodern/rubygems-tasks/issues)
9
+ * [Documentation](https://rubydoc.info/gems/rubygems-tasks)
9
10
 
10
11
  ## Description
11
12
 
12
- rubygems-tasks provides agnostic and unobtrusive Rake tasks for building,
13
- installing and releasing Ruby Gems.
13
+ rubygems-tasks provides [Rake] tasks for building and releasing Ruby Gems.
14
+ rubygems-tasks can be added to any Ruby project that has a `Rakefile` and a
15
+ `.gemspec` file.
14
16
 
15
- require 'rubygems/tasks'
16
- Gem::Tasks.new
17
+ ## Features
17
18
 
18
- ## Philosophy
19
+ * Provides [Rake] tasks to build, install, or release gem packages to
20
+ [rubygems.org].
21
+ * Supports pushing gem packages to internal [gem servers].
22
+ * Additionally supports creating `.tar.gz` of `.zip` source archives.
23
+ * Loads all project metadata from the `.gemspec` file.
24
+ * Supports Ruby projects with multiple `.gemspec` files.
25
+ * Supports [Git], [Mercurial], [SubVersion], or even no SCM at all.
26
+ * Enforces important safety checks:
27
+ * Checks for uncommitted changes before building a gem.
28
+ * Pushes all commits and tags before pushing a gem.
29
+ * Provides additional enhanced security features:
30
+ * Supports optionally creating PGP signed [Git] or [Mercurial] tags.
31
+ * Supports optionally generating checksums or PGP signatures of the `.gem`
32
+ package.
19
33
 
20
- The Rake tasks which you use to manage a Ruby project should not be coupled
21
- to the project generator which you used to create the project.
22
- Project generators have nothing to do with the Rake tasks used to build,
23
- install and release a Ruby project.
34
+ ## Requirements
24
35
 
25
- Recently, many Ruby Developers began creating Ruby projects by hand,
26
- building/releasing RubyGems using `gem build` / `gem push`. Sometimes this
27
- resulted in RubyGems being released with uncommitted changes, or the developer
28
- forgetting to tag the release. Ruby Developers should have access to
29
- **agnostic** and **unobtrusive** Rake tasks, to **automate** the release
30
- process.
36
+ * [ruby] >= 2.0.0
37
+ * [rake] >= 10.0.0
38
+ * [irb] ~> 1.0
31
39
 
32
- This is what rubygems-tasks seeks to provide.
40
+ ## Install
33
41
 
34
- ## Features
42
+ 1. Add the following to the `Gemfile`:
35
43
 
36
- * Provides tasks to build, install and push gems to [rubygems.org].
37
- * Loads all project metadata from the `.gemspec` file.
38
- * Supports loading multiple `.gemspec` files.
39
- * Supports pushing gems to alternate [gem server]s.
40
- * Supports optionally building `.tar.gz` and `.zip` archives.
41
- * `build:tar`
42
- * `build:zip`
43
- * Supports [Git], [Mercurial] and [SubVersion] Source-Code-Managers
44
- (SCMs).
45
- * Supports creating PGP signed Git/Mercurial tags.
46
- * Provides optional `sign` tasks for package integrity:
47
- * `sign:checksum`
48
- * `sign:pgp`
49
- * Provides a `console` task, for jumping right into your code.
50
- * Defines task aliases for users coming from [Jeweler] or [Hoe].
51
- * ANSI coloured messages!
52
-
53
- ## Anti-Features
54
-
55
- * **Does not** parse project metadata from the README or the ChangeLog.
56
- * **Does not** generate or modify code.
57
- * **Does not** automatically commit changes.
58
- * **Does not** inject dependencies into gems.
59
- * **Zero** dependencies.
44
+ ```ruby
45
+ gem 'rubygems-tasks', '~> 0.3', require: false
46
+ ```
60
47
 
61
- ## Requirements
48
+ 2. Add the following to the `Rakefile`:
62
49
 
63
- * [ruby] >= 2.0.0
64
- * [rake]
50
+ ```ruby
51
+ require 'rubygems/tasks'
52
+ Gem::Tasks.new
53
+ ```
65
54
 
66
- ## Install
55
+ ## Synopsis
67
56
 
68
- $ gem install rubygems-tasks
57
+ ```
58
+ rake build # Builds all packages
59
+ rake console # Spawns an Interactive Ruby Console
60
+ rake install # Installs all built gem packages
61
+ rake release # Performs a release
62
+ ```
63
+
64
+ Perform a test build of the project and write all build artifacts to the
65
+ `pkg/` directory:
66
+
67
+ ```
68
+ $ rake build
69
+ ```
70
+
71
+ Jump into IRB with the Ruby library preloaded:
72
+
73
+ ```
74
+ $ rake console
75
+ irb(main):001>
76
+ ```
77
+
78
+ Build and install the Ruby gem locally:
79
+
80
+ ```
81
+ $ rake install
82
+ ```
83
+
84
+ Build, tag, and release a new version:
85
+
86
+ ```
87
+ $ rake release
88
+ ```
69
89
 
70
90
  ## Examples
71
91
 
72
- Specifying an alternate Ruby Console to run:
92
+ Default configuration:
73
93
 
74
- Gem::Tasks.new do |tasks|
75
- tasks.console.command = 'pry'
76
- end
94
+ ```ruby
95
+ require 'rubygems/tasks'
96
+ Gem::Tasks.new
97
+ ```
77
98
 
78
- Enable pushing gems to an in-house [gem server]:
99
+ Change the Ruby REPL for the `console` [Rake] task:
79
100
 
80
- Gem::Tasks.new do |tasks|
81
- tasks.push.host = 'gems.company.com'
82
- end
101
+ ```ruby
102
+ Gem::Tasks.new do |tasks|
103
+ tasks.console.command = 'pry'
104
+ end
105
+ ```
83
106
 
84
- Disable the `push` task:
107
+ Enable pushing gems to an internal [gem server] instead of [rubygems.org]:
85
108
 
86
- Gem::Tasks.new(push: false)
109
+ ```ruby
110
+ Gem::Tasks.new do |tasks|
111
+ tasks.push.host = 'gems.company.internal'
112
+ end
113
+ ```
87
114
 
88
- Enable building `.tar.gz` and `.zip` archives:
115
+ Disable the `push` [Rake] task:
89
116
 
90
- Gem::Tasks.new(build: {tar: true, zip: true})
117
+ ```ruby
118
+ Gem::Tasks.new(push: false)
119
+ ```
91
120
 
92
- Enable Checksums and PGP signatures for built packages:
121
+ Enable building `.tar.gz` and `.zip` source archives, in addition to the `.gem`
122
+ package:
93
123
 
94
- Gem::Tasks.new(sign: {checksum: true, pgp: true})
124
+ ```ruby
125
+ Gem::Tasks.new(build: {tar: true, zip: true})
126
+ ```
95
127
 
96
- Selectively defining tasks:
128
+ Enable generating checksums and PGP signatures for built packages:
97
129
 
98
- Gem::Tasks::Build::Tar.new
99
- Gem::Tasks::SCM::Status.new
100
- Gem::Tasks::SCM::Tag.new(format: 'REL-%s')
101
- Gem::Tasks::Sign::Checksum.new
102
- Gem::Tasks::Console.new
130
+ ```ruby
131
+ Gem::Tasks.new(sign: {checksum: true, pgp: true})
132
+ ```
103
133
 
104
- ## Synopsis
134
+ Selectively defining specific [Rake] tasks:
105
135
 
106
- rake build # Builds all packages
107
- rake console # Spawns an Interactive Ruby Console
108
- rake install # Installs all built gem packages
109
- rake release # Performs a release
136
+ ```ruby
137
+ Gem::Tasks::Build::Tar.new
138
+ Gem::Tasks::SCM::Status.new
139
+ Gem::Tasks::SCM::Tag.new(format: 'REL-%s')
140
+ Gem::Tasks::Sign::Checksum.new
141
+ Gem::Tasks::Console.new
142
+ ```
110
143
 
111
144
  ## Copyright
112
145
 
113
- Copyright (c) 2011-2020 Hal Brodigan
146
+ Copyright (c) 2011-2025 Hal Brodigan
114
147
 
115
148
  See {file:LICENSE.txt} for details.
116
149
 
117
- [Git]: http://git-scm.com/
118
- [Mercurial]: http://mercurial.selenic.com/
119
- [SubVersion]: http://subversion.tigris.org/
150
+ [Git]: https://git-scm.com/
151
+ [Mercurial]: https://www.mercurial-scm.org/
152
+ [SubVersion]: https://subversion.apache.org/
120
153
 
121
- [Jeweler]: https://github.com/technicalpickles/jeweler#readme
122
- [Hoe]: https://github.com/seattlerb/hoe#readme
154
+ [Rake]: https://github.com/ruby/rake#readme
123
155
 
124
156
  [rubygems.org]: https://rubygems.org/
125
157
  [gem server]: https://github.com/rubygems/rubygems.org#readme
126
158
 
127
159
  [ruby]: https://www.ruby-lang.org/
128
160
  [rake]: https://rubygems.org/gems/rake
161
+ [irb]: https://rubygems.org/gems/irb
data/gemspec.yml CHANGED
@@ -1,8 +1,10 @@
1
1
  name: rubygems-tasks
2
- version: 0.2.6
3
- summary: Rake tasks for managing and releasing Ruby Gems.
2
+ version: 0.3.0
3
+ summary: Rake tasks for building and releasing Ruby Gems.
4
4
  description: |
5
- Agnostic and unobtrusive Rake tasks for managing and releasing Ruby Gems.
5
+ rubygems-tasks provides agnostic and unobtrusive Rake tasks for building and
6
+ releasing Ruby Gems. rubygems-tasks can be used in any existing Ruby project
7
+ that has a .gemspec file.
6
8
 
7
9
  authors: Postmodern
8
10
  license: MIT
@@ -23,4 +25,4 @@ dependencies:
23
25
  irb: ~> 1.0
24
26
 
25
27
  development_dependencies:
26
- bundler: ~> 2.0
28
+ bundler: ">= 2.0.0"
@@ -1,4 +1,6 @@
1
- require 'rubygems/tasks/build/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  if Gem::VERSION > '2.' then require 'rubygems/package'
4
6
  else require 'rubygems/builder'
@@ -6,7 +8,7 @@ end
6
8
 
7
9
  module Gem
8
10
  class Tasks
9
- module Build
11
+ class Build
10
12
  #
11
13
  # The `build:gem` task.
12
14
  #
@@ -15,10 +17,7 @@ module Gem
15
17
  #
16
18
  # Initializes the `build:gem` task.
17
19
  #
18
- # @param [Hash] options
19
- # Additional options.
20
- #
21
- def initialize(options={})
20
+ def initialize
22
21
  super()
23
22
 
24
23
  yield self if block_given?
@@ -1,8 +1,10 @@
1
- require 'rubygems/tasks/build/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
5
- module Build
7
+ class Build
6
8
  #
7
9
  # The `build:tar` task.
8
10
  #
@@ -11,10 +13,7 @@ module Gem
11
13
  #
12
14
  # Initializes the `build:tar` task.
13
15
  #
14
- # @param [Hash] options
15
- # Additional options.
16
- #
17
- def initialize(options={})
16
+ def initialize
18
17
  super()
19
18
 
20
19
  yield self if block_given?
@@ -1,8 +1,10 @@
1
- require 'rubygems/tasks/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
5
- module Build
7
+ class Build
6
8
  class Task < Tasks::Task
7
9
 
8
10
  #
@@ -1,8 +1,10 @@
1
- require 'rubygems/tasks/build/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
5
- module Build
7
+ class Build
6
8
  #
7
9
  # The `build:zip` task.
8
10
  #
@@ -11,10 +13,7 @@ module Gem
11
13
  #
12
14
  # Initializes the `build:zip` task.
13
15
  #
14
- # @param [Hash] options
15
- # Additional options.
16
- #
17
- def initialize(options={})
16
+ def initialize
18
17
  super()
19
18
 
20
19
  yield self if block_given?
@@ -1,3 +1,61 @@
1
- require 'rubygems/tasks/build/tar'
2
- require 'rubygems/tasks/build/gem'
3
- require 'rubygems/tasks/build/zip'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'build/tar'
4
+ require_relative 'build/gem'
5
+ require_relative 'build/zip'
6
+
7
+ module Gem
8
+ class Tasks
9
+ #
10
+ # Collection of all `build:*` tasks.
11
+ #
12
+ # * {Build::Gem build:gem}
13
+ # * {Build::Tar build:tar}
14
+ # * {Build::Zip build:zip}
15
+ #
16
+ class Build
17
+
18
+ # The {Gem build:gem} task.
19
+ #
20
+ # @return [Gem, nil]
21
+ #
22
+ # @since 0.3.0
23
+ attr_reader :gem
24
+
25
+ # The {Tar build:tar} task.
26
+ #
27
+ # @return [Tar, nil]
28
+ #
29
+ # @since 0.3.0
30
+ attr_reader :tar
31
+
32
+ # The {Zip build:zip} task.
33
+ #
34
+ # @return [Zip, nil]
35
+ #
36
+ # @since 0.3.0
37
+ attr_reader :zip
38
+
39
+ #
40
+ # Initializes the `build:` tasks.
41
+ #
42
+ # @param [Boolean] gem
43
+ # Enables or disables the {Build::Gem build:gem} task.
44
+ #
45
+ # @param [Boolean] tar
46
+ # Enables or disables the {Build::Tar build:tar} task.
47
+ #
48
+ # @param [Boolean] zip
49
+ # Enables or disables the {Build::Zip build:zip} task.
50
+ #
51
+ # @since 0.3.0
52
+ #
53
+ def initialize(gem: true, tar: nil, zip: nil)
54
+ @gem = Gem.new if gem
55
+ @tar = Tar.new if tar
56
+ @zip = Zip.new if zip
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -1,4 +1,6 @@
1
- require 'rubygems/tasks/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
@@ -14,28 +16,29 @@ module Gem
14
16
  DEFAULT_COMMAND = (ENV['RUBYCONSOLE'] || DEFAULT_CONSOLE)
15
17
 
16
18
  # The Ruby Console command
19
+ #
20
+ # @return [String]
17
21
  attr_accessor :command
18
22
 
19
23
  # Additional options for the Ruby Console
24
+ #
25
+ # @return [Array<String>]
20
26
  attr_accessor :options
21
27
 
22
28
  #
23
29
  # Initializes the `console` task.
24
30
  #
25
- # @param [Hash] options
26
- # Additional options.
27
- #
28
- # @option options [String] :command (DEFAULT_COMMAND)
31
+ # @param [String] command
29
32
  # The Ruby Console command to run.
30
33
  #
31
- # @option options [Array] :options
34
+ # @param [Array<String>] options
32
35
  # Additional options for the Ruby Console.
33
36
  #
34
- def initialize(options={})
37
+ def initialize(command: DEFAULT_COMMAND, options: [])
35
38
  super()
36
39
 
37
- @command = options.fetch(:command,DEFAULT_COMMAND)
38
- @options = Array(options[:options])
40
+ @command = command
41
+ @options = options
39
42
 
40
43
  yield self if block_given?
41
44
  define
@@ -1,4 +1,6 @@
1
- require 'rubygems/tasks/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
@@ -10,10 +12,7 @@ module Gem
10
12
  #
11
13
  # Initializes the `install` task.
12
14
  #
13
- # @param [Hash] options
14
- # Additional options.
15
- #
16
- def initialize(options={})
15
+ def initialize
17
16
  super()
18
17
 
19
18
  yield self if block_given?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gem
2
4
  class Tasks
3
5
  #
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
5
  module Gem
4
6
  class Tasks
5
7
  #
6
- # @api semipublic
8
+ # @api private
7
9
  #
8
10
  class Project
9
11
 
@@ -1,4 +1,6 @@
1
- require 'rubygems/tasks/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
@@ -8,21 +10,31 @@ module Gem
8
10
  class Push < Task
9
11
 
10
12
  # The rubygems host to push gems to.
13
+ #
14
+ # @return [String, nil]
11
15
  attr_accessor :host
12
16
 
17
+ # The rubygems API key.
13
18
  #
14
- # Initializes the `push` task.
19
+ # @return [String, nil]
15
20
  #
16
- # @param [Hash] options
17
- # Additional options.
21
+ # @since 0.3.0
22
+ attr_accessor :key
23
+
18
24
  #
19
- # @option options [String] :host
25
+ # Initializes the `push` task.
26
+ #
27
+ # @param [String, nil] host
20
28
  # The rubygems host to push gems to.
21
29
  #
22
- def initialize(options={})
30
+ # @param [String, nil] key
31
+ # An optional rubygems API key.
32
+ #
33
+ def initialize(host: nil, key: nil)
23
34
  super()
24
35
 
25
- @host = options[:host]
36
+ @host = host
37
+ @key = key
26
38
 
27
39
  yield self if block_given?
28
40
  define
@@ -69,6 +81,7 @@ module Gem
69
81
  #
70
82
  def push(path)
71
83
  arguments = ['gem', 'push', path]
84
+ arguments.push('--key', @key) if @key
72
85
  arguments.push('--host', @host) if @host
73
86
 
74
87
  return run(*arguments)
@@ -1,4 +1,6 @@
1
- require 'rubygems/tasks/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
@@ -10,10 +12,7 @@ module Gem
10
12
  #
11
13
  # Initializes the `release` task.
12
14
  #
13
- # @param [Hash] options
14
- # Additional options for the `release` task.
15
- #
16
- def initialize(options={})
15
+ def initialize
17
16
  super()
18
17
 
19
18
  yield self if block_given?
@@ -1,8 +1,10 @@
1
- require 'rubygems/tasks/task'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../task'
2
4
 
3
5
  module Gem
4
6
  class Tasks
5
- module SCM
7
+ class SCM
6
8
  #
7
9
  # The `scm:push` task.
8
10
  #
@@ -11,10 +13,7 @@ module Gem
11
13
  #
12
14
  # Initializes the `scm:push` task.
13
15
  #
14
- # @param [Hash] options
15
- # Additional options.
16
- #
17
- def initialize(options={})
16
+ def initialize
18
17
  super()
19
18
 
20
19
  yield self if block_given?