yard-relative_markdown_links 0.4.1 → 0.6.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/CHANGELOG.md +20 -1
- data/lib/yard/relative_markdown_links/version.rb +1 -1
- data/lib/yard/relative_markdown_links.rb +25 -4
- data/yard-relative_markdown_links.gemspec +12 -3
- metadata +14 -25
- data/.github/dependabot.yml +0 -16
- data/.github/workflows/pull-request.yml +0 -62
- data/.gitignore +0 -4
- data/.rubocop.yml +0 -53
- data/.ruby-version +0 -1
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -69
- data/Rakefile +0 -18
- data/bin/bundle +0 -105
- data/bin/console +0 -8
- data/bin/install-bundler +0 -4
- data/bin/rake +0 -29
- data/bin/setup +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d5f120274d159ff20d79282035ec053b5ce4d2fb31773bb9b1b7a94882e756f
|
4
|
+
data.tar.gz: bf7638988dbae4fc00e9cb165335f83127528ee7a9f1151de1439b458797cb6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e98baedb8370f27d2f274281347ffb84d1aace580ef386682bce4da37a321247edb87941bb9b2cf629b7dabde0aadc40b3569ef6c73ba554915ca4e63ea6b0
|
7
|
+
data.tar.gz: ac6cf4464c43a5f83855a2e6b6c548d4c16ca7d4bff88d6bfd2900379edf6073502f259fa51c4814fee20d6ffe215aa570978423c36524e97b66f37686305b84
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
## [Unreleased]
|
9
9
|
No notable changes.
|
10
10
|
|
11
|
+
## [0.6.0] - 2025-06-14
|
12
|
+
### Changed
|
13
|
+
* Don't `require "yard"` to avoid a circular require ([#292](https://github.com/haines/yard-relative_markdown_links/pull/292))
|
14
|
+
* Require Ruby ≥ 3.2 ([#268](https://github.com/haines/yard-relative_markdown_links/pull/268), [#288](https://github.com/haines/yard-relative_markdown_links/pull/288))
|
15
|
+
* Test against Ruby 3.3 ([#212](https://github.com/haines/yard-relative_markdown_links/pull/212))
|
16
|
+
* Test against Ruby 3.4 ([#268](https://github.com/haines/yard-relative_markdown_links/pull/268))
|
17
|
+
|
18
|
+
## [0.5.0] - 2023-06-12
|
19
|
+
### Changed
|
20
|
+
* Require Ruby ≥ 3.0 ([#175](https://github.com/haines/yard-relative_markdown_links/pull/175))
|
21
|
+
* Test against Ruby 3.1 ([#107](https://github.com/haines/yard-relative_markdown_links/pull/107))
|
22
|
+
* Test against Ruby 3.2 ([#175](https://github.com/haines/yard-relative_markdown_links/pull/175))
|
23
|
+
* Require Nokogiri ≥ 1.14.3 ([#175](https://github.com/haines/yard-relative_markdown_links/pull/175))
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
* Handle links generated by recent versions of RDoc ([#175](https://github.com/haines/yard-relative_markdown_links/pull/175))
|
27
|
+
|
11
28
|
## [0.4.1] - 2021-11-15
|
12
29
|
### Changed
|
13
30
|
* Require MFA to publish gem ([#92](https://github.com/haines/yard-relative_markdown_links/pull/92))
|
@@ -37,7 +54,9 @@ No notable changes.
|
|
37
54
|
### Added
|
38
55
|
- A YARD plugin to allow relative links between Markdown files ([#1](https://github.com/haines/yard-relative_markdown_links/pull/1))
|
39
56
|
|
40
|
-
[Unreleased]: https://github.com/haines/yard-relative_markdown_links/compare/v0.
|
57
|
+
[Unreleased]: https://github.com/haines/yard-relative_markdown_links/compare/v0.6.0...HEAD
|
58
|
+
[0.6.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.5.0...v0.6.0
|
59
|
+
[0.5.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.4.1...v0.5.0
|
41
60
|
[0.4.1]: https://github.com/haines/yard-relative_markdown_links/compare/v0.4.0...v0.4.1
|
42
61
|
[0.4.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.3.0...v0.4.0
|
43
62
|
[0.3.0]: https://github.com/haines/yard-relative_markdown_links/compare/v0.2.0...v0.3.0
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
require "nokogiri"
|
4
4
|
require "uri"
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
require_relative "relative_markdown_links/version"
|
7
7
|
|
8
8
|
module YARD # rubocop:disable Style/Documentation
|
9
9
|
# GitHub and YARD render Markdown files differently. In particular, relative
|
10
10
|
# links between Markdown files that work in GitHub don't work in YARD.
|
11
11
|
# For example, if you have `[hello](FOO.md)` in your README, YARD renders it
|
12
|
-
# as `<a href="
|
12
|
+
# as `<a href="FOO_md.html">hello</a>`, creating a broken link in your docs.
|
13
13
|
#
|
14
14
|
# With this plugin enabled, you'll get `<a href="file.FOO.html">hello</a>`
|
15
15
|
# instead, which correctly links through to the rendered HTML file.
|
@@ -18,14 +18,35 @@ module YARD # rubocop:disable Style/Documentation
|
|
18
18
|
# @param [String] text the HTML fragment in which to resolve links.
|
19
19
|
# @return [String] HTML with relative links to extra files converted to `{file:}` links.
|
20
20
|
def resolve_links(text)
|
21
|
+
return super unless options.files
|
22
|
+
|
23
|
+
filenames = options.files.to_set(&:filename)
|
24
|
+
|
25
|
+
rdoc_filenames = filenames.filter_map { |filename|
|
26
|
+
# https://github.com/ruby/rdoc/blob/0e060c69f51ec4a877e5cde69b31d47eaeb2a2b9/lib/rdoc/markup/to_html.rb#L364-L366
|
27
|
+
match = %r{\A(?<dirname>(?:[^/#]*/)*+)(?<basename>[^/#]+)\.(?<ext>rb|rdoc|md)\z}i.match(filename)
|
28
|
+
next unless match
|
29
|
+
|
30
|
+
["#{match[:dirname]}#{match[:basename].tr('.', '_')}_#{match[:ext]}.html", filename]
|
31
|
+
}.to_h
|
32
|
+
|
21
33
|
html = Nokogiri::HTML.fragment(text)
|
34
|
+
|
22
35
|
html.css("a[href]").each do |link|
|
23
36
|
href = URI(link["href"])
|
37
|
+
next unless href.relative?
|
24
38
|
|
25
|
-
|
39
|
+
if filenames.include?(href.path)
|
40
|
+
link.replace "{file:#{href} #{link.inner_html}}"
|
41
|
+
next
|
42
|
+
end
|
43
|
+
|
44
|
+
href.path = rdoc_filenames[href.path]
|
45
|
+
next unless href.path && filenames.include?(href.path)
|
26
46
|
|
27
47
|
link.replace "{file:#{href} #{link.inner_html}}"
|
28
48
|
end
|
49
|
+
|
29
50
|
super(html.to_s)
|
30
51
|
end
|
31
52
|
end
|
@@ -16,7 +16,16 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = "https://github.com/haines/yard-relative_markdown_links"
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
19
|
-
spec.files = Dir
|
19
|
+
spec.files = Dir[
|
20
|
+
"lib/**/*.rb",
|
21
|
+
".yardopts",
|
22
|
+
"CHANGELOG.md",
|
23
|
+
"CODE_OF_CONDUCT.md",
|
24
|
+
"LICENSE.md",
|
25
|
+
"README.md",
|
26
|
+
"yard-relative_markdown_links.gemspec"
|
27
|
+
]
|
28
|
+
|
20
29
|
spec.require_paths = ["lib"]
|
21
30
|
|
22
31
|
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
|
@@ -27,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
27
36
|
spec.metadata["source_code_uri"] = spec.homepage
|
28
37
|
spec.metadata["yard.run"] = "yri"
|
29
38
|
|
30
|
-
spec.required_ruby_version = ">= 2
|
39
|
+
spec.required_ruby_version = ">= 3.2"
|
31
40
|
|
32
|
-
spec.add_dependency "nokogiri", "
|
41
|
+
spec.add_dependency "nokogiri", ">= 1.14.3", "< 2"
|
33
42
|
end
|
metadata
CHANGED
@@ -1,54 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-relative_markdown_links
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Haines
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: nokogiri
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: 1.14.3
|
19
|
+
- - "<"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- - "
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 1.14.3
|
29
|
+
- - "<"
|
25
30
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
description:
|
31
|
+
version: '2'
|
28
32
|
email:
|
29
33
|
- andrew@haines.org.nz
|
30
34
|
executables: []
|
31
35
|
extensions: []
|
32
36
|
extra_rdoc_files: []
|
33
37
|
files:
|
34
|
-
- ".github/dependabot.yml"
|
35
|
-
- ".github/workflows/pull-request.yml"
|
36
|
-
- ".gitignore"
|
37
|
-
- ".rubocop.yml"
|
38
|
-
- ".ruby-version"
|
39
38
|
- ".yardopts"
|
40
39
|
- CHANGELOG.md
|
41
40
|
- CODE_OF_CONDUCT.md
|
42
|
-
- Gemfile
|
43
|
-
- Gemfile.lock
|
44
41
|
- LICENSE.md
|
45
42
|
- README.md
|
46
|
-
- Rakefile
|
47
|
-
- bin/bundle
|
48
|
-
- bin/console
|
49
|
-
- bin/install-bundler
|
50
|
-
- bin/rake
|
51
|
-
- bin/setup
|
52
43
|
- lib/yard-relative_markdown_links.rb
|
53
44
|
- lib/yard/relative_markdown_links.rb
|
54
45
|
- lib/yard/relative_markdown_links/version.rb
|
@@ -64,7 +55,6 @@ metadata:
|
|
64
55
|
rubygems_mfa_required: 'true'
|
65
56
|
source_code_uri: https://github.com/haines/yard-relative_markdown_links
|
66
57
|
yard.run: yri
|
67
|
-
post_install_message:
|
68
58
|
rdoc_options: []
|
69
59
|
require_paths:
|
70
60
|
- lib
|
@@ -72,15 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
62
|
requirements:
|
73
63
|
- - ">="
|
74
64
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2
|
65
|
+
version: '3.2'
|
76
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
67
|
requirements:
|
78
68
|
- - ">="
|
79
69
|
- !ruby/object:Gem::Version
|
80
70
|
version: '0'
|
81
71
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
83
|
-
signing_key:
|
72
|
+
rubygems_version: 3.6.9
|
84
73
|
specification_version: 4
|
85
74
|
summary: A YARD plugin to allow relative links between Markdown files
|
86
75
|
test_files: []
|
data/.github/dependabot.yml
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
name: pull-request
|
2
|
-
|
3
|
-
on:
|
4
|
-
- pull_request
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
matrix:
|
10
|
-
ruby:
|
11
|
-
- "2.5"
|
12
|
-
- "2.6"
|
13
|
-
- "2.7"
|
14
|
-
- "3.0"
|
15
|
-
|
16
|
-
name: Ruby ${{ matrix.ruby }}
|
17
|
-
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
|
20
|
-
container:
|
21
|
-
image: ruby:${{ matrix.ruby }}-alpine
|
22
|
-
|
23
|
-
env:
|
24
|
-
BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle
|
25
|
-
|
26
|
-
steps:
|
27
|
-
- name: Install dependencies
|
28
|
-
run: apk add build-base git tar
|
29
|
-
|
30
|
-
- name: Check out source code
|
31
|
-
uses: actions/checkout@v2
|
32
|
-
|
33
|
-
- name: Install Bundler
|
34
|
-
run: bin/install-bundler
|
35
|
-
|
36
|
-
- name: Compute cache key
|
37
|
-
id: cache-key
|
38
|
-
run: |
|
39
|
-
source /etc/os-release
|
40
|
-
printf \
|
41
|
-
"::set-output name=cache-key::alpine-%s-ruby-%s\n" \
|
42
|
-
"${VERSION_ID}" \
|
43
|
-
"${RUBY_VERSION}"
|
44
|
-
|
45
|
-
- name: Cache gems
|
46
|
-
uses: actions/cache@v2
|
47
|
-
with:
|
48
|
-
key: ${{ steps.cache-key.outputs.cache-key }}-gems-${{ hashFiles('Gemfile.lock') }}
|
49
|
-
path: vendor/bundle
|
50
|
-
|
51
|
-
- name: Install gems
|
52
|
-
run: bin/bundle install
|
53
|
-
env:
|
54
|
-
BUNDLE_FROZEN: true
|
55
|
-
BUNDLE_JOBS: 4
|
56
|
-
BUNDLE_RETRY: 3
|
57
|
-
|
58
|
-
- name: Run RuboCop
|
59
|
-
run: bin/rake rubocop
|
60
|
-
|
61
|
-
- name: Run tests
|
62
|
-
run: bin/rake test
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-minitest
|
3
|
-
- rubocop-rake
|
4
|
-
|
5
|
-
AllCops:
|
6
|
-
NewCops: enable
|
7
|
-
TargetRubyVersion: 2.5
|
8
|
-
Exclude:
|
9
|
-
- bin/bundle
|
10
|
-
- bin/rake
|
11
|
-
- vendor/bundle/**/*
|
12
|
-
|
13
|
-
Layout/LineLength:
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Metrics/MethodLength:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Naming/FileName:
|
20
|
-
Exclude:
|
21
|
-
- lib/yard-relative_markdown_links.rb
|
22
|
-
|
23
|
-
Style/BlockDelimiters:
|
24
|
-
EnforcedStyle: semantic
|
25
|
-
|
26
|
-
Style/Documentation:
|
27
|
-
Exclude:
|
28
|
-
- test/**/*
|
29
|
-
|
30
|
-
Style/HashEachMethods:
|
31
|
-
Enabled: true
|
32
|
-
|
33
|
-
Style/HashSyntax:
|
34
|
-
Exclude:
|
35
|
-
- Rakefile
|
36
|
-
|
37
|
-
Style/HashTransformKeys:
|
38
|
-
Enabled: true
|
39
|
-
|
40
|
-
Style/HashTransformValues:
|
41
|
-
Enabled: true
|
42
|
-
|
43
|
-
Style/Lambda:
|
44
|
-
EnforcedStyle: literal
|
45
|
-
|
46
|
-
Style/StringLiterals:
|
47
|
-
EnforcedStyle: double_quotes
|
48
|
-
|
49
|
-
Style/SymbolArray:
|
50
|
-
EnforcedStyle: brackets
|
51
|
-
|
52
|
-
Style/WordArray:
|
53
|
-
EnforcedStyle: brackets
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.2
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
yard-relative_markdown_links (0.4.1)
|
5
|
-
nokogiri (~> 1.8)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
ast (2.4.2)
|
11
|
-
coderay (1.1.3)
|
12
|
-
method_source (1.0.0)
|
13
|
-
mini_portile2 (2.6.1)
|
14
|
-
minitest (5.14.4)
|
15
|
-
nokogiri (1.12.5)
|
16
|
-
mini_portile2 (~> 2.6.1)
|
17
|
-
racc (~> 1.4)
|
18
|
-
nokogiri (1.12.5-x86_64-darwin)
|
19
|
-
racc (~> 1.4)
|
20
|
-
nokogiri (1.12.5-x86_64-linux)
|
21
|
-
racc (~> 1.4)
|
22
|
-
parallel (1.21.0)
|
23
|
-
parser (3.0.2.0)
|
24
|
-
ast (~> 2.4.1)
|
25
|
-
pry (0.14.1)
|
26
|
-
coderay (~> 1.1)
|
27
|
-
method_source (~> 1.0)
|
28
|
-
racc (1.5.2)
|
29
|
-
rainbow (3.0.0)
|
30
|
-
rake (13.0.6)
|
31
|
-
regexp_parser (2.1.1)
|
32
|
-
rexml (3.2.5)
|
33
|
-
rubocop (1.23.0)
|
34
|
-
parallel (~> 1.10)
|
35
|
-
parser (>= 3.0.0.0)
|
36
|
-
rainbow (>= 2.2.2, < 4.0)
|
37
|
-
regexp_parser (>= 1.8, < 3.0)
|
38
|
-
rexml
|
39
|
-
rubocop-ast (>= 1.12.0, < 2.0)
|
40
|
-
ruby-progressbar (~> 1.7)
|
41
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
42
|
-
rubocop-ast (1.13.0)
|
43
|
-
parser (>= 3.0.1.1)
|
44
|
-
rubocop-minitest (0.16.0)
|
45
|
-
rubocop (>= 0.90, < 2.0)
|
46
|
-
rubocop-rake (0.6.0)
|
47
|
-
rubocop (~> 1.0)
|
48
|
-
ruby-progressbar (1.11.0)
|
49
|
-
unicode-display_width (2.1.0)
|
50
|
-
yard (0.9.26)
|
51
|
-
|
52
|
-
PLATFORMS
|
53
|
-
ruby
|
54
|
-
x86_64-darwin-20
|
55
|
-
x86_64-linux
|
56
|
-
|
57
|
-
DEPENDENCIES
|
58
|
-
bundler
|
59
|
-
minitest
|
60
|
-
pry
|
61
|
-
rake
|
62
|
-
rubocop
|
63
|
-
rubocop-minitest
|
64
|
-
rubocop-rake
|
65
|
-
yard
|
66
|
-
yard-relative_markdown_links!
|
67
|
-
|
68
|
-
BUNDLED WITH
|
69
|
-
2.2.31
|
data/Rakefile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
require "rake/testtask"
|
5
|
-
require "rubocop/rake_task"
|
6
|
-
require "yard"
|
7
|
-
|
8
|
-
Rake::TestTask.new do |task|
|
9
|
-
task.test_files = FileList["test/**/*_test.rb"]
|
10
|
-
end
|
11
|
-
|
12
|
-
RuboCop::RakeTask.new
|
13
|
-
|
14
|
-
desc "Generate documentation"
|
15
|
-
YARD::Rake::YardocTask.new :doc
|
16
|
-
CLOBBER << "doc/"
|
17
|
-
|
18
|
-
task :default => [:doc, :rubocop, :test]
|
data/bin/bundle
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'bundle' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "rubygems"
|
12
|
-
|
13
|
-
m = Module.new do
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def invoked_as_script?
|
17
|
-
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
-
end
|
19
|
-
|
20
|
-
def env_var_version
|
21
|
-
ENV["BUNDLER_VERSION"]
|
22
|
-
end
|
23
|
-
|
24
|
-
def cli_arg_version
|
25
|
-
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
-
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
-
bundler_version = nil
|
28
|
-
update_index = nil
|
29
|
-
ARGV.each_with_index do |a, i|
|
30
|
-
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
-
bundler_version = a
|
32
|
-
end
|
33
|
-
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1 || ">= 0.a"
|
35
|
-
update_index = i
|
36
|
-
end
|
37
|
-
bundler_version
|
38
|
-
end
|
39
|
-
|
40
|
-
def gemfile
|
41
|
-
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
-
return gemfile if gemfile && !gemfile.empty?
|
43
|
-
|
44
|
-
File.expand_path("../../Gemfile", __FILE__)
|
45
|
-
end
|
46
|
-
|
47
|
-
def lockfile
|
48
|
-
lockfile =
|
49
|
-
case File.basename(gemfile)
|
50
|
-
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
-
else "#{gemfile}.lock"
|
52
|
-
end
|
53
|
-
File.expand_path(lockfile)
|
54
|
-
end
|
55
|
-
|
56
|
-
def lockfile_version
|
57
|
-
return unless File.file?(lockfile)
|
58
|
-
lockfile_contents = File.read(lockfile)
|
59
|
-
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
-
Regexp.last_match(1)
|
61
|
-
end
|
62
|
-
|
63
|
-
def bundler_version
|
64
|
-
@bundler_version ||= begin
|
65
|
-
env_var_version || cli_arg_version ||
|
66
|
-
lockfile_version || "#{Gem::Requirement.default}.a"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def load_bundler!
|
71
|
-
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
|
-
|
73
|
-
# must dup string for RG < 1.8 compatibility
|
74
|
-
activate_bundler(bundler_version.dup)
|
75
|
-
end
|
76
|
-
|
77
|
-
def activate_bundler(bundler_version)
|
78
|
-
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
-
bundler_version = "< 2"
|
80
|
-
end
|
81
|
-
gem_error = activation_error_handling do
|
82
|
-
gem "bundler", bundler_version
|
83
|
-
end
|
84
|
-
return if gem_error.nil?
|
85
|
-
require_error = activation_error_handling do
|
86
|
-
require "bundler/version"
|
87
|
-
end
|
88
|
-
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
89
|
-
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
90
|
-
exit 42
|
91
|
-
end
|
92
|
-
|
93
|
-
def activation_error_handling
|
94
|
-
yield
|
95
|
-
nil
|
96
|
-
rescue StandardError, LoadError => e
|
97
|
-
e
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
m.load_bundler!
|
102
|
-
|
103
|
-
if m.invoked_as_script?
|
104
|
-
load Gem.bin_path("bundler", "bundle")
|
105
|
-
end
|
data/bin/console
DELETED
data/bin/install-bundler
DELETED
data/bin/rake
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rake' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("rake", "rake")
|
data/bin/setup
DELETED