manpages 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +123 -0
- data/.rubocop_todo.yml +248 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +14 -0
- data/Rakefile +4 -2
- data/lib/manpages.rb +0 -1
- data/lib/manpages/gem_version.rb +3 -6
- data/lib/manpages/install.rb +5 -9
- data/lib/manpages/man_files.rb +11 -14
- data/lib/manpages/uninstall.rb +4 -8
- data/lib/manpages/version.rb +1 -1
- data/lib/rubygems_plugin.rb +1 -4
- data/manpages.gemspec +8 -5
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 836087ab188069543a0d1bf8a428bab0068df271
|
4
|
+
data.tar.gz: b6927431e0f94f8347dad3d27dd01648a61fed4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eb39868aff19cf9a68c1eb47afa29e670ee80d4f52bc03f497de85eb48cb6a4a351ff858a3a4807209ac68b3679c9080bc28b170edca8dd2eb0959fd1f97b74
|
7
|
+
data.tar.gz: 8d6593ba5828ebc76721be716fa0e781650834b26de6458f86683a567a0210fea448751d8b27e2d4062fd73164b500f0815ee77145954abd17d032544f4796ff
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_todo.yml
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 1.9
|
6
|
+
Exclude:
|
7
|
+
- tmp/**/*
|
8
|
+
- lib/bundler/vendor/**/*
|
9
|
+
- vendor/bundle/**/*
|
10
|
+
DisplayCopNames: true
|
11
|
+
|
12
|
+
# Lint
|
13
|
+
|
14
|
+
# They are idiomatic
|
15
|
+
Lint/AssignmentInCondition:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Lint/EndAlignment:
|
19
|
+
AlignWith: variable
|
20
|
+
AutoCorrect: true
|
21
|
+
|
22
|
+
Lint/UnusedMethodArgument:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# Style
|
26
|
+
|
27
|
+
Style/AccessModifierIndentation:
|
28
|
+
EnforcedStyle: outdent
|
29
|
+
|
30
|
+
Style/Alias:
|
31
|
+
EnforcedStyle: prefer_alias_method
|
32
|
+
|
33
|
+
Style/AlignParameters:
|
34
|
+
EnforcedStyle: with_fixed_indentation
|
35
|
+
|
36
|
+
Style/MultilineBlockChain:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/MultilineOperationIndentation:
|
40
|
+
EnforcedStyle: indented
|
41
|
+
|
42
|
+
Style/PerlBackrefs:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/SingleLineBlockParams:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/SpaceInsideBlockBraces:
|
49
|
+
SpaceBeforeBlockParameters: false
|
50
|
+
|
51
|
+
Style/TrivialAccessors:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
# We adopted raise instead of fail.
|
55
|
+
Style/SignalException:
|
56
|
+
EnforcedStyle: only_raise
|
57
|
+
|
58
|
+
Style/StringLiterals:
|
59
|
+
EnforcedStyle: double_quotes
|
60
|
+
|
61
|
+
Style/StringLiteralsInInterpolation:
|
62
|
+
EnforcedStyle: double_quotes
|
63
|
+
|
64
|
+
# Having these make it easier to *not* forget to add one when adding a new
|
65
|
+
# value and you can simply copy the previous line.
|
66
|
+
Style/TrailingCommaInLiteral:
|
67
|
+
EnforcedStyleForMultiline: comma
|
68
|
+
|
69
|
+
Style/TrailingUnderscoreVariable:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# `String.new` is preferred style with enabled frozen string literal
|
73
|
+
Style/EmptyLiteral:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
# 1.8.7 support
|
77
|
+
|
78
|
+
Style/Lambda:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Style/DotPosition:
|
82
|
+
EnforcedStyle: trailing
|
83
|
+
|
84
|
+
Style/EachWithObject:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
Style/SpecialGlobalVars:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
Style/TrailingCommaInArguments:
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
Performance/FlatMap:
|
94
|
+
Enabled: false
|
95
|
+
|
96
|
+
# Metrics
|
97
|
+
|
98
|
+
# We've chosen to use Rubocop only for style, and not for complexity or quality checks.
|
99
|
+
Metrics/ClassLength:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
Metrics/ModuleLength:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
Metrics/MethodLength:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
Metrics/BlockNesting:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Metrics/AbcSize:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Metrics/CyclomaticComplexity:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Metrics/ParameterLists:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
121
|
+
# rules for us.
|
122
|
+
Metrics/PerceivedComplexity:
|
123
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-07-27 12:41:39 -0500 using RuboCop version 0.41.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 4
|
10
|
+
Lint/Eval:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/bundler.rb'
|
13
|
+
- 'lib/bundler/endpoint_specification.rb'
|
14
|
+
- 'spec/support/streams.rb'
|
15
|
+
|
16
|
+
# Offense count: 4
|
17
|
+
Lint/HandleExceptions:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/bundler/installer.rb'
|
20
|
+
- 'lib/bundler/psyched_yaml.rb'
|
21
|
+
- 'lib/bundler/vendored_persistent.rb'
|
22
|
+
|
23
|
+
# Offense count: 1
|
24
|
+
Lint/IneffectiveAccessModifier:
|
25
|
+
Exclude:
|
26
|
+
- 'lib/bundler/settings.rb'
|
27
|
+
|
28
|
+
# Offense count: 3
|
29
|
+
Lint/NestedMethodDefinition:
|
30
|
+
Exclude:
|
31
|
+
- 'lib/bundler/inline.rb'
|
32
|
+
- 'spec/support/builders.rb'
|
33
|
+
|
34
|
+
# Offense count: 5
|
35
|
+
Lint/RescueException:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/bundler/cli.rb'
|
38
|
+
- 'lib/bundler/dsl.rb'
|
39
|
+
- 'lib/bundler/friendly_errors.rb'
|
40
|
+
- 'lib/bundler/rubygems_integration.rb'
|
41
|
+
- 'lib/bundler/worker.rb'
|
42
|
+
|
43
|
+
# Offense count: 1
|
44
|
+
Lint/UselessAccessModifier:
|
45
|
+
Exclude:
|
46
|
+
- 'lib/bundler/fetcher.rb'
|
47
|
+
|
48
|
+
# Offense count: 6
|
49
|
+
Lint/UselessAssignment:
|
50
|
+
Exclude:
|
51
|
+
- 'lib/bundler/index.rb'
|
52
|
+
- 'lib/bundler/installer.rb'
|
53
|
+
|
54
|
+
# Offense count: 1686
|
55
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
56
|
+
# URISchemes: http, https
|
57
|
+
Metrics/LineLength:
|
58
|
+
Max: 207
|
59
|
+
|
60
|
+
# Offense count: 3
|
61
|
+
# Configuration parameters: CountKeywordArgs.
|
62
|
+
Metrics/ParameterLists:
|
63
|
+
Max: 6
|
64
|
+
|
65
|
+
# Offense count: 6
|
66
|
+
# Cop supports --auto-correct.
|
67
|
+
Performance/RedundantBlockCall:
|
68
|
+
Exclude:
|
69
|
+
- 'lib/bundler/dsl.rb'
|
70
|
+
- 'lib/bundler/gem_helper.rb'
|
71
|
+
- 'lib/bundler/retry.rb'
|
72
|
+
- 'lib/bundler/shared_helpers.rb'
|
73
|
+
- 'spec/support/helpers.rb'
|
74
|
+
|
75
|
+
# Offense count: 2
|
76
|
+
# Cop supports --auto-correct.
|
77
|
+
Performance/RedundantMatch:
|
78
|
+
Exclude:
|
79
|
+
- 'lib/bundler/definition.rb'
|
80
|
+
- 'lib/bundler/lockfile_parser.rb'
|
81
|
+
|
82
|
+
# Offense count: 6
|
83
|
+
# Cop supports --auto-correct.
|
84
|
+
# Configuration parameters: MaxKeyValuePairs.
|
85
|
+
Performance/RedundantMerge:
|
86
|
+
Exclude:
|
87
|
+
- 'lib/bundler/cli/gem.rb'
|
88
|
+
- 'spec/support/helpers.rb'
|
89
|
+
|
90
|
+
# Offense count: 1
|
91
|
+
Style/AccessorMethodName:
|
92
|
+
Exclude:
|
93
|
+
- 'lib/bundler/source/git.rb'
|
94
|
+
|
95
|
+
# Offense count: 3
|
96
|
+
Style/CaseEquality:
|
97
|
+
Exclude:
|
98
|
+
- 'lib/bundler/dsl.rb'
|
99
|
+
- 'lib/bundler/match_platform.rb'
|
100
|
+
- 'lib/bundler/rubygems_ext.rb'
|
101
|
+
|
102
|
+
# Offense count: 23
|
103
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
104
|
+
# SupportedStyles: nested, compact
|
105
|
+
Style/ClassAndModuleChildren:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
# Offense count: 10
|
109
|
+
# Cop supports --auto-correct.
|
110
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
|
111
|
+
# SupportedStyles: assign_to_condition, assign_inside_condition
|
112
|
+
Style/ConditionalAssignment:
|
113
|
+
Exclude:
|
114
|
+
- 'lib/bundler/cli.rb'
|
115
|
+
- 'lib/bundler/cli/gem.rb'
|
116
|
+
- 'lib/bundler/cli/lock.rb'
|
117
|
+
- 'lib/bundler/cli/platform.rb'
|
118
|
+
- 'lib/bundler/dsl.rb'
|
119
|
+
- 'lib/bundler/lazy_specification.rb'
|
120
|
+
- 'lib/bundler/psyched_yaml.rb'
|
121
|
+
- 'lib/bundler/rubygems_integration.rb'
|
122
|
+
- 'lib/bundler/source/git.rb'
|
123
|
+
- 'lib/bundler/source/rubygems.rb'
|
124
|
+
|
125
|
+
# Offense count: 138
|
126
|
+
Style/Documentation:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
# Offense count: 2
|
130
|
+
# Cop supports --auto-correct.
|
131
|
+
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
132
|
+
Style/ExtraSpacing:
|
133
|
+
Exclude:
|
134
|
+
- 'lib/bundler/cli.rb'
|
135
|
+
|
136
|
+
# Offense count: 4
|
137
|
+
# Configuration parameters: AllowedVariables.
|
138
|
+
Style/GlobalVars:
|
139
|
+
Exclude:
|
140
|
+
- 'lib/bundler/cli.rb'
|
141
|
+
- 'spec/spec_helper.rb'
|
142
|
+
- 'spec/support/helpers.rb'
|
143
|
+
|
144
|
+
# Offense count: 1
|
145
|
+
Style/IfInsideElse:
|
146
|
+
Exclude:
|
147
|
+
- 'lib/bundler/cli/install.rb'
|
148
|
+
|
149
|
+
# Offense count: 1
|
150
|
+
Style/IfUnlessModifierOfIfUnless:
|
151
|
+
Exclude:
|
152
|
+
- 'spec/support/helpers.rb'
|
153
|
+
|
154
|
+
# Offense count: 4
|
155
|
+
# Cop supports --auto-correct.
|
156
|
+
# Configuration parameters: SupportedStyles, IndentationWidth.
|
157
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
158
|
+
Style/IndentArray:
|
159
|
+
EnforcedStyle: consistent
|
160
|
+
|
161
|
+
# Offense count: 2
|
162
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
163
|
+
# SupportedStyles: module_function, extend_self
|
164
|
+
Style/ModuleFunction:
|
165
|
+
Exclude:
|
166
|
+
- 'lib/bundler/shared_helpers.rb'
|
167
|
+
- 'spec/support/path.rb'
|
168
|
+
|
169
|
+
# Offense count: 3
|
170
|
+
# Cop supports --auto-correct.
|
171
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
172
|
+
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
173
|
+
Style/MultilineMethodCallIndentation:
|
174
|
+
Exclude:
|
175
|
+
- 'lib/bundler/cli/common.rb'
|
176
|
+
- 'spec/bundler/plugin/source_list_spec.rb'
|
177
|
+
|
178
|
+
# Offense count: 3
|
179
|
+
# Cop supports --auto-correct.
|
180
|
+
Style/NestedParenthesizedCalls:
|
181
|
+
Exclude:
|
182
|
+
- 'lib/bundler/resolver.rb'
|
183
|
+
- 'spec/commands/lock_spec.rb'
|
184
|
+
- 'spec/runtime/setup_spec.rb'
|
185
|
+
|
186
|
+
# Offense count: 9
|
187
|
+
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
188
|
+
# NamePrefix: is_, has_, have_
|
189
|
+
# NamePrefixBlacklist: is_, has_, have_
|
190
|
+
# NameWhitelist: is_a?
|
191
|
+
Style/PredicateName:
|
192
|
+
Exclude:
|
193
|
+
- 'spec/**/*'
|
194
|
+
- 'lib/bundler/definition.rb'
|
195
|
+
- 'lib/bundler/installer/parallel_installer.rb'
|
196
|
+
- 'lib/bundler/settings.rb'
|
197
|
+
- 'lib/bundler/source/git.rb'
|
198
|
+
- 'lib/bundler/source/git/git_proxy.rb'
|
199
|
+
- 'lib/bundler/source/path.rb'
|
200
|
+
|
201
|
+
# Offense count: 25
|
202
|
+
# Cop supports --auto-correct.
|
203
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
204
|
+
# SupportedStyles: compact, exploded
|
205
|
+
Style/RaiseArgs:
|
206
|
+
Enabled: false
|
207
|
+
|
208
|
+
# Offense count: 2
|
209
|
+
# Cop supports --auto-correct.
|
210
|
+
Style/RedundantParentheses:
|
211
|
+
Exclude:
|
212
|
+
- 'lib/bundler/cli/console.rb'
|
213
|
+
- 'lib/bundler/dsl.rb'
|
214
|
+
|
215
|
+
# Offense count: 1
|
216
|
+
# Cop supports --auto-correct.
|
217
|
+
# Configuration parameters: AllowForAlignment.
|
218
|
+
Style/SpaceAroundOperators:
|
219
|
+
Exclude:
|
220
|
+
- 'lib/bundler/retry.rb'
|
221
|
+
|
222
|
+
# Offense count: 10
|
223
|
+
# Cop supports --auto-correct.
|
224
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
225
|
+
# SupportedStyles: comma, consistent_comma, no_comma
|
226
|
+
Style/TrailingCommaInLiteral:
|
227
|
+
Exclude:
|
228
|
+
- 'lib/bundler/cli/gem.rb'
|
229
|
+
- 'lib/bundler/dependency.rb'
|
230
|
+
- 'lib/bundler/fetcher.rb'
|
231
|
+
- 'lib/bundler/gem_helpers.rb'
|
232
|
+
- 'lib/bundler/graph.rb'
|
233
|
+
- 'lib/bundler/ruby_version.rb'
|
234
|
+
- 'lib/bundler/similarity_detector.rb'
|
235
|
+
- 'spec/support/artifice/endpoint.rb'
|
236
|
+
|
237
|
+
# Offense count: 18
|
238
|
+
# Cop supports --auto-correct.
|
239
|
+
Style/UnneededInterpolation:
|
240
|
+
Exclude:
|
241
|
+
- 'lib/bundler/cli/config.rb'
|
242
|
+
- 'lib/bundler/env.rb'
|
243
|
+
- 'spec/bundler/shared_helpers_spec.rb'
|
244
|
+
- 'spec/cache/git_spec.rb'
|
245
|
+
- 'spec/commands/exec_spec.rb'
|
246
|
+
- 'spec/support/artifice/endpoint.rb'
|
247
|
+
- 'spec/support/artifice/endpoint_500.rb'
|
248
|
+
- 'spec/support/fakeweb/windows.rb'
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,13 +6,18 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
ast (2.3.0)
|
9
10
|
coderay (1.1.1)
|
10
11
|
diff-lcs (1.2.5)
|
11
12
|
method_source (0.8.2)
|
13
|
+
parser (2.3.1.4)
|
14
|
+
ast (~> 2.2)
|
15
|
+
powerpack (0.1.1)
|
12
16
|
pry (0.10.3)
|
13
17
|
coderay (~> 1.1.0)
|
14
18
|
method_source (~> 0.8.1)
|
15
19
|
slop (~> 3.4)
|
20
|
+
rainbow (2.1.0)
|
16
21
|
rake (10.5.0)
|
17
22
|
rspec (3.5.0)
|
18
23
|
rspec-core (~> 3.5.0)
|
@@ -27,7 +32,15 @@ GEM
|
|
27
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
33
|
rspec-support (~> 3.5.0)
|
29
34
|
rspec-support (3.5.0)
|
35
|
+
rubocop (0.44.1)
|
36
|
+
parser (>= 2.3.1.1, < 3.0)
|
37
|
+
powerpack (~> 0.1)
|
38
|
+
rainbow (>= 1.99.1, < 3.0)
|
39
|
+
ruby-progressbar (~> 1.7)
|
40
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
41
|
+
ruby-progressbar (1.8.1)
|
30
42
|
slop (3.6.0)
|
43
|
+
unicode-display_width (1.1.1)
|
31
44
|
|
32
45
|
PLATFORMS
|
33
46
|
ruby
|
@@ -38,6 +51,7 @@ DEPENDENCIES
|
|
38
51
|
pry (~> 0)
|
39
52
|
rake (~> 10.0)
|
40
53
|
rspec (~> 3.0)
|
54
|
+
rubocop (~> 0.44.1)
|
41
55
|
|
42
56
|
BUNDLED WITH
|
43
57
|
1.13.6
|
data/Rakefile
CHANGED
data/lib/manpages.rb
CHANGED
data/lib/manpages/gem_version.rb
CHANGED
@@ -1,24 +1,21 @@
|
|
1
1
|
module Manpages
|
2
|
-
|
3
2
|
class GemVersion
|
4
|
-
|
5
3
|
def initialize(gem_spec)
|
6
4
|
@gem_spec = gem_spec
|
7
5
|
end
|
8
6
|
|
9
|
-
def
|
7
|
+
def latest?
|
10
8
|
latest_gem.nil? || latest_gem <= @gem_spec.version
|
11
9
|
end
|
12
10
|
|
13
|
-
|
11
|
+
private
|
14
12
|
|
15
13
|
def latest_gem
|
16
14
|
all_gem_versions.sort.last
|
17
15
|
end
|
18
16
|
|
19
17
|
def all_gem_versions
|
20
|
-
Gem::Specification.each.select {
|
18
|
+
Gem::Specification.each.select {|spec| @gem_spec.name == spec.name }.map(&:version)
|
21
19
|
end
|
22
|
-
|
23
20
|
end
|
24
21
|
end
|
data/lib/manpages/install.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Manpages
|
2
|
-
|
3
2
|
class Install
|
4
|
-
|
5
3
|
def initialize(gem_spec, gem_dir, target_dir)
|
6
4
|
@gem_spec = gem_spec
|
7
5
|
@gem_dir = gem_dir
|
@@ -9,10 +7,10 @@ module Manpages
|
|
9
7
|
end
|
10
8
|
|
11
9
|
def install_manpages
|
12
|
-
link_manpages if GemVersion.new(@gem_spec).
|
10
|
+
link_manpages if GemVersion.new(@gem_spec).latest?
|
13
11
|
end
|
14
12
|
|
15
|
-
|
13
|
+
private
|
16
14
|
|
17
15
|
def link_manpages
|
18
16
|
ManFiles.new(@gem_dir, @target_dir).manpages.each do |file|
|
@@ -22,16 +20,14 @@ module Manpages
|
|
22
20
|
|
23
21
|
def link_manpage(file)
|
24
22
|
man_target_file = ManFiles.new(@gem_dir, @target_dir).man_file_path(file)
|
25
|
-
return if
|
23
|
+
return if man_target_file.exist?
|
26
24
|
|
27
25
|
begin
|
28
|
-
FileUtils.mkdir_p(
|
26
|
+
FileUtils.mkdir_p(man_target_file.dirname)
|
29
27
|
FileUtils.ln_s(file, man_target_file, force: true)
|
30
|
-
rescue
|
28
|
+
rescue
|
31
29
|
puts "Problems creating symlink #{man_target_file}"
|
32
30
|
end
|
33
31
|
end
|
34
|
-
|
35
32
|
end
|
36
|
-
|
37
33
|
end
|
data/lib/manpages/man_files.rb
CHANGED
@@ -1,28 +1,25 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
1
3
|
module Manpages
|
2
4
|
class ManFiles
|
5
|
+
attr_reader :man_dir
|
3
6
|
|
4
7
|
def initialize(gem_dir, target_dir)
|
5
|
-
@
|
6
|
-
@
|
8
|
+
@target_dir = Pathname(target_dir)
|
9
|
+
@man_dir = Pathname(File.join(gem_dir, "man"))
|
7
10
|
end
|
8
11
|
|
9
12
|
def manpages
|
10
|
-
return [] unless
|
11
|
-
|
12
|
-
Dir.entries(man_dir).select do |file|
|
13
|
-
file =~ /(.+).\d$/
|
14
|
-
end.map {|file| File.join(man_dir, file) }
|
15
|
-
end
|
13
|
+
return [] unless man_dir.directory?
|
16
14
|
|
17
|
-
|
18
|
-
|
15
|
+
man_dir.children(false).select do |file|
|
16
|
+
file.extname =~ /.\d$/
|
17
|
+
end.map {|file| man_dir.join(file) }
|
19
18
|
end
|
20
19
|
|
21
20
|
def man_file_path(file)
|
22
|
-
|
23
|
-
man_section
|
24
|
-
File.join(@target_dir, "man#{man_section[1]}", basename)
|
21
|
+
man_section = file.extname.match(/\.(\d*)/)
|
22
|
+
@target_dir.join("man#{man_section[1]}", file.basename)
|
25
23
|
end
|
26
|
-
|
27
24
|
end
|
28
25
|
end
|
data/lib/manpages/uninstall.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Manpages
|
2
|
-
|
3
2
|
class Uninstall
|
4
|
-
|
5
3
|
def initialize(gem_spec, gem_dir, target_dir)
|
6
4
|
@gem_spec = gem_spec
|
7
5
|
@gem_dir = gem_dir
|
@@ -9,10 +7,10 @@ module Manpages
|
|
9
7
|
end
|
10
8
|
|
11
9
|
def uninstall_manpages
|
12
|
-
unlink_manpages if GemVersion.new(@gem_spec).
|
10
|
+
unlink_manpages if GemVersion.new(@gem_spec).latest?
|
13
11
|
end
|
14
12
|
|
15
|
-
|
13
|
+
private
|
16
14
|
|
17
15
|
def unlink_manpages
|
18
16
|
ManFiles.new(@gem_dir, @target_dir).manpages.each do |file|
|
@@ -22,10 +20,8 @@ module Manpages
|
|
22
20
|
|
23
21
|
def unlink_manpage(file)
|
24
22
|
man_target_file = ManFiles.new(@gem_dir, @target_dir).man_file_path(file)
|
25
|
-
|
26
|
-
|
27
|
-
end
|
23
|
+
FileUtils.rm(man_target_file) if man_target_file.symlink? &&
|
24
|
+
man_target_file.readlink == file
|
28
25
|
end
|
29
|
-
|
30
26
|
end
|
31
27
|
end
|
data/lib/manpages/version.rb
CHANGED
data/lib/rubygems_plugin.rb
CHANGED
data/manpages.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "manpages/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "manpages"
|
@@ -15,13 +15,16 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = "MIT"
|
16
16
|
spec.homepage = "https://github.com/bitboxer/manpages"
|
17
17
|
|
18
|
-
spec.files = `git ls-files -z`.split("\x0").reject
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
19
21
|
spec.bindir = "exe"
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) {
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
21
23
|
spec.require_paths = ["lib"]
|
22
24
|
|
23
25
|
spec.add_development_dependency "bundler", "~> 1.8"
|
24
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
-
spec.add_development_dependency "pry",
|
28
|
+
spec.add_development_dependency "pry", "~> 0"
|
29
|
+
spec.add_development_dependency "rubocop", "~> 0.44.1"
|
27
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manpages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bodo Tasche
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.44.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.44.1
|
69
83
|
description: This is a little experiment that adds man pages support to rubygems
|
70
84
|
email:
|
71
85
|
- bodo@tasche.me
|
@@ -74,6 +88,9 @@ extensions: []
|
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
76
90
|
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- ".rubocop_todo.yml"
|
77
94
|
- ".travis.yml"
|
78
95
|
- CODE_OF_CONDUCT.md
|
79
96
|
- Gemfile
|