fcrepo_wrapper 0.5.2 → 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/.rubocop.yml +0 -2
- data/.rubocop_todo.yml +190 -0
- data/.travis.yml +5 -5
- data/Rakefile +1 -1
- data/exe/fcrepo_wrapper +6 -4
- data/fcrepo_wrapper.gemspec +1 -0
- data/lib/fcrepo_wrapper.rb +1 -1
- data/lib/fcrepo_wrapper/configuration.rb +21 -14
- data/lib/fcrepo_wrapper/version.rb +1 -1
- data/spec/fixtures/another_sample_config.yml +2 -0
- data/spec/lib/fcrepo_wrapper/configuration_spec.rb +18 -0
- data/spec/lib/fcrepo_wrapper/instance_spec.rb +2 -2
- metadata +19 -4
- data/.rubocop_hound.yml +0 -1063
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f35da2e7c8fd52e646e683d3a03dfe50e0408d3e
|
|
4
|
+
data.tar.gz: 7e6fc71cb0050d0cdcd43284a48240d2cb318693
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4367738cd14d10256b4a6303390227092e126dae0582d8ece89af411341fcdcf9d296274967b74e6efdfd4847e7c67550ade76a115df8282f88c296f8f0d90b
|
|
7
|
+
data.tar.gz: c278c4978fd8751fa0d34556712ee9ad03c29be7b6690e0cc9e47200bb2a0ff2a880307a79609aa7af83b5008dcb501201980a85320e6cac9aeae34d72a551d3
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2016-07-07 11:09:07 -0700 using RuboCop version 0.41.1.
|
|
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: 1
|
|
10
|
+
Lint/AmbiguousOperator:
|
|
11
|
+
Exclude:
|
|
12
|
+
- 'lib/fcrepo_wrapper.rb'
|
|
13
|
+
|
|
14
|
+
# Offense count: 11
|
|
15
|
+
# Cop supports --auto-correct.
|
|
16
|
+
Lint/DeprecatedClassMethods:
|
|
17
|
+
Exclude:
|
|
18
|
+
- 'lib/fcrepo_wrapper/configuration.rb'
|
|
19
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
20
|
+
- 'lib/fcrepo_wrapper/md5.rb'
|
|
21
|
+
- 'spec/lib/fcrepo_wrapper/instance_spec.rb'
|
|
22
|
+
|
|
23
|
+
# Offense count: 2
|
|
24
|
+
# Configuration parameters: CountComments.
|
|
25
|
+
Metrics/ClassLength:
|
|
26
|
+
Max: 135
|
|
27
|
+
|
|
28
|
+
# Offense count: 2
|
|
29
|
+
# Configuration parameters: CountComments.
|
|
30
|
+
Metrics/MethodLength:
|
|
31
|
+
Max: 16
|
|
32
|
+
|
|
33
|
+
# Offense count: 4
|
|
34
|
+
# Cop supports --auto-correct.
|
|
35
|
+
Style/AlignArray:
|
|
36
|
+
Exclude:
|
|
37
|
+
- 'lib/fcrepo_wrapper/configuration.rb'
|
|
38
|
+
|
|
39
|
+
# Offense count: 1
|
|
40
|
+
# Cop supports --auto-correct.
|
|
41
|
+
Style/ColonMethodCall:
|
|
42
|
+
Exclude:
|
|
43
|
+
- 'spec/lib/fcrepo_wrapper_spec.rb'
|
|
44
|
+
|
|
45
|
+
# Offense count: 1
|
|
46
|
+
# Cop supports --auto-correct.
|
|
47
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
|
|
48
|
+
# SupportedStyles: assign_to_condition, assign_inside_condition
|
|
49
|
+
Style/ConditionalAssignment:
|
|
50
|
+
Exclude:
|
|
51
|
+
- 'exe/fcrepo_wrapper'
|
|
52
|
+
|
|
53
|
+
# Offense count: 6
|
|
54
|
+
Style/Documentation:
|
|
55
|
+
Exclude:
|
|
56
|
+
- 'spec/**/*'
|
|
57
|
+
- 'test/**/*'
|
|
58
|
+
- 'lib/fcrepo_wrapper.rb'
|
|
59
|
+
- 'lib/fcrepo_wrapper/configuration.rb'
|
|
60
|
+
- 'lib/fcrepo_wrapper/downloader.rb'
|
|
61
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
62
|
+
- 'lib/fcrepo_wrapper/md5.rb'
|
|
63
|
+
- 'lib/fcrepo_wrapper/rake_task.rb'
|
|
64
|
+
|
|
65
|
+
# Offense count: 2
|
|
66
|
+
Style/DoubleNegation:
|
|
67
|
+
Exclude:
|
|
68
|
+
- 'lib/fcrepo_wrapper/configuration.rb'
|
|
69
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
70
|
+
|
|
71
|
+
# Offense count: 2
|
|
72
|
+
# Configuration parameters: MinBodyLength.
|
|
73
|
+
Style/GuardClause:
|
|
74
|
+
Exclude:
|
|
75
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
76
|
+
- 'lib/fcrepo_wrapper/md5.rb'
|
|
77
|
+
|
|
78
|
+
# Offense count: 1
|
|
79
|
+
# Cop supports --auto-correct.
|
|
80
|
+
# Configuration parameters: MaxLineLength.
|
|
81
|
+
Style/IfUnlessModifier:
|
|
82
|
+
Exclude:
|
|
83
|
+
- 'lib/fcrepo_wrapper/downloader.rb'
|
|
84
|
+
|
|
85
|
+
# Offense count: 1
|
|
86
|
+
# Cop supports --auto-correct.
|
|
87
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
88
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
89
|
+
Style/IndentHash:
|
|
90
|
+
Exclude:
|
|
91
|
+
- 'exe/fcrepo_wrapper'
|
|
92
|
+
|
|
93
|
+
# Offense count: 14
|
|
94
|
+
# Cop supports --auto-correct.
|
|
95
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
96
|
+
# SupportedStyles: normal, rails
|
|
97
|
+
Style/IndentationConsistency:
|
|
98
|
+
Exclude:
|
|
99
|
+
- 'lib/fcrepo_wrapper/configuration.rb'
|
|
100
|
+
- 'lib/fcrepo_wrapper/md5.rb'
|
|
101
|
+
- 'lib/fcrepo_wrapper/settings.rb'
|
|
102
|
+
|
|
103
|
+
# Offense count: 1
|
|
104
|
+
# Cop supports --auto-correct.
|
|
105
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
106
|
+
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
|
107
|
+
Style/MultilineMethodCallIndentation:
|
|
108
|
+
Exclude:
|
|
109
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
110
|
+
|
|
111
|
+
# Offense count: 1
|
|
112
|
+
# Cop supports --auto-correct.
|
|
113
|
+
Style/NegatedWhile:
|
|
114
|
+
Exclude:
|
|
115
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
116
|
+
|
|
117
|
+
# Offense count: 1
|
|
118
|
+
# Cop supports --auto-correct.
|
|
119
|
+
Style/RedundantException:
|
|
120
|
+
Exclude:
|
|
121
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
122
|
+
|
|
123
|
+
# Offense count: 1
|
|
124
|
+
# Cop supports --auto-correct.
|
|
125
|
+
Style/SpaceAfterComma:
|
|
126
|
+
Exclude:
|
|
127
|
+
- 'lib/fcrepo_wrapper/rake_task.rb'
|
|
128
|
+
|
|
129
|
+
# Offense count: 2
|
|
130
|
+
# Cop supports --auto-correct.
|
|
131
|
+
Style/SpaceAroundKeyword:
|
|
132
|
+
Exclude:
|
|
133
|
+
- 'lib/fcrepo_wrapper/downloader.rb'
|
|
134
|
+
|
|
135
|
+
# Offense count: 68
|
|
136
|
+
# Cop supports --auto-correct.
|
|
137
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
|
138
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
139
|
+
Style/StringLiterals:
|
|
140
|
+
Exclude:
|
|
141
|
+
- 'exe/fcrepo_wrapper'
|
|
142
|
+
- 'lib/fcrepo_wrapper/configuration.rb'
|
|
143
|
+
- 'lib/fcrepo_wrapper/downloader.rb'
|
|
144
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
145
|
+
- 'lib/fcrepo_wrapper/md5.rb'
|
|
146
|
+
- 'lib/fcrepo_wrapper/rake_task.rb'
|
|
147
|
+
- 'lib/fcrepo_wrapper/tasks/fcrepo_wrapper.rake'
|
|
148
|
+
- 'spec/lib/fcrepo_wrapper/configuration_spec.rb'
|
|
149
|
+
- 'spec/lib/fcrepo_wrapper/instance_spec.rb'
|
|
150
|
+
- 'spec/lib/fcrepo_wrapper/md5_spec.rb'
|
|
151
|
+
- 'spec/lib/fcrepo_wrapper_spec.rb'
|
|
152
|
+
- 'spec/spec_helper.rb'
|
|
153
|
+
|
|
154
|
+
# Offense count: 3
|
|
155
|
+
# Cop supports --auto-correct.
|
|
156
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
157
|
+
# SupportedStyles: final_newline, final_blank_line
|
|
158
|
+
Style/TrailingBlankLines:
|
|
159
|
+
Exclude:
|
|
160
|
+
- 'lib/fcrepo_wrapper/downloader.rb'
|
|
161
|
+
- 'lib/fcrepo_wrapper/md5.rb'
|
|
162
|
+
- 'lib/fcrepo_wrapper/settings.rb'
|
|
163
|
+
|
|
164
|
+
# Offense count: 1
|
|
165
|
+
# Cop supports --auto-correct.
|
|
166
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
|
167
|
+
# SupportedStyles: comma, consistent_comma, no_comma
|
|
168
|
+
Style/TrailingCommaInLiteral:
|
|
169
|
+
Exclude:
|
|
170
|
+
- 'exe/fcrepo_wrapper'
|
|
171
|
+
|
|
172
|
+
# Offense count: 1
|
|
173
|
+
# Cop supports --auto-correct.
|
|
174
|
+
Style/TrailingWhitespace:
|
|
175
|
+
Exclude:
|
|
176
|
+
- 'spec/lib/fcrepo_wrapper/instance_spec.rb'
|
|
177
|
+
|
|
178
|
+
# Offense count: 1
|
|
179
|
+
# Cop supports --auto-correct.
|
|
180
|
+
Style/UnneededInterpolation:
|
|
181
|
+
Exclude:
|
|
182
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
|
183
|
+
|
|
184
|
+
# Offense count: 3
|
|
185
|
+
# Cop supports --auto-correct.
|
|
186
|
+
# Configuration parameters: MaxLineLength.
|
|
187
|
+
Style/WhileUntilModifier:
|
|
188
|
+
Exclude:
|
|
189
|
+
- 'exe/fcrepo_wrapper'
|
|
190
|
+
- 'lib/fcrepo_wrapper/instance.rb'
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/exe/fcrepo_wrapper
CHANGED
|
@@ -64,7 +64,10 @@ subcommands = {
|
|
|
64
64
|
begin
|
|
65
65
|
args.order!
|
|
66
66
|
command = ARGV.shift
|
|
67
|
-
|
|
67
|
+
if command
|
|
68
|
+
raise "Bad subcommand: #{command}" unless subcommands[command]
|
|
69
|
+
subcommands[command].order!
|
|
70
|
+
end
|
|
68
71
|
args.parse!
|
|
69
72
|
rescue => error
|
|
70
73
|
$stderr.puts "ERROR: #{error}\n"
|
|
@@ -72,9 +75,6 @@ rescue => error
|
|
|
72
75
|
exit 1
|
|
73
76
|
end
|
|
74
77
|
|
|
75
|
-
# default to verbose
|
|
76
|
-
options[:verbose] = true if options[:verbose].nil?
|
|
77
|
-
|
|
78
78
|
instance = FcrepoWrapper.default_instance(options)
|
|
79
79
|
|
|
80
80
|
if command == 'clean'
|
|
@@ -91,6 +91,8 @@ instance.wrap do |conn|
|
|
|
91
91
|
sleep 1
|
|
92
92
|
end
|
|
93
93
|
rescue Interrupt
|
|
94
|
+
Signal.trap("SIGTERM") { "IGNORE" }
|
|
95
|
+
Signal.trap("SIGINT") { "IGNORE" }
|
|
94
96
|
$stderr.puts "Fedora is shutting down."
|
|
95
97
|
end
|
|
96
98
|
end
|
data/fcrepo_wrapper.gemspec
CHANGED
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
25
25
|
|
|
26
26
|
spec.add_development_dependency "rspec"
|
|
27
|
+
spec.add_development_dependency "rubocop"
|
|
27
28
|
spec.add_development_dependency "simple_solr_client"
|
|
28
29
|
spec.add_development_dependency "coveralls"
|
|
29
30
|
end
|
data/lib/fcrepo_wrapper.rb
CHANGED
|
@@ -6,8 +6,9 @@ module FcrepoWrapper
|
|
|
6
6
|
class Configuration
|
|
7
7
|
attr_reader :options
|
|
8
8
|
def initialize(options)
|
|
9
|
-
@
|
|
10
|
-
|
|
9
|
+
@config = options[:config]
|
|
10
|
+
@verbose = options[:verbose]
|
|
11
|
+
@options = load_configs(Array(options[:config])).merge(options)
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
def instance_dir
|
|
@@ -63,7 +64,7 @@ module FcrepoWrapper
|
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
def verbose?
|
|
66
|
-
!!options.fetch(:verbose, false)
|
|
67
|
+
@verbose || (options && !!options.fetch(:verbose, false))
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def managed?
|
|
@@ -114,28 +115,34 @@ module FcrepoWrapper
|
|
|
114
115
|
|
|
115
116
|
private
|
|
116
117
|
|
|
117
|
-
def
|
|
118
|
-
|
|
118
|
+
def load_configs(config_files)
|
|
119
|
+
config = {}
|
|
120
|
+
|
|
121
|
+
(default_configuration_paths + config_files.compact).each do |p|
|
|
119
122
|
path = File.expand_path(p)
|
|
120
|
-
|
|
123
|
+
next unless File.exist? path
|
|
124
|
+
config.merge!(read_config(path))
|
|
121
125
|
end
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return {}
|
|
126
|
-
end
|
|
127
|
+
config
|
|
128
|
+
end
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
def read_config(config_file)
|
|
131
|
+
$stdout.puts "Loading configuration from #{config_file}" if verbose?
|
|
129
132
|
config = YAML.load(ERB.new(IO.read(config_file)).result(binding))
|
|
130
133
|
unless config
|
|
131
|
-
$stderr.puts "Unable to parse config #{config_file}" if verbose
|
|
134
|
+
$stderr.puts "Unable to parse config #{config_file}" if verbose?
|
|
132
135
|
return {}
|
|
133
136
|
end
|
|
134
|
-
config
|
|
137
|
+
convert_keys(config)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def convert_keys(hash)
|
|
141
|
+
hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
135
142
|
end
|
|
136
143
|
|
|
137
144
|
def default_configuration_paths
|
|
138
|
-
['.
|
|
145
|
+
['~/.fcrepo_wrapper.yml', '~/.fcrepo_wrapper', '.fcrepo_wrapper.yml', '.fcrepo_wrapper']
|
|
139
146
|
end
|
|
140
147
|
|
|
141
148
|
def default_download_dir
|
|
@@ -40,7 +40,25 @@ describe FcrepoWrapper::Configuration do
|
|
|
40
40
|
it "doesn't cast numerics to strings" do
|
|
41
41
|
expect(config.port).to eq 9999
|
|
42
42
|
end
|
|
43
|
+
end
|
|
43
44
|
|
|
45
|
+
describe "#load_configs" do
|
|
46
|
+
before do
|
|
47
|
+
allow(config).to receive(:default_configuration_paths).and_return([])
|
|
48
|
+
end
|
|
49
|
+
context 'with a single config file' do
|
|
50
|
+
let(:options) { { config: 'spec/fixtures/sample_config.yml' } }
|
|
51
|
+
it "uses values from the config file" do
|
|
52
|
+
expect(config.port).to eq 9999
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
context 'with multiple config files' do
|
|
56
|
+
let(:options) { { config: ['spec/fixtures/sample_config.yml', 'spec/fixtures/another_sample_config.yml'] } }
|
|
57
|
+
it "uses values from the config file" do
|
|
58
|
+
expect(config.port).to eq 9998
|
|
59
|
+
expect(config.verbose?).to eq true
|
|
60
|
+
end
|
|
61
|
+
end
|
|
44
62
|
end
|
|
45
63
|
|
|
46
64
|
describe "#validate" do
|
|
@@ -29,8 +29,8 @@ describe FcrepoWrapper::Instance do
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe "#instance_dir" do
|
|
32
|
-
subject {
|
|
33
|
-
it { is_expected.to
|
|
32
|
+
subject { wrapper.instance_dir }
|
|
33
|
+
it { is_expected.to start_with Dir.tmpdir }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe "#options" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fcrepo_wrapper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Beer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ruby-progressbar
|
|
@@ -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'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: simple_solr_client
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +118,6 @@ extra_rdoc_files: []
|
|
|
104
118
|
files:
|
|
105
119
|
- ".gitignore"
|
|
106
120
|
- ".rubocop.yml"
|
|
107
|
-
- ".rubocop_hound.yml"
|
|
108
121
|
- ".rubocop_todo.yml"
|
|
109
122
|
- ".travis.yml"
|
|
110
123
|
- Gemfile
|
|
@@ -124,6 +137,7 @@ files:
|
|
|
124
137
|
- lib/fcrepo_wrapper/settings.rb
|
|
125
138
|
- lib/fcrepo_wrapper/tasks/fcrepo_wrapper.rake
|
|
126
139
|
- lib/fcrepo_wrapper/version.rb
|
|
140
|
+
- spec/fixtures/another_sample_config.yml
|
|
127
141
|
- spec/fixtures/sample_config.yml
|
|
128
142
|
- spec/lib/fcrepo_wrapper/configuration_spec.rb
|
|
129
143
|
- spec/lib/fcrepo_wrapper/instance_spec.rb
|
|
@@ -150,11 +164,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
150
164
|
version: '0'
|
|
151
165
|
requirements: []
|
|
152
166
|
rubyforge_project:
|
|
153
|
-
rubygems_version: 2.
|
|
167
|
+
rubygems_version: 2.5.1
|
|
154
168
|
signing_key:
|
|
155
169
|
specification_version: 4
|
|
156
170
|
summary: Solr 5 service wrapper
|
|
157
171
|
test_files:
|
|
172
|
+
- spec/fixtures/another_sample_config.yml
|
|
158
173
|
- spec/fixtures/sample_config.yml
|
|
159
174
|
- spec/lib/fcrepo_wrapper/configuration_spec.rb
|
|
160
175
|
- spec/lib/fcrepo_wrapper/instance_spec.rb
|