github_pages_rake_tasks 0.1.8 → 1.0.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: 71feedbea3a7b3a3ba77e353c1afff5149689dc04a855bff133535efb00d4fa5
4
- data.tar.gz: 8fa5b5affc6d89da6d566a71e5ba85de9266194371cc5d443c8a8ee2f9d228f1
3
+ metadata.gz: 5541ed2a422cd3fe262be2061d1e7f0c6225e469dec6d1215f865168ce80c7cd
4
+ data.tar.gz: 4bc38f4786a10802f6527f1d8df83c085f8c5343bcd65d4d67cf4eac4142dc83
5
5
  SHA512:
6
- metadata.gz: f7523979ac5e454688786d078193382b9f4f4b1ed1ac5cfc4d61637599a3be401fdfeaca0c0441bc012f24aee504c98a9f86a3c73e41b99f2d48a591fb2b6d67
7
- data.tar.gz: 1c7435fedb69c97a1c06d30bb4ef98e7ccee977fe51695f95d34024c138b0dbc22eb9a9dc3479df0795b0345fe222fd5bc9b1374f73ff248571641d2524f410d
6
+ metadata.gz: 1f94b5089c57ad51ae001305f5c22dcf2bc3be20b227dd9dc48c2f8fb210d296393ab113e9ac2d3535e93f47d7c2b35e9449d69f382d58bf7b84e5d25e8ea8fa
7
+ data.tar.gz: 12e17641ad37b04cf1c96c52cd163dba6d3584cbfbd8407fc2c28248d739463431b3d0acb1de1d8b994889578edef971ad82ac47fd9f67a18b7a47b5384076d5
@@ -0,0 +1,4 @@
1
+ # Defines who must review pull requests.
2
+ # See https://help.github.com/articles/about-codeowners/ for details.
3
+
4
+ * @jcouball @main-branch/github_pages_rake_tasks-codeowners
@@ -0,0 +1,64 @@
1
+ name: CI Build
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+ pull_request:
8
+ branches: [ main ]
9
+
10
+ jobs:
11
+ build:
12
+ continue-on-error: true
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby: ['3.0', '3.2', head, jruby-head]
17
+ operating-system: [ubuntu-latest]
18
+ include:
19
+ - ruby: '3.0'
20
+ operating-system: windows-latest
21
+ - ruby: jruby-head
22
+ operating-system: windows-latest
23
+
24
+ name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
25
+ runs-on: ${{ matrix.operating-system }}
26
+
27
+ steps:
28
+ - name: Checkout
29
+ uses: actions/checkout@v3
30
+
31
+ - name: Initialize Ruby
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ bundler-cache: true
36
+
37
+ - name: Run rake
38
+ run: bundle exec rake
39
+
40
+ coverage:
41
+ needs: [ build ]
42
+ runs-on: ubuntu-latest
43
+
44
+ name: Report test coverage to CodeClimate
45
+
46
+ steps:
47
+ - name: Checkout
48
+ uses: actions/checkout@v3
49
+
50
+ - name: Initialize Ruby
51
+ uses: ruby/setup-ruby@v1
52
+ with:
53
+ ruby-version: 3.1
54
+ bundler-cache: true
55
+
56
+ - name: Run tests
57
+ run: bundle exec rake spec
58
+
59
+ - name: Report test coverage
60
+ uses: paambaati/codeclimate-action@v3.2.0
61
+ env:
62
+ CC_TEST_REPORTER_ID: 997ddf9df5b99897b448d7a7a13e332d57f0e29754d9b9d1414aaee611759422
63
+ with:
64
+ coverageLocations: ${{github.workspace}}/coverage/lcov/*.lcov:lcov
data/.rubocop.yml CHANGED
@@ -1,22 +1,40 @@
1
1
  AllCops:
2
+ NewCops: enable
2
3
  # Output extra information for each offense to make it easier to diagnose:
3
4
  DisplayCopNames: true
4
5
  DisplayStyleGuide: true
5
6
  ExtraDetails: true
6
- # Rubocop enforces rules depending on the oldest version of Ruby which
7
+ SuggestExtensions: false
8
+ # RuboCop enforces rules depending on the oldest version of Ruby which
7
9
  # your project supports:
8
- TargetRubyVersion: 2.5
10
+ TargetRubyVersion: 3.0
9
11
 
10
- # The default max line length for this project
11
- Metrics/LineLength:
12
- Max: 100
12
+ Gemspec/DevelopmentDependencies:
13
+ EnforcedStyle: gemspec
14
+
15
+ # The default max line length is 80 characters
16
+ Layout/LineLength:
17
+ Max: 120
13
18
 
14
19
  # The DSL for RSpec and the gemspec file make it very hard to limit block length:
15
20
  Metrics/BlockLength:
16
21
  Exclude:
22
+ - "spec/spec_helper.rb"
17
23
  - "spec/**/*_spec.rb"
18
24
  - "*.gemspec"
19
25
 
26
+ Metrics/ModuleLength:
27
+ CountAsOne: ['hash']
28
+
29
+ # When writing minitest tests, it is very hard to limit test class length:
30
+ Metrics/ClassLength:
31
+ CountAsOne: ['hash']
32
+ Exclude:
33
+ - "test/**/*_test.rb"
34
+
35
+ Style/AsciiComments:
36
+ Enabled: false
37
+
20
38
  # All Ruby files are required to have a Copyright notice.
21
39
  # Run `rubocop -a` to automatically add missing copyright notices.
22
40
  Style/Copyright:
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Change Log
2
+
3
+ Changes for each release are listed in this file. Changes prior to v1.0.0 were not tracked.
4
+
5
+ This project adheres to [Semantic Versioning](https://semver.org/) for its releases.
6
+
7
+ ## v1.0.0 (2023-12-11)
8
+
9
+ [Full Changelog](https://github.com/main-branch/github_pages_rake_tasks/compare/v0.1.8..v1.0.0)
10
+
11
+ Changes since v0.1.8:
12
+
13
+ * 41317f7 Create initial CHANGELOG.md file (#24)
14
+ * be21d78 Remove travis build definition (#23)
15
+ * 9c7e76e Update project to new build and documentation standards (#22)
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Publish Documentation to GitHub Pages
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/github_pages_rake_tasks.svg)](https://badge.fury.io/rb/github_pages_rake_tasks)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Build Status](https://travis-ci.com/jcouball/github_pages_rake_tasks.svg?branch=master)](https://travis-ci.com/jcouball/github_pages_rake_tasks)
6
- [![Documentation](https://img.shields.io/badge/Documentation-OK-green.svg)](https://jcouball.github.io/github_pages_rake_tasks/)
4
+ [![Documentation](https://img.shields.io/badge/Documentation-Latest-green)](https://rubydoc.info/gems/github_pages_rake_tasks/)
5
+ [![Change Log](https://img.shields.io/badge/CHANGELOG-Latest-green)](https://rubydoc.info/gems/github_pages_rake_tasks/file/CHANGELOG.md)
6
+ [![Build Status](https://github.com/main-branch/github_pages_rake_tasks/workflows/CI%20Build/badge.svg?branch=main)](https://github.com/main-branch/github_pages_rake_tasks/actions?query=workflow%3ACI%20Build)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/a67ad0b61d3687e33181/maintainability)](https://codeclimate.com/github/main-branch/github_pages_rake_tasks/maintainability)
8
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/a67ad0b61d3687e33181/test_coverage)](https://codeclimate.com/github/main-branch/github_pages_rake_tasks/test_coverage)
7
9
 
8
10
  The `github_pages_rake_tasks` gem creates a rake task that pushes files
9
11
  from a local documentation directory to a remote Git repository branch.
@@ -20,15 +22,21 @@ This task is useful for publishing `rdoc` or `yard` documentation using
20
22
 
21
23
  Add this line to your application's Gemfile:
22
24
 
23
- gem 'github_pages_rake_tasks'
25
+ ```Shell
26
+ gem 'github_pages_rake_tasks'
27
+ ```
24
28
 
25
29
  And then execute:
26
30
 
27
- $ bundle
31
+ ```Shell
32
+ bundle
33
+ ```
28
34
 
29
35
  Or install it directly with the `gem` command line:
30
36
 
31
- $ gem install github_pages_rake_tasks
37
+ ```Shell
38
+ gem install github_pages_rake_tasks
39
+ ```
32
40
 
33
41
  ## Usage
34
42
 
@@ -50,15 +58,18 @@ GitHubPagesRakeTasks::PublishTask.new do |task|
50
58
  end
51
59
  ```
52
60
 
61
+ An instance of [GithubPagesRakeTasks::State](https://rubydoc.info/gems/github_pages_rake_tasks/GithubPagesRakeTasks/State)
62
+ is passed to the initialization block (named `task` in the example above).
63
+
53
64
  See [the full usage documentation](https://github.com/pages/jcouball/guthub_pages_rake_tasks) for more details.
54
65
 
55
66
  ## Development
56
67
 
57
68
  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.
58
69
 
59
- To install this gem onto your local machine, run `bundle exec rake install`.
60
- To release a new version, update the version number in `version.rb`, and then run
61
- `bundle exec rake release`, which will create a git tag for the version, push git
70
+ To install this gem onto your local machine, run `bundle exec rake install`.
71
+ To release a new version, update the version number in `version.rb`, and then run
72
+ `bundle exec rake release`, which will create a git tag for the version, push git
62
73
  commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
63
74
 
64
75
  ## Contributing
data/Rakefile CHANGED
@@ -1,41 +1,86 @@
1
1
  # Copyright (c) 2019 James Couball
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bundler/gem_tasks'
5
- CLOBBER << 'Gemfile.lock'
4
+ desc 'Run the same tasks that the CI build will run'
5
+ if RUBY_PLATFORM == 'java'
6
+ task default: %w[spec rubocop bundle:audit build]
7
+ else
8
+ task default: %w[spec rubocop yard yard:audit yard:coverage bundle:audit build]
9
+ end
6
10
 
7
- require 'rspec/core/rake_task'
8
- RSpec::Core::RakeTask.new(:spec)
9
- CLEAN << '.rspec_status'
10
- CLEAN << 'coverage'
11
+ # Bundler Audit
11
12
 
12
13
  require 'bundler/audit/task'
13
14
  Bundler::Audit::Task.new
14
15
 
15
- require 'bump/tasks'
16
+ # Bundler Gem Build
17
+
18
+ require 'bundler'
19
+ require 'bundler/gem_tasks'
20
+
21
+ begin
22
+ Bundler.setup(:default, :development)
23
+ rescue Bundler::BundlerError => e
24
+ warn e.message
25
+ warn 'Run `bundle install` to install missing gems'
26
+ exit e.status_code
27
+ end
28
+
29
+ CLEAN << 'pkg'
30
+ CLEAN << 'Gemfile.lock'
31
+
32
+ # RSpec
33
+
34
+ require 'rspec/core/rake_task'
35
+
36
+ RSpec::Core::RakeTask.new do
37
+ if RUBY_PLATFORM == 'java'
38
+ ENV['JAVA_OPTS'] = '-Djdk.io.File.enableADS=true'
39
+ ENV['JRUBY_OPTS'] = '--debug'
40
+ ENV['NOCOV'] = 'TRUE'
41
+ end
42
+ end
43
+
44
+ CLEAN << 'coverage'
45
+ CLEAN << '.rspec_status'
46
+ CLEAN << 'rspec-report.xml'
47
+
48
+ # Rubocop
16
49
 
17
50
  require 'rubocop/rake_task'
51
+
18
52
  RuboCop::RakeTask.new do |t|
19
- t.options = %w[--format progress --format json --out rubocop-report.json]
53
+ t.options = %w[
54
+ --format progress
55
+ --format json --out rubocop-report.json
56
+ ]
20
57
  end
58
+
21
59
  CLEAN << 'rubocop-report.json'
22
60
 
23
- require 'yard'
24
- YARD::Rake::YardocTask.new
25
- CLEAN << '.yardoc'
26
- CLEAN << 'doc'
61
+ unless RUBY_PLATFORM == 'java'
62
+ # YARD
27
63
 
28
- require 'yardstick/rake/verify'
29
- require 'yaml'
30
- Yardstick::Rake::Verify.new('yardstick:verify')
64
+ require 'yard'
65
+ YARD::Rake::YardocTask.new do |t|
66
+ t.files = %w[lib/**/*.rb examples/**/*]
67
+ end
31
68
 
32
- require 'yardstick/rake/measurement'
33
- Yardstick::Rake::Measurement.new('yardstick:measure')
34
- CLEAN << 'measurements'
69
+ CLEAN << '.yardoc'
70
+ CLEAN << 'doc'
35
71
 
36
- desc 'Run yardstick to check yard docs'
37
- task :yardstick do
38
- sh "yardstick 'lib/**/*.rb'"
39
- end
72
+ # Yardstick
73
+
74
+ desc 'Run yardstick to show missing YARD doc elements'
75
+ task :'yard:audit' do
76
+ sh "yardstick 'lib/**/*.rb'"
77
+ end
40
78
 
41
- task default: [:spec, 'bundle:audit', :rubocop, :yard, :build]
79
+ # Yardstick coverage
80
+
81
+ require 'yardstick/rake/verify'
82
+
83
+ Yardstick::Rake::Verify.new(:'yard:coverage') do |verify|
84
+ verify.threshold = 100
85
+ end
86
+ end
@@ -23,14 +23,14 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.homepage = 'https://github.com/jcouball/github_pages_rake_tasks'
25
25
  spec.license = 'MIT'
26
+ spec.required_ruby_version = '>= 3.0.0'
26
27
 
27
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
28
- # to allow pushing to a single host or delete this section to allow pushing to any host.
29
- if spec.respond_to?(:metadata)
30
- spec.metadata['homepage_uri'] = spec.homepage
31
- spec.metadata['source_code_uri'] = spec.homepage
32
- spec.metadata['changelog_uri'] = spec.homepage
33
- end
28
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
29
+ spec.metadata['rubygems_mfa_required'] = 'true'
30
+
31
+ spec.metadata['homepage_uri'] = spec.homepage
32
+ spec.metadata['source_code_uri'] = spec.homepage
33
+ spec.metadata['changelog_uri'] = spec.homepage
34
34
 
35
35
  # Specify which files should be added to the gem when it is released.
36
36
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -41,14 +41,13 @@ Gem::Specification.new do |spec|
41
41
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
42
42
  spec.require_paths = ['lib']
43
43
 
44
- spec.add_development_dependency 'bump', '~> 0.8'
45
- spec.add_development_dependency 'bundler', '~> 2.0'
46
- spec.add_development_dependency 'bundler-audit', '~> 0.6'
47
- spec.add_development_dependency 'rake', '~> 12.3'
48
- spec.add_development_dependency 'rspec', '~> 3.8'
49
- spec.add_development_dependency 'rubocop', '~> 0.70'
50
- spec.add_development_dependency 'simplecov', '~> 0.16'
51
- spec.add_development_dependency 'simplecov-lcov', '~> 0.7'
44
+ spec.add_development_dependency 'bundler-audit', '~> 0.9'
45
+ spec.add_development_dependency 'rake', '~> 13.1'
46
+ spec.add_development_dependency 'rspec', '~> 3.12'
47
+ spec.add_development_dependency 'rubocop', '~> 1.58'
48
+ spec.add_development_dependency 'semverify', '0.3.0'
49
+ spec.add_development_dependency 'simplecov', '~> 0.22'
50
+ spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
52
51
  spec.add_development_dependency 'yard', '~> 0.9'
53
52
  spec.add_development_dependency 'yardstick', '~> 0.9'
54
53
  end
@@ -70,8 +70,5 @@ module GithubPagesRakeTasks
70
70
  #
71
71
  # @return [String] the output of the command
72
72
  #
73
- def `(cmd)
74
- super
75
- end
76
73
  end
77
74
  end
@@ -66,6 +66,8 @@ module GithubPagesRakeTasks
66
66
  # are passed to the yielded block.
67
67
  #
68
68
  def initialize(*task_args, &initialization_block)
69
+ super
70
+
69
71
  @state = State.new
70
72
 
71
73
  # Allow user to override defaults
@@ -75,9 +77,7 @@ module GithubPagesRakeTasks
75
77
  namespace rake_namespace do
76
78
  desc "Publish #{doc_dir} to #{repo_url}##{branch_name}"
77
79
  task :publish do
78
- display_header
79
- publish
80
- display_footer
80
+ publish_task
81
81
  end
82
82
  end
83
83
  end
@@ -86,15 +86,57 @@ module GithubPagesRakeTasks
86
86
 
87
87
  # @!visibility private
88
88
 
89
+ # Publish the documentation directory to the specified repository and branch
90
+ #
91
+ # Publishes the document directory to the specified repository and branch
92
+ # displaying a header before publishing and a footer after publishing. The header
93
+ # and footer are not displayed if the `quiet` flag is set.
94
+ #
95
+ # @see #display_header
96
+ # @see #publish
97
+ # @see #display_footer
98
+ #
99
+ # @return [void]
100
+ #
101
+ # @api private
102
+ #
103
+ def publish_task
104
+ display_header
105
+ publish
106
+ display_footer
107
+ end
108
+
109
+ # Print a header message before the publishing
110
+ #
111
+ # The message includes the document directory, repository URL, and branch name.
112
+ # The message is not printed if the `quiet` flag is set.
113
+ # An extra line is printed if the `verbose` flag is set.
114
+ #
115
+ # @return [void]
116
+ #
117
+ # @api private
89
118
  def display_header
90
119
  print "Publishing #{doc_dir} to #{repo_url}##{branch_name}..." unless quiet
91
120
  puts if verbose
92
121
  end
93
122
 
123
+ # Print a success message after the publishing
124
+ #
125
+ # The message is not printed if the `quiet` flag is set.
126
+ #
127
+ # @return [void]
128
+ #
129
+ # @api private
94
130
  def display_footer
95
131
  puts 'SUCCESS' unless quiet
96
132
  end
97
133
 
134
+ # Executes the publishing process
135
+ #
136
+ # @return [void]
137
+ #
138
+ # @api private
139
+ #
98
140
  def publish
99
141
  interface.verbose(verbose) do
100
142
  interface.mkdir_p(staging_dir)
@@ -107,12 +149,24 @@ module GithubPagesRakeTasks
107
149
  end
108
150
  end
109
151
 
152
+ # Fetch and checks out an existing branch
153
+ #
154
+ # @return [void]
155
+ #
156
+ # @api private
157
+ #
110
158
  def checkout_existing_branch
111
159
  # only download the needed branch from GitHub
112
160
  interface.sh("git fetch '#{remote_name}' '#{branch_name}'")
113
161
  interface.sh("git checkout '#{branch_name}'")
114
162
  end
115
163
 
164
+ # Creates `branch_name` in the remote repository
165
+ #
166
+ # @return [Boolean] true if the branch exists in the remote repository, false otherwise.
167
+ #
168
+ # @api private
169
+ #
116
170
  def create_new_branch
117
171
  interface.sh("git checkout --orphan '#{branch_name}'")
118
172
  interface.file_write('index.html', 'Future home of documentation')
@@ -121,6 +175,12 @@ module GithubPagesRakeTasks
121
175
  interface.sh("git push '#{remote_name}' '#{branch_name}'")
122
176
  end
123
177
 
178
+ # Checks if `branch_name` exists in the remote repository
179
+ #
180
+ # @return [Boolean] true if the branch exists in the remote repository, false otherwise
181
+ #
182
+ # @api private
183
+ #
124
184
  def remote_branch_exists?
125
185
  cmd = "git ls-remote --exit-code --heads '#{repo_url}' '#{branch_name}'"
126
186
  interface.sh(cmd) do |branch_exists, _process_status|
@@ -128,15 +188,28 @@ module GithubPagesRakeTasks
128
188
  end
129
189
  end
130
190
 
191
+ # Initializes the git repository in `staging_dir`
192
+ #
193
+ # @return [void]
194
+ #
195
+ # @api private
196
+ #
131
197
  def initialize_git
132
198
  interface.sh('git init')
133
199
  interface.sh("git remote add '#{remote_name}' '#{repo_url}'")
134
200
  end
135
201
 
136
- # Creates `staging_dir` (if needed), clones the remote repository to it, and checks
137
- # out `branch_name`. Creates `branch_name` in the remote is needed.
202
+ # Initializes the staging directory
203
+ #
204
+ # * Creates `staging_dir` (if needed)
205
+ # * Clones the remote repository to it
206
+ # * Checks out `branch_name`
207
+ # * Creates `branch_name` in the remote if needed.
208
+ # * Finally, removes all files using git rm
138
209
  #
139
- # Finally, removes all files using git rm
210
+ # @return [void]
211
+ #
212
+ # @api private
140
213
  #
141
214
  def initialize_staging_dir
142
215
  initialize_git
@@ -148,28 +221,68 @@ module GithubPagesRakeTasks
148
221
  remove_staging_files
149
222
  end
150
223
 
224
+ # Removes the staging directory
225
+ #
226
+ # @return [void]
227
+ #
228
+ # @api private
229
+ #
151
230
  def clean_staging_dir
152
231
  interface.rm_rf staging_dir
153
232
  end
154
233
 
234
+ # @!attribute [r] absolute_doc_dir
235
+ #
236
+ # The absolute path to `doc_dir` relative to `project_root`
237
+ #
238
+ # @return [String]
239
+ #
240
+ # @api private
241
+ #
155
242
  def absolute_doc_dir
156
243
  @absolute_doc_dir ||= interface.expand_path(doc_dir, project_root)
157
244
  end
158
245
 
246
+ # @!attribute [r] commit_message
247
+ #
248
+ # The commit message to use when committing the documentation
249
+ #
250
+ # @return [String]
251
+ #
252
+ # @api private
253
+ #
159
254
  def commit_message
160
255
  @commit_message ||= 'Updating documentation'
161
256
  end
162
257
 
258
+ # Removes all files from the staging directory
259
+ #
260
+ # @return [void]
261
+ #
262
+ # @api private
263
+ #
163
264
  def remove_staging_files
164
265
  interface.sh('git rm -r .') do
165
266
  # ignore failure
166
267
  end
167
268
  end
168
269
 
270
+ # Copies the contents of `absolute_doc_dir` to `staging_dir`
271
+ #
272
+ # @return [void]
273
+ #
274
+ # @api private
275
+ #
169
276
  def copy_doc_dir_to_staging_dir
170
277
  interface.cp_r(File.join(absolute_doc_dir, '.'), staging_dir)
171
278
  end
172
279
 
280
+ # Commits and pushes the contents of `staging_dir` to the remote repository
281
+ #
282
+ # @return [void]
283
+ #
284
+ # @api private
285
+ #
173
286
  def commit_and_push_staging_dir
174
287
  interface.sh('git add .')
175
288
  interface.sh("git commit -m '#{commit_message}'") do |commit_successful, _process_status|
@@ -17,85 +17,172 @@ module GithubPagesRakeTasks
17
17
  #
18
18
  # Most used attributes are {doc_dir}, {project_root}, {repo_url}, and {branch_name}.
19
19
  #
20
+ # @!attribute doc_dir [rw]
21
+ # The directory relative to {project_root} containing the documentation
22
+ #
23
+ # The default value is 'doc'.
24
+ #
25
+ # @example
26
+ # doc_dir = 'doc'
27
+ # doc_dir #=> 'doc'
28
+ #
29
+ # @return [String]
30
+ #
31
+ # @!attribute project_root [rw]
32
+ # The absolute path to the project's root directory
33
+ #
34
+ # {doc_dir} is relative to this directory.
35
+ #
36
+ # The default value is the value returned from `git rev-parse --show-toplevel` when
37
+ # run in the current working directory.
38
+ #
39
+ # @example
40
+ # project_root = '/home/james/my_project'
41
+ # project_root #=> '/home/james/my_project'
42
+ #
43
+ # @return [String]
44
+ #
45
+ # @!attribute repo_url [rw]
46
+ # The URL to the remote repository to push documentation
47
+ #
48
+ # The default value is the value returned from `git config --get remote.origin.url`
49
+ #
50
+ # @example
51
+ # repo_url = 'https://github.com/main-branch/my_project.git'
52
+ # repo_url #=> 'https://github.com/main-branch/my_project.git'
53
+ #
54
+ # @return [String]
55
+ #
56
+ # @!attribute [rw] branch_name
57
+ # The branch to push documentation to
58
+ #
59
+ # The default value is 'gh-pages'.
60
+ #
61
+ # @example
62
+ # branch_name = 'gh-pages'
63
+ # branch_name #=> 'gh-pages'
64
+ #
65
+ # @return [String]
66
+ #
67
+ # @!attribute [rw] staging_dir
68
+ # The directory where the documentation is staged for pushing to the Git remote
69
+ #
70
+ # All files are copied from {doc_dir} to {staging_dir} where the push to the Git remote is
71
+ # done.
72
+ #
73
+ # @note This directory is deleted at the end of the publish task.
74
+ #
75
+ # The default value is a temporary directory created with
76
+ # [Dir.mktmpdir](https://ruby-doc.org/stdlib-2.6.3/libdoc/tmpdir/rdoc/Dir.html)
77
+ # with the prefix 'github-pages-publish-'
78
+ #
79
+ # @example
80
+ # staging_dir = ''
81
+ # staging_dir #=> '/home/james/my_project'
82
+ #
83
+ # @return [String]
84
+ #
85
+ # @!attribute [rw] quiet
86
+ # Silence all output from the `github-pages:publish` task
87
+ #
88
+ # When {quiet} is true, the `github-pages:publish` task will not emit any output
89
+ # unless there is an error.
90
+ #
91
+ # Setting {quiet} to true will also set {verbose} to false.
92
+ #
93
+ # The default value is false
94
+ #
95
+ # @example
96
+ # quiet = true
97
+ # quiet #=> true
98
+ # verbose #=> false
99
+ #
100
+ # @return [Boolean]
101
+ #
102
+ # @!attribute verbose
103
+ # Make the `github-pages:publish` emit extra output
104
+ #
105
+ # When {verbose} is true, the `github-pages:publish` task will emit extra output
106
+ # that is useful for debugging.
107
+ #
108
+ # Setting {verbose} to true will also set {quiet} to false.
109
+ #
110
+ # The default value is false
111
+ #
112
+ # @example
113
+ # verbose = true
114
+ # verbose #=> true
115
+ # quiet #=> false
116
+ #
117
+ # @return [Boolean]
118
+ #
119
+ # @!attribute [rw] rake_namespace
120
+ # The Rake namespace for the `publish` task
121
+ #
122
+ # The default value is 'github-pages'
123
+ #
124
+ # @example
125
+ # rake_namespace = 'my-docs'
126
+ # rake_namespace #=> 'my-docs'
127
+ #
128
+ # @return [String] Rake namespace
129
+ #
130
+ # @api public
131
+ #
132
+ # @!attribute [rw] interface
133
+ # The object that implements all methods that touch the 'outside' world
134
+ #
135
+ # An object that implements all methods that touch the world outside of
136
+ # the PublishTask class. This includes dealing with the file system, issuing
137
+ # shell commands, etc.
138
+ #
139
+ # The default value is a new instance of {GithubPagesRakeTasks::Interface}
140
+ #
141
+ # @note {interface} is used for mocking during testing of this gem and is probably
142
+ # not useful for users of this gem.
143
+ #
144
+ # @example
145
+ # interface = GithubPagesRakeTasks::Interface.new
146
+ #
147
+ # @return [GithubPagesRakeTasks::Instance]
148
+ #
149
+ # @!attribute [rw] remote_name
150
+ # The name of the Git remote to use for pushing documentation
151
+ #
152
+ # The default value is 'origin'
153
+ #
154
+ # @example
155
+ # remote_name = 'my_remote'
156
+ # remote_name #=> 'my_remote'
157
+ #
158
+ # @return [String] the Git remote name
159
+ #
20
160
  class State
21
- # The directory, relative to {project_root}, that contains the documentation to
22
- # publish to GitHub.
23
- #
24
- # The default value is 'doc'
25
- #
26
- # @return [String] directory
27
- #
28
161
  def doc_dir
29
162
  @doc_dir ||= 'doc'
30
163
  end
31
- attr_writer :doc_dir
32
-
33
- # The absolute path to the project's Git repository. {doc_dir} is relative to this
34
- # path.
35
- #
36
- # The default value is the value returned from `git rev-parse --show-toplevel` when
37
- # run in the current working directory
38
- #
39
- # @return [String] directory
40
- #
164
+
165
+ attr_writer :doc_dir, :project_root, :repo_url, :branch_name, :staging_dir, :remote_name,
166
+ :interface, :rake_namespace
167
+
41
168
  def project_root
42
169
  @project_root ||= interface.send(:`, 'git rev-parse --show-toplevel').chomp
43
170
  end
44
- attr_writer :project_root
45
-
46
- # The URL to the remote repository to push documentation.
47
- #
48
- # The default value is the value returned from `git config --get remote.origin.url`
49
- #
50
- # @return [String] url
51
- #
171
+
52
172
  def repo_url
53
173
  @repo_url ||= Dir.chdir(project_root) do |_path|
54
174
  interface.send(:`, "git config --get remote.#{remote_name}.url").chomp
55
175
  end
56
176
  end
57
- attr_writer :repo_url
58
-
59
- # The branch to push documentation to.
60
- #
61
- # The default value is 'gh-pages'
62
- #
63
- # @return [String] the branch name
64
- #
177
+
65
178
  def branch_name
66
179
  @branch_name ||= 'gh-pages'
67
180
  end
68
- attr_writer :branch_name
69
-
70
- # The directory where the documentation is staged prior to pushing to the Git remote.
71
- # All files are copied from {doc_dir} to {staging_dir} where the push to the Git remote is
72
- # done.
73
- #
74
- # @note This directory is deleted at the end of the publish task.
75
- #
76
- # The default value is a temporary directory created with
77
- # [Dir.mktmpdir](https://ruby-doc.org/stdlib-2.6.3/libdoc/tmpdir/rdoc/Dir.html)
78
- # with the prefix 'github-pages-publish-'
79
- #
80
- # @return [String] a temporary directory.
81
- #
181
+
82
182
  def staging_dir
83
183
  @staging_dir ||= interface.mktmpdir('github-pages-publish-')
84
184
  end
85
- attr_writer :staging_dir
86
-
87
- # @!attribute quiet
88
- # Silence all output from the `github-pages:publish` task.
89
- #
90
- # When {quiet} is true, the `github-pages:publish` task will not emit any output
91
- # unless there is an error.
92
- #
93
- # Setting {quiet} to true will also set {verbose} to false.
94
- #
95
- # The default value is false
96
- #
97
- # @return [Boolean] the quiet flag value
98
- #
185
+
99
186
  def quiet
100
187
  return @quiet if instance_variable_defined?(:@quiet)
101
188
 
@@ -107,18 +194,6 @@ module GithubPagesRakeTasks
107
194
  @verbose = false if quiet
108
195
  end
109
196
 
110
- # @!attribute verbose
111
- # Make the `github-pages:publish` emit extra output.
112
- #
113
- # When {verbose} is true, the `github-pages:publish` task will emit extra output
114
- # that is useful for debugging.
115
- #
116
- # Setting {verbose} to true will also set {quiet} to false.
117
- #
118
- # The default value is false
119
- #
120
- # @return [Boolean] the verbose flag value
121
- #
122
197
  def verbose
123
198
  return @verbose if instance_variable_defined?(:@verbose)
124
199
 
@@ -130,42 +205,16 @@ module GithubPagesRakeTasks
130
205
  @quiet = false if verbose
131
206
  end
132
207
 
133
- # The name of the Git remote to use for pushing documentation.
134
- #
135
- # The default value is 'origin'
136
- #
137
- # @return [String] the Git remote name
138
- #
139
208
  def remote_name
140
209
  @remote_name ||= 'origin'
141
210
  end
142
- attr_writer :remote_name
143
-
144
- # An object that implements all methods that touch the world outside of
145
- # the PublishTask class. This includes dealing with the file system, issuing
146
- # shell commands, etc.
147
- #
148
- # The default value is a new instance of {GithubPagesRakeTasks::Interface}
149
- #
150
- # @note {interface} is used for mocking during testing of this gem and is probably
151
- # not useful for users of this gem.
152
- #
153
- # @return [GithubPagesRakeTasks::Instance] an interface object
154
- #
211
+
155
212
  def interface
156
213
  @interface ||= Interface.new
157
214
  end
158
- attr_writer :interface
159
-
160
- # The Rake namespace for the publish task.
161
- #
162
- # The default value is 'github-pages'
163
- #
164
- # @return [String] Rake namespace
165
- #
215
+
166
216
  def rake_namespace
167
217
  @rake_namespace ||= 'github-pages'
168
218
  end
169
- attr_writer :rake_namespace
170
219
  end
171
220
  end
@@ -3,5 +3,5 @@
3
3
 
4
4
  module GithubPagesRakeTasks
5
5
  # Version of this module
6
- VERSION = '0.1.8'
6
+ VERSION = '1.0.0'
7
7
  end
metadata CHANGED
@@ -1,127 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_pages_rake_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Couball
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-31 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bump
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.8'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.8'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
14
+ name: bundler-audit
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '2.0'
19
+ version: '0.9'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '2.0'
26
+ version: '0.9'
41
27
  - !ruby/object:Gem::Dependency
42
- name: bundler-audit
28
+ name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '0.6'
33
+ version: '13.1'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '0.6'
40
+ version: '13.1'
55
41
  - !ruby/object:Gem::Dependency
56
- name: rake
42
+ name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '12.3'
47
+ version: '3.12'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '12.3'
54
+ version: '3.12'
69
55
  - !ruby/object:Gem::Dependency
70
- name: rspec
56
+ name: rubocop
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '3.8'
61
+ version: '1.58'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '3.8'
68
+ version: '1.58'
83
69
  - !ruby/object:Gem::Dependency
84
- name: rubocop
70
+ name: semverify
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - '='
88
74
  - !ruby/object:Gem::Version
89
- version: '0.70'
75
+ version: 0.3.0
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - '='
95
81
  - !ruby/object:Gem::Version
96
- version: '0.70'
82
+ version: 0.3.0
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: simplecov
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '0.16'
89
+ version: '0.22'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '0.16'
96
+ version: '0.22'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: simplecov-lcov
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '0.7'
103
+ version: '0.8'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '0.7'
110
+ version: '0.8'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: yard
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -163,11 +149,13 @@ executables: []
163
149
  extensions: []
164
150
  extra_rdoc_files: []
165
151
  files:
152
+ - ".github/CODEOWNERS"
153
+ - ".github/workflows/main.yml"
166
154
  - ".gitignore"
167
155
  - ".rspec"
168
156
  - ".rubocop.yml"
169
- - ".travis.yml"
170
157
  - ".yardopts"
158
+ - CHANGELOG.md
171
159
  - Gemfile
172
160
  - LICENSE.txt
173
161
  - README.md
@@ -184,10 +172,12 @@ homepage: https://github.com/jcouball/github_pages_rake_tasks
184
172
  licenses:
185
173
  - MIT
186
174
  metadata:
175
+ allowed_push_host: https://rubygems.org
176
+ rubygems_mfa_required: 'true'
187
177
  homepage_uri: https://github.com/jcouball/github_pages_rake_tasks
188
178
  source_code_uri: https://github.com/jcouball/github_pages_rake_tasks
189
179
  changelog_uri: https://github.com/jcouball/github_pages_rake_tasks
190
- post_install_message:
180
+ post_install_message:
191
181
  rdoc_options: []
192
182
  require_paths:
193
183
  - lib
@@ -195,15 +185,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
185
  requirements:
196
186
  - - ">="
197
187
  - !ruby/object:Gem::Version
198
- version: '0'
188
+ version: 3.0.0
199
189
  required_rubygems_version: !ruby/object:Gem::Requirement
200
190
  requirements:
201
191
  - - ">="
202
192
  - !ruby/object:Gem::Version
203
193
  version: '0'
204
194
  requirements: []
205
- rubygems_version: 3.0.3
206
- signing_key:
195
+ rubygems_version: 3.4.10
196
+ signing_key:
207
197
  specification_version: 4
208
198
  summary: Rake tasks for publishing documentation to GitHub Pages
209
199
  test_files: []
data/.travis.yml DELETED
@@ -1,42 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
-
8
- cache: bundler
9
-
10
- before_install: gem install bundler -v 2.0.1
11
-
12
- before_deploy:
13
- - >
14
- if ! [ "$HAS_ALREADY_RUN" ]; then
15
- export HAS_ALREADY_RUN=1
16
- echo "machine github.com\n login jcouball\n password ${GITHUB_TOKEN}" > ~/.netrc
17
- git config --global user.email "travis@travis-ci.org"
18
- git config --global user.name "Travis CI"
19
- git checkout ${TRAVIS_BRANCH}
20
- gem install bump
21
- bump patch --commit-message "[skip ci]"
22
- remote=https://$GITHUB_TOKEN@github.com/$TRAVIS_REPO_SLUG
23
- git push --follow-tags "$remote" "$TRAVIS_BRANCH"
24
- fi
25
-
26
- deploy:
27
- - provider: pages
28
- skip_cleanup: true
29
- github_token: $GITHUB_TOKEN
30
- local_dir: doc
31
- verbose: true
32
- on:
33
- branch: master
34
- repo: jcouball/github_pages_rake_tasks
35
- rvm: 2.4
36
- - provider: rubygems
37
- api_key: $RUBYGEMS_API_KEY
38
- gem: github_pages_rake_tasks
39
- on:
40
- branch: master
41
- repo: jcouball/github_pages_rake_tasks
42
- rvm: 2.4