fcrepo_wrapper 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/exe/fcrepo_wrapper +25 -0
- data/lib/fcrepo_wrapper/configuration.rb +8 -2
- data/lib/fcrepo_wrapper/version.rb +1 -1
- data/spec/fixtures/sample_config.yml +4 -0
- data/spec/lib/fcrepo_wrapper/configuration_spec.rb +12 -1
- data/spec/lib/fcrepo_wrapper/md5_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7424a9dd0bb39faff3bd6ee2348baa23e8e0b7e
|
4
|
+
data.tar.gz: bca5748de2a73310b3de930b002b9e2f3006ad86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d86ee5479a5ed8a33f807302159b3f1e232257023a758b747527fcf6be49abdf354d1fd336d6a96d5d1001460d076623adf3e7fda38c35ab0e4600a03bcae5cc
|
7
|
+
data.tar.gz: 2deb69ade9df947f7d092f52a95e2047ec1172f5bd38706bf049a3a41aed1057c2a11b35213337dc6c595058ec523f8705087988ac9c25978df8a69239900e5c
|
data/README.md
CHANGED
@@ -47,4 +47,11 @@ $ fcrepo_wrapper -config <path_to_config_file>
|
|
47
47
|
| version | Fedora version to download and install |
|
48
48
|
| version_file | Local path to store the currently installed version number |
|
49
49
|
|
50
|
+
### Cleaning your repository from the command line
|
51
|
+
|
52
|
+
To clean out data that is being stored in you FcrepoWrapper explicitly run:
|
53
|
+
```
|
54
|
+
$ fcrepo_wrapper <configuration options> clean
|
55
|
+
```
|
56
|
+
***Note*** You must use the same configuration options on the clean command as you do on the run command to clean the correct instance.
|
50
57
|
|
data/exe/fcrepo_wrapper
CHANGED
@@ -5,6 +5,12 @@ require 'optparse'
|
|
5
5
|
|
6
6
|
options = {}
|
7
7
|
|
8
|
+
subtext = <<HELP
|
9
|
+
Commonly used command are:
|
10
|
+
clean : cleans all data from fedora based on configuration options
|
11
|
+
See 'fcrepo_wrapper COMMAND --help' for more information on a specific command.
|
12
|
+
HELP
|
13
|
+
|
8
14
|
args = OptionParser.new do |opts|
|
9
15
|
opts.banner = "Usage: fcrepo_wrapper [options]"
|
10
16
|
|
@@ -44,9 +50,21 @@ args = OptionParser.new do |opts|
|
|
44
50
|
puts opts
|
45
51
|
exit
|
46
52
|
end
|
53
|
+
|
54
|
+
opts.separator ""
|
55
|
+
opts.separator subtext
|
47
56
|
end
|
48
57
|
|
58
|
+
subcommands = {
|
59
|
+
'clean' => OptionParser.new do |opts|
|
60
|
+
opts.banner = "Usage: clean"
|
61
|
+
end,
|
62
|
+
}
|
63
|
+
|
49
64
|
begin
|
65
|
+
args.order!
|
66
|
+
command = ARGV.shift
|
67
|
+
subcommands[command].order! if command
|
50
68
|
args.parse!
|
51
69
|
rescue => error
|
52
70
|
$stderr.puts "ERROR: #{error}\n"
|
@@ -58,6 +76,13 @@ end
|
|
58
76
|
options[:verbose] = true if options[:verbose].nil?
|
59
77
|
|
60
78
|
instance = FcrepoWrapper.default_instance(options)
|
79
|
+
|
80
|
+
if command == 'clean'
|
81
|
+
$stderr.puts "cleaning #{instance.instance_dir}..."
|
82
|
+
instance.clean!
|
83
|
+
exit 0
|
84
|
+
end
|
85
|
+
|
61
86
|
$stderr.print "Starting Fedora #{instance.version} on port #{instance.port} ... "
|
62
87
|
instance.wrap do |conn|
|
63
88
|
$stderr.puts "http://#{instance.host}:#{instance.port}/"
|
@@ -88,7 +88,13 @@ module FcrepoWrapper
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def fcrepo_home_dir
|
91
|
-
options[:fcrepo_home_dir]
|
91
|
+
if options[:fcrepo_home_dir]
|
92
|
+
options[:fcrepo_home_dir]
|
93
|
+
elsif defined? Rails
|
94
|
+
File.join(Rails.root, 'tmp', 'fcrepo4-data')
|
95
|
+
else
|
96
|
+
Dir.mktmpdir
|
97
|
+
end
|
92
98
|
end
|
93
99
|
|
94
100
|
def port
|
@@ -125,7 +131,7 @@ module FcrepoWrapper
|
|
125
131
|
$stderr.puts "Unable to parse config #{config_file}" if verbose
|
126
132
|
return {}
|
127
133
|
end
|
128
|
-
config.each_with_object({}) { |(k, v), h| h[k.to_sym] = v
|
134
|
+
config.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
129
135
|
end
|
130
136
|
|
131
137
|
def default_configuration_paths
|
@@ -27,9 +27,20 @@ describe FcrepoWrapper::Configuration do
|
|
27
27
|
allow(config).to receive(:default_configuration_paths).and_return([])
|
28
28
|
end
|
29
29
|
let(:options) { { config: 'spec/fixtures/sample_config.yml' } }
|
30
|
+
|
30
31
|
it "uses values from the config file" do
|
31
|
-
expect(config.
|
32
|
+
expect(config.version_file).to eq 'path/to/VERSION'
|
33
|
+
end
|
34
|
+
it "evalates yaml true values as ruby booleans" do
|
35
|
+
expect(config.validate).to be true
|
36
|
+
end
|
37
|
+
it "evaluates yaml false values as ruby booleans" do
|
38
|
+
expect(config.verbose?).to be false
|
32
39
|
end
|
40
|
+
it "doesn't cast numerics to strings" do
|
41
|
+
expect(config.port).to eq 9999
|
42
|
+
end
|
43
|
+
|
33
44
|
end
|
34
45
|
|
35
46
|
describe "#validate" do
|
@@ -15,7 +15,7 @@ describe FcrepoWrapper::MD5 do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
context "with a correct checksum" do
|
18
|
-
let(:options) { { md5sum: '
|
18
|
+
let(:options) { { md5sum: '75e5b2fea7e7b756fa4ad4ca58e96b8c' } }
|
19
19
|
it "doesn't raise an error" do
|
20
20
|
expect { subject }.not_to raise_error
|
21
21
|
end
|
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.5.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-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-progressbar
|