rubygems-tasks 0.2.5 → 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 +4 -4
- data/.github/workflows/ruby.yml +31 -0
- data/.gitignore +4 -2
- data/ChangeLog.md +20 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +114 -80
- data/Rakefile +6 -20
- data/gemspec.yml +13 -5
- data/lib/rubygems/tasks/build/gem.rb +5 -6
- data/lib/rubygems/tasks/build/tar.rb +5 -6
- data/lib/rubygems/tasks/build/task.rb +4 -2
- data/lib/rubygems/tasks/build/zip.rb +5 -6
- data/lib/rubygems/tasks/build.rb +61 -3
- data/lib/rubygems/tasks/console.rb +13 -10
- data/lib/rubygems/tasks/install.rb +4 -5
- data/lib/rubygems/tasks/printing.rb +2 -0
- data/lib/rubygems/tasks/project.rb +3 -1
- data/lib/rubygems/tasks/push.rb +20 -7
- data/lib/rubygems/tasks/release.rb +4 -5
- data/lib/rubygems/tasks/scm/push.rb +5 -6
- data/lib/rubygems/tasks/scm/status.rb +5 -6
- data/lib/rubygems/tasks/scm/tag.rb +9 -12
- data/lib/rubygems/tasks/scm.rb +52 -3
- data/lib/rubygems/tasks/sign/checksum.rb +21 -14
- data/lib/rubygems/tasks/sign/pgp.rb +5 -6
- data/lib/rubygems/tasks/sign/task.rb +4 -2
- data/lib/rubygems/tasks/sign.rb +42 -2
- data/lib/rubygems/tasks/task.rb +11 -3
- data/lib/rubygems/tasks.rb +67 -66
- data/rubygems-tasks.gemspec +1 -0
- data/spec/build_spec.rb +72 -0
- data/spec/console_spec.rb +45 -18
- data/spec/install_spec.rb +5 -1
- data/spec/project_spec.rb +19 -19
- data/spec/push_spec.rb +15 -3
- data/spec/scm/push_spec.rb +6 -6
- data/spec/scm/status_spec.rb +8 -12
- data/spec/scm/tag_spec.rb +18 -28
- data/spec/scm_spec.rb +72 -0
- data/spec/sign/pgp_spec.rb +1 -1
- data/spec/sign_spec.rb +52 -0
- data/spec/tasks_spec.rb +18 -191
- metadata +32 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c796aef54b6d54c6c4afcf50f0588ee2204a5fae8527cee9c4a53f1881bf32d
|
|
4
|
+
data.tar.gz: 275002c2d14b8d6198c23cafb9a348742117fb32addcec9bb9ce879a18d57161
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 322f40592b51da34f2d6c651214b84b8d5a2e97d49bf9e4b30a1c8a808a2e50698058544e65ff5904edee1ffd13fbc639e211d0132dc12610c9732a117349fa7
|
|
7
|
+
data.tar.gz: b8ecbb198b85d8163ea41c591b8c00efab9ad3c007946316743c35918c166078c5d4a20ee8df3da4496027dd2cd5e3aaa22f79998e21df5250b5a5d7bd240cb8
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [ push, pull_request ]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
tests:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
ruby:
|
|
12
|
+
- '3.0'
|
|
13
|
+
- '3.1'
|
|
14
|
+
- '3.2'
|
|
15
|
+
- '3.3'
|
|
16
|
+
- '3.4'
|
|
17
|
+
- '3.5'
|
|
18
|
+
- '4.0'
|
|
19
|
+
- jruby
|
|
20
|
+
- truffleruby
|
|
21
|
+
name: Ruby ${{ matrix.ruby }}
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v2
|
|
24
|
+
- name: Set up Ruby
|
|
25
|
+
uses: ruby/setup-ruby@v1
|
|
26
|
+
with:
|
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: bundle install --jobs 4 --retry 3
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: bundle exec rake test
|
data/.gitignore
CHANGED
data/ChangeLog.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
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
|
+
|
|
16
|
+
### 0.2.6 / 2023-09-07
|
|
17
|
+
|
|
18
|
+
* Fixed `rake install` so that it runs `gem install -q pkg/...` outside of the
|
|
19
|
+
Bundler environment, if currently running under Bundler.
|
|
20
|
+
|
|
1
21
|
### 0.2.5 / 2020-03-02
|
|
2
22
|
|
|
3
23
|
* Require Ruby >= 2.0.0.
|
data/Gemfile
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,127 +1,161 @@
|
|
|
1
1
|
# rubygems-tasks
|
|
2
2
|
|
|
3
|
-
[](https://github.com/postmodern/rubygems-tasks/actions/workflows/ruby.yml)
|
|
4
|
+
[](https://codeclimate.com/github/postmodern/rubygems-tasks)
|
|
4
5
|
|
|
5
6
|
* [Source](https://github.com/postmodern/rubygems-tasks)
|
|
6
|
-
* [
|
|
7
|
-
|
|
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)
|
|
8
10
|
|
|
9
11
|
## Description
|
|
10
12
|
|
|
11
|
-
rubygems-tasks provides
|
|
12
|
-
|
|
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.
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
Gem::Tasks.new
|
|
17
|
+
## Features
|
|
16
18
|
|
|
17
|
-
|
|
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.
|
|
18
33
|
|
|
19
|
-
|
|
20
|
-
to the project generator which you used to create the project.
|
|
21
|
-
Project generators have nothing to do with the Rake tasks used to build,
|
|
22
|
-
install and release a Ruby project.
|
|
34
|
+
## Requirements
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
forgetting to tag the release. Ruby Developers should have access to
|
|
28
|
-
**agnostic** and **unobtrusive** Rake tasks, to **automate** the release
|
|
29
|
-
process.
|
|
36
|
+
* [ruby] >= 2.0.0
|
|
37
|
+
* [rake] >= 10.0.0
|
|
38
|
+
* [irb] ~> 1.0
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
## Install
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
1. Add the following to the `Gemfile`:
|
|
34
43
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* Supports pushing gems to alternate [gem server]s.
|
|
39
|
-
* Supports optionally building `.tar.gz` and `.zip` archives.
|
|
40
|
-
* `build:tar`
|
|
41
|
-
* `build:zip`
|
|
42
|
-
* Supports [Git], [Mercurial] and [SubVersion] Source-Code-Managers
|
|
43
|
-
(SCMs).
|
|
44
|
-
* Supports creating PGP signed Git/Mercurial tags.
|
|
45
|
-
* Provides optional `sign` tasks for package integrity:
|
|
46
|
-
* `sign:checksum`
|
|
47
|
-
* `sign:pgp`
|
|
48
|
-
* Provides a `console` task, for jumping right into your code.
|
|
49
|
-
* Defines task aliases for users coming from [Jeweler] or [Hoe].
|
|
50
|
-
* ANSI coloured messages!
|
|
51
|
-
|
|
52
|
-
## Anti-Features
|
|
53
|
-
|
|
54
|
-
* **Does not** parse project metadata from the README or the ChangeLog.
|
|
55
|
-
* **Does not** generate or modify code.
|
|
56
|
-
* **Does not** automatically commit changes.
|
|
57
|
-
* **Does not** inject dependencies into gems.
|
|
58
|
-
* **Zero** dependencies.
|
|
44
|
+
```ruby
|
|
45
|
+
gem 'rubygems-tasks', '~> 0.3', require: false
|
|
46
|
+
```
|
|
59
47
|
|
|
60
|
-
|
|
48
|
+
2. Add the following to the `Rakefile`:
|
|
61
49
|
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
```ruby
|
|
51
|
+
require 'rubygems/tasks'
|
|
52
|
+
Gem::Tasks.new
|
|
53
|
+
```
|
|
64
54
|
|
|
65
|
-
##
|
|
55
|
+
## Synopsis
|
|
66
56
|
|
|
67
|
-
|
|
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
|
+
```
|
|
68
89
|
|
|
69
90
|
## Examples
|
|
70
91
|
|
|
71
|
-
|
|
92
|
+
Default configuration:
|
|
72
93
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
```ruby
|
|
95
|
+
require 'rubygems/tasks'
|
|
96
|
+
Gem::Tasks.new
|
|
97
|
+
```
|
|
76
98
|
|
|
77
|
-
|
|
99
|
+
Change the Ruby REPL for the `console` [Rake] task:
|
|
78
100
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
```ruby
|
|
102
|
+
Gem::Tasks.new do |tasks|
|
|
103
|
+
tasks.console.command = 'pry'
|
|
104
|
+
end
|
|
105
|
+
```
|
|
82
106
|
|
|
83
|
-
|
|
107
|
+
Enable pushing gems to an internal [gem server] instead of [rubygems.org]:
|
|
84
108
|
|
|
85
|
-
|
|
109
|
+
```ruby
|
|
110
|
+
Gem::Tasks.new do |tasks|
|
|
111
|
+
tasks.push.host = 'gems.company.internal'
|
|
112
|
+
end
|
|
113
|
+
```
|
|
86
114
|
|
|
87
|
-
|
|
115
|
+
Disable the `push` [Rake] task:
|
|
88
116
|
|
|
89
|
-
|
|
117
|
+
```ruby
|
|
118
|
+
Gem::Tasks.new(push: false)
|
|
119
|
+
```
|
|
90
120
|
|
|
91
|
-
Enable
|
|
121
|
+
Enable building `.tar.gz` and `.zip` source archives, in addition to the `.gem`
|
|
122
|
+
package:
|
|
92
123
|
|
|
93
|
-
|
|
124
|
+
```ruby
|
|
125
|
+
Gem::Tasks.new(build: {tar: true, zip: true})
|
|
126
|
+
```
|
|
94
127
|
|
|
95
|
-
|
|
128
|
+
Enable generating checksums and PGP signatures for built packages:
|
|
96
129
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Gem::Tasks::Sign::Checksum.new
|
|
101
|
-
Gem::Tasks::Console.new
|
|
130
|
+
```ruby
|
|
131
|
+
Gem::Tasks.new(sign: {checksum: true, pgp: true})
|
|
132
|
+
```
|
|
102
133
|
|
|
103
|
-
|
|
134
|
+
Selectively defining specific [Rake] tasks:
|
|
104
135
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
```
|
|
109
143
|
|
|
110
144
|
## Copyright
|
|
111
145
|
|
|
112
|
-
Copyright (c) 2011-
|
|
146
|
+
Copyright (c) 2011-2025 Hal Brodigan
|
|
113
147
|
|
|
114
148
|
See {file:LICENSE.txt} for details.
|
|
115
149
|
|
|
116
|
-
[Git]:
|
|
117
|
-
[Mercurial]:
|
|
118
|
-
[SubVersion]:
|
|
150
|
+
[Git]: https://git-scm.com/
|
|
151
|
+
[Mercurial]: https://www.mercurial-scm.org/
|
|
152
|
+
[SubVersion]: https://subversion.apache.org/
|
|
119
153
|
|
|
120
|
-
[
|
|
121
|
-
[Hoe]: https://github.com/seattlerb/hoe#readme
|
|
154
|
+
[Rake]: https://github.com/ruby/rake#readme
|
|
122
155
|
|
|
123
156
|
[rubygems.org]: https://rubygems.org/
|
|
124
157
|
[gem server]: https://github.com/rubygems/rubygems.org#readme
|
|
125
158
|
|
|
126
159
|
[ruby]: https://www.ruby-lang.org/
|
|
127
160
|
[rake]: https://rubygems.org/gems/rake
|
|
161
|
+
[irb]: https://rubygems.org/gems/irb
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
1
3
|
require 'rake'
|
|
2
4
|
|
|
3
5
|
lib_dir = File.expand_path('lib',File.dirname(__FILE__))
|
|
@@ -9,26 +11,10 @@ Gem::Tasks.new(
|
|
|
9
11
|
sign: {checksum: true, pgp: true}
|
|
10
12
|
)
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
require 'rspec/core/rake_task'
|
|
15
|
-
|
|
16
|
-
RSpec::Core::RakeTask.new
|
|
17
|
-
rescue LoadError
|
|
18
|
-
task :spec do
|
|
19
|
-
abort "Please run `gem install rspec` to install RSpec."
|
|
20
|
-
end
|
|
21
|
-
end
|
|
14
|
+
require 'rspec/core/rake_task'
|
|
15
|
+
RSpec::Core::RakeTask.new
|
|
22
16
|
task :test => :spec
|
|
23
17
|
task :default => :spec
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
require 'yard'
|
|
28
|
-
|
|
29
|
-
YARD::Rake::YardocTask.new
|
|
30
|
-
rescue LoadError => e
|
|
31
|
-
task :yard do
|
|
32
|
-
abort 'Please run `gem install yard` to install YARD.'
|
|
33
|
-
end
|
|
34
|
-
end
|
|
19
|
+
require 'yard'
|
|
20
|
+
YARD::Rake::YardocTask.new
|
data/gemspec.yml
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
name: rubygems-tasks
|
|
2
|
-
version: 0.
|
|
3
|
-
summary: Rake tasks for
|
|
2
|
+
version: 0.3.0
|
|
3
|
+
summary: Rake tasks for building and releasing Ruby Gems.
|
|
4
4
|
description: |
|
|
5
|
-
|
|
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
|
|
@@ -10,11 +12,17 @@ email: postmodern.mod3@gmail.com
|
|
|
10
12
|
homepage: https://github.com/postmodern/rubygems-tasks#readme
|
|
11
13
|
has_yard: true
|
|
12
14
|
|
|
15
|
+
metadata:
|
|
16
|
+
documentation_uri: https://rubydoc.info/gems/rubygems-tasks
|
|
17
|
+
source_code_uri: https://github.com/postmodern/rubygems-tasks
|
|
18
|
+
bug_tracker_uri: https://github.com/postmodern/rubygems-tasks/issues
|
|
19
|
+
changelog_uri: https://github.com/postmodern/rubygems-tasks/blob/master/ChangeLog.md
|
|
20
|
+
|
|
13
21
|
required_ruby_version: ">= 2.0.0"
|
|
14
22
|
|
|
15
23
|
dependencies:
|
|
24
|
+
rake: ">= 10.0.0"
|
|
16
25
|
irb: ~> 1.0
|
|
17
26
|
|
|
18
27
|
development_dependencies:
|
|
19
|
-
|
|
20
|
-
yard: ~> 0.8
|
|
28
|
+
bundler: ">= 2.0.0"
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'task'
|
|
2
4
|
|
|
3
5
|
module Gem
|
|
4
6
|
class Tasks
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'task'
|
|
2
4
|
|
|
3
5
|
module Gem
|
|
4
6
|
class Tasks
|
|
5
|
-
|
|
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
|
-
|
|
15
|
-
# Additional options.
|
|
16
|
-
#
|
|
17
|
-
def initialize(options={})
|
|
16
|
+
def initialize
|
|
18
17
|
super()
|
|
19
18
|
|
|
20
19
|
yield self if block_given?
|
data/lib/rubygems/tasks/build.rb
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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 [
|
|
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
|
-
# @
|
|
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 =
|
|
38
|
-
@options =
|
|
40
|
+
@command = command
|
|
41
|
+
@options = options
|
|
39
42
|
|
|
40
43
|
yield self if block_given?
|
|
41
44
|
define
|
|
@@ -78,7 +81,7 @@ module Gem
|
|
|
78
81
|
arguments.push(*require_paths.map { |dir| "-I#{dir}" })
|
|
79
82
|
|
|
80
83
|
# add an -r option to require the library
|
|
81
|
-
arguments.push(
|
|
84
|
+
arguments.push("-r#{require_file}")
|
|
82
85
|
|
|
83
86
|
# push on additional options
|
|
84
87
|
arguments.push(*@options)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
14
|
-
# Additional options.
|
|
15
|
-
#
|
|
16
|
-
def initialize(options={})
|
|
15
|
+
def initialize
|
|
17
16
|
super()
|
|
18
17
|
|
|
19
18
|
yield self if block_given?
|