revenc 0.1.3 → 0.2.1
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.
- data/.gemfiles +53 -0
- data/.gitignore +4 -8
- data/Gemfile.lock +42 -37
- data/HISTORY.markdown +9 -2
- data/LICENSE +1 -1
- data/README.markdown +33 -38
- data/Rakefile +24 -34
- data/TODO.markdown +3 -0
- data/VERSION +1 -1
- data/bin/revenc +30 -13
- data/config/cucumber.yml +4 -3
- data/examples/rsync/encrypted_data/key/encfs6.xml +27 -27
- data/examples/rsync/revenc.conf +2 -2
- data/examples/simple/encfs6.xml +27 -27
- data/features/app.feature +17 -17
- data/features/bin.feature +6 -6
- data/features/configuration.feature +9 -9
- data/features/copy.feature +15 -12
- data/features/generator.feature +1 -1
- data/features/mount.feature +14 -14
- data/features/settings.feature +119 -0
- data/features/step_definitions/revenc_steps.rb +1 -2
- data/features/support/aruba.rb +9 -9
- data/features/support/env.rb +8 -2
- data/features/unmount.feature +8 -8
- data/lib/revenc.rb +12 -3
- data/lib/revenc/app.rb +27 -53
- data/lib/revenc/core/array.rb +11 -0
- data/lib/revenc/core/hash.rb +45 -0
- data/lib/revenc/encfs_wrapper.rb +20 -24
- data/lib/revenc/errors.rb +3 -3
- data/lib/revenc/io.rb +13 -13
- data/lib/revenc/settings.rb +98 -0
- data/revenc.gemspec +28 -17
- data/spec/aruba_helper.rb +25 -0
- data/spec/basic_app/array_spec.rb +48 -0
- data/spec/basic_gem/aruba_helper_spec.rb +33 -0
- data/spec/basic_gem/basic_gem_spec.rb +71 -1
- data/spec/basic_gem/gemspec_spec.rb +68 -0
- data/spec/revenc/error_spec.rb +2 -2
- data/spec/revenc/io_spec.rb +12 -12
- data/spec/spec_helper.rb +4 -9
- data/spec/watchr.rb +48 -26
- metadata +120 -177
- data/.yardopts +0 -6
- data/spec/spec.opts +0 -2
data/.gemfiles
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
.gemfiles
|
2
|
+
.gitattributes
|
3
|
+
.gitignore
|
4
|
+
Gemfile
|
5
|
+
Gemfile.lock
|
6
|
+
HISTORY.markdown
|
7
|
+
LICENSE
|
8
|
+
README.markdown
|
9
|
+
Rakefile
|
10
|
+
TODO.markdown
|
11
|
+
VERSION
|
12
|
+
bin/revenc
|
13
|
+
config/cucumber.yml
|
14
|
+
examples/rsync/encrypted_data/key/encfs6.xml
|
15
|
+
examples/rsync/revenc.conf
|
16
|
+
examples/rsync/scripts/passphrase
|
17
|
+
examples/rsync/unencrypted_data/test_file1.txt
|
18
|
+
examples/rsync/unencrypted_data/test_file2.txt
|
19
|
+
examples/simple/encfs6.xml
|
20
|
+
examples/simple/passphrase
|
21
|
+
examples/simple/unencrypted_data/test_file1.txt
|
22
|
+
examples/simple/unencrypted_data/test_file2.txt
|
23
|
+
features/app.feature
|
24
|
+
features/bin.feature
|
25
|
+
features/configuration.feature
|
26
|
+
features/copy.feature
|
27
|
+
features/generator.feature
|
28
|
+
features/mount.feature
|
29
|
+
features/settings.feature
|
30
|
+
features/step_definitions/.gitignore
|
31
|
+
features/step_definitions/revenc_steps.rb
|
32
|
+
features/support/aruba.rb
|
33
|
+
features/support/env.rb
|
34
|
+
features/support/hooks.rb
|
35
|
+
features/unmount.feature
|
36
|
+
lib/revenc.rb
|
37
|
+
lib/revenc/app.rb
|
38
|
+
lib/revenc/core/array.rb
|
39
|
+
lib/revenc/core/hash.rb
|
40
|
+
lib/revenc/encfs_wrapper.rb
|
41
|
+
lib/revenc/errors.rb
|
42
|
+
lib/revenc/io.rb
|
43
|
+
lib/revenc/settings.rb
|
44
|
+
revenc.gemspec
|
45
|
+
spec/aruba_helper.rb
|
46
|
+
spec/basic_app/array_spec.rb
|
47
|
+
spec/basic_gem/aruba_helper_spec.rb
|
48
|
+
spec/basic_gem/basic_gem_spec.rb
|
49
|
+
spec/basic_gem/gemspec_spec.rb
|
50
|
+
spec/revenc/error_spec.rb
|
51
|
+
spec/revenc/io_spec.rb
|
52
|
+
spec/spec_helper.rb
|
53
|
+
spec/watchr.rb
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,54 +1,59 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
revenc (0.1
|
5
|
-
configatron (>= 2.5.1)
|
4
|
+
revenc (0.2.1)
|
6
5
|
mutagem (>= 0.1.3)
|
7
6
|
term-ansicolor (>= 1.0.4)
|
8
7
|
|
9
8
|
GEM
|
10
9
|
remote: http://rubygems.org/
|
11
10
|
specs:
|
12
|
-
aruba (0.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
aruba (0.4.5)
|
12
|
+
bcat (>= 0.6.1)
|
13
|
+
childprocess (>= 0.1.9)
|
14
|
+
cucumber (>= 0.10.7)
|
15
|
+
rdiscount (>= 1.6.8)
|
16
|
+
rspec (>= 2.6.0)
|
17
|
+
bcat (0.6.1)
|
18
|
+
rack (~> 1.0)
|
19
|
+
builder (3.0.0)
|
20
|
+
childprocess (0.2.0)
|
21
|
+
ffi (~> 1.0.6)
|
22
|
+
cucumber (1.0.2)
|
23
|
+
builder (>= 2.1.2)
|
24
|
+
diff-lcs (>= 1.1.2)
|
25
|
+
gherkin (~> 2.4.5)
|
26
|
+
json (>= 1.4.6)
|
27
|
+
term-ansicolor (>= 1.0.5)
|
25
28
|
diff-lcs (1.1.2)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
rake (0.
|
33
|
-
rdiscount (1.6.
|
34
|
-
rspec (
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
29
|
+
ffi (1.0.9)
|
30
|
+
gherkin (2.4.5)
|
31
|
+
json (>= 1.4.6)
|
32
|
+
json (2.1.0)
|
33
|
+
mutagem (0.2.3)
|
34
|
+
rack (1.3.1)
|
35
|
+
rake (0.9.2)
|
36
|
+
rdiscount (1.6.8)
|
37
|
+
rspec (2.6.0)
|
38
|
+
rspec-core (~> 2.6.0)
|
39
|
+
rspec-expectations (~> 2.6.0)
|
40
|
+
rspec-mocks (~> 2.6.0)
|
41
|
+
rspec-core (2.6.4)
|
42
|
+
rspec-expectations (2.6.0)
|
43
|
+
diff-lcs (~> 1.1.2)
|
44
|
+
rspec-mocks (2.6.0)
|
45
|
+
term-ansicolor (1.0.6)
|
39
46
|
|
40
47
|
PLATFORMS
|
41
48
|
ruby
|
42
49
|
|
43
50
|
DEPENDENCIES
|
44
|
-
aruba (
|
45
|
-
bundler (>= 1.0.
|
46
|
-
|
47
|
-
cucumber (>= 0.6)
|
48
|
-
mutagem (>= 0.1.3)
|
51
|
+
aruba (~> 0.4.2)
|
52
|
+
bundler (>= 1.0.14)
|
53
|
+
cucumber (~> 1.0)
|
49
54
|
rake (>= 0.8.7)
|
50
|
-
rdiscount (>= 1.6.5)
|
51
55
|
revenc!
|
52
|
-
rspec (>=
|
53
|
-
|
54
|
-
|
56
|
+
rspec (>= 2.6.0)
|
57
|
+
|
58
|
+
BUNDLED WITH
|
59
|
+
1.16.0
|
data/HISTORY.markdown
CHANGED
@@ -2,13 +2,20 @@ History
|
|
2
2
|
=======
|
3
3
|
Most recent changes are at the top
|
4
4
|
|
5
|
-
|
6
5
|
Changes
|
7
6
|
-------
|
8
7
|
|
8
|
+
### 0.2.1 - 12/21/2017 ###
|
9
|
+
|
10
|
+
* Update and remove dependencies with known security issues
|
11
|
+
|
12
|
+
### 0.2.0 - 08/02/2011 ###
|
13
|
+
|
14
|
+
* Merge upstream updates from [BasicApp](http://github.com/robertwahler/basic_app)
|
15
|
+
|
9
16
|
### 0.1.3 - 10/05/2010 ###
|
10
17
|
|
11
|
-
* Using [
|
18
|
+
* Using [Mutagem](http://github.com/robertwahler/mutagem) for file locking based mutexes
|
12
19
|
|
13
20
|
|
14
21
|
### 0.1.2 - 03/12/2010 ###
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -1,32 +1,35 @@
|
|
1
1
|
Revenc
|
2
2
|
======
|
3
3
|
|
4
|
-
Mount an unencrypted folder as encrypted using EncFS and copy/synchronize the
|
4
|
+
Mount an unencrypted folder as encrypted using EncFS and copy/synchronize the
|
5
5
|
encrypted files to untrusted destinations using rsync/cp
|
6
6
|
|
7
7
|
Background
|
8
8
|
----------
|
9
9
|
|
10
|
-
EncFS in reverse mode facilitates mounting an encrypted file system
|
11
|
-
from an unencrypted source folder. This allows keeping your files unencrypted
|
12
|
-
in a trusted environment while gaining the ability to encrypt on demand
|
10
|
+
EncFS in reverse mode facilitates mounting an encrypted file system
|
11
|
+
from an unencrypted source folder. This allows keeping your files unencrypted
|
12
|
+
in a trusted environment while gaining the ability to encrypt on demand
|
13
13
|
i.e. when you want to rsync encrypted files off-site to an untrusted system.
|
14
14
|
|
15
|
+
Revenc was jump-started by cloning from
|
16
|
+
[BasicApp](https://github.com/robertwahler/basic_app).
|
17
|
+
|
15
18
|
Why Revenc?
|
16
19
|
-----------
|
17
20
|
|
18
|
-
Revenc facilitates scripting EncFS reverse mounting and synchronizing by
|
19
|
-
providing a configuration framework and validating mounts before running tools
|
21
|
+
Revenc facilitates scripting EncFS reverse mounting and synchronizing by
|
22
|
+
providing a configuration framework and validating mounts before running tools
|
20
23
|
like rsync.
|
21
24
|
|
22
|
-
Benefits
|
25
|
+
Benefits
|
23
26
|
--------
|
24
27
|
|
25
28
|
* Provides conventions for EncFS reverse mounting
|
26
|
-
* Validates mountpoints before copying to prevent "rsync --delete" commands
|
27
|
-
from trying to sync empty folders
|
28
|
-
* Mount, unmount, and copy actions are protected by a mutex to prevent
|
29
|
-
recursion on long running copy/sync operations. (mount, unmount and
|
29
|
+
* Validates mountpoints before copying to prevent "rsync --delete" commands
|
30
|
+
from trying to sync empty folders
|
31
|
+
* Mount, unmount, and copy actions are protected by a mutex to prevent
|
32
|
+
recursion on long running copy/sync operations. (mount, unmount and
|
30
33
|
copy actions will fail if another instance of revenc is blocking)
|
31
34
|
* Allow short, easy to remember command lines when used with configuration files.
|
32
35
|
i.e. revenc mount, revenc unmount, revenc copy
|
@@ -36,7 +39,6 @@ Installation
|
|
36
39
|
|
37
40
|
gem install revenc
|
38
41
|
|
39
|
-
|
40
42
|
Usage
|
41
43
|
-----
|
42
44
|
|
@@ -61,7 +63,7 @@ This calls the executable "encfs" with the following by default:
|
|
61
63
|
|
62
64
|
Unmount using EncFS. Mountpoint is required when specified by revenc.conf.
|
63
65
|
|
64
|
-
Unmount: revenc unmount <mountpoint>
|
66
|
+
Unmount: revenc unmount <mountpoint>
|
65
67
|
|
66
68
|
This calls the executable "fusermount" with the following by default:
|
67
69
|
|
@@ -95,7 +97,7 @@ The following is a walk through of the steps used to create the example project
|
|
95
97
|
### Create the EncFS passphrase file ###
|
96
98
|
|
97
99
|
You must supply EncFS with a passphrase in plain text. The passphrase is piped in on the command line
|
98
|
-
to EncFS. This file can be stored anywhere on your trusted system. Revenc expects it in the
|
100
|
+
to EncFS. This file can be stored anywhere on your trusted system. Revenc expects it in the
|
99
101
|
current folder, use revenc.conf to supply a different location.
|
100
102
|
|
101
103
|
echo "my_super_secret_PassPHRase" > passphrase
|
@@ -103,12 +105,12 @@ current folder, use revenc.conf to supply a different location.
|
|
103
105
|
|
104
106
|
### Generate the EncFS key file ###
|
105
107
|
|
106
|
-
Generation of your key file is done once. The same key is used for each mount action on the same
|
108
|
+
Generation of your key file is done once. The same key is used for each mount action on the same
|
107
109
|
unencrypted source folder. You need to keep a copy of your key available in order to restore encrypted files.
|
108
|
-
EncFS doesn't supply a method to fully automate the generation of the key file with so it needs
|
109
|
-
to be done manually.
|
110
|
+
EncFS doesn't supply a method to fully automate the generation of the key file with so it needs
|
111
|
+
to be done manually.
|
110
112
|
|
111
|
-
NOTE: The ENCFS6_CONFIG var is needed to control where the key file is created. The "${PWD}" is
|
113
|
+
NOTE: The ENCFS6_CONFIG var is needed to control where the key file is created. The "${PWD}" is
|
112
114
|
used because EncFS expects full paths from the root folder.
|
113
115
|
|
114
116
|
ENCFS6_CONFIG=./encfs6.xml encfs --reverse ${PWD}/unencrypted_data ${PWD}/encrypted_mountpoint -- -o ro
|
@@ -118,17 +120,17 @@ command prompt. You can complete the key generation any way you like. The foll
|
|
118
120
|
used to generate the sample key. Note the I opted to store filenames in plain text for clarity.
|
119
121
|
|
120
122
|
EncFS command prompt responses:
|
121
|
-
|
123
|
+
|
122
124
|
x # expert mode
|
123
125
|
1 # AES
|
124
126
|
128 # key size
|
125
127
|
1024 # block size
|
126
|
-
2 # Null => no encryption of filenames
|
128
|
+
2 # Null => no encryption of filenames
|
127
129
|
my_super_secret_PassPHRase # passphrase we stored in the step above
|
128
130
|
my_super_secret_PassPHRase # confirm passphrase
|
129
131
|
|
130
132
|
|
131
|
-
EncFS should generate encfs6.xml, mount the folder and return you to the command prompt. You can
|
133
|
+
EncFS should generate encfs6.xml, mount the folder and return you to the command prompt. You can
|
132
134
|
now work with your encrypted files.
|
133
135
|
|
134
136
|
ls encrypted_mountpoint
|
@@ -137,7 +139,7 @@ now work with your encrypted files.
|
|
137
139
|
|
138
140
|
revenc unmount encrypted_mountpoint
|
139
141
|
ls encrypted_mountpoint
|
140
|
-
|
142
|
+
|
141
143
|
<no files here>
|
142
144
|
|
143
145
|
revenc mount unencrypted_data encrypted_mountpoint
|
@@ -166,39 +168,32 @@ you can ommit action parameters. For example:
|
|
166
168
|
revenc unmount
|
167
169
|
|
168
170
|
The configuration file is YAML http://www.yaml.org/ format with ERB processing. You must
|
169
|
-
escape ERB in the action commands. These need to be lazy loaded by Revenc. Unescaped
|
171
|
+
escape ERB in the action commands. These need to be lazy loaded by Revenc. Unescaped
|
170
172
|
ERB is evaluated as the configuration file is read but before Revenc parses the commands.
|
171
173
|
See the example configuration file examples/rsync/revenc.conf.
|
172
174
|
|
173
175
|
The file features/configuration.feature has more details.
|
174
176
|
|
175
|
-
|
176
|
-
System Requirements
|
177
|
+
System Requirements
|
177
178
|
-------------------
|
178
179
|
|
179
|
-
*
|
180
|
-
* EncFS http://www.arg0.net/encfs
|
181
|
-
|
180
|
+
* EncFS http://www.arg0.net/encfs (tested on versions: 1.5, 1.6)
|
182
181
|
|
183
|
-
Run-time dependencies
|
182
|
+
Run-time dependencies
|
184
183
|
---------------------
|
185
|
-
The following gems are required by default in applications cloned from BasicApp.
|
186
184
|
|
187
185
|
* Term-ansicolor for optional color output <http://github.com/flori/term-ansicolor>
|
188
|
-
*
|
189
|
-
|
186
|
+
* Mutagem for mutex support <http://github.com/robertwahler/mutagem>
|
190
187
|
|
191
188
|
Development dependencies
|
192
189
|
------------------------
|
193
190
|
|
194
191
|
* Bundler for dependency management <http://github.com/carlhuda/bundler>
|
195
|
-
* Rspec for unit testing <http://github.com/
|
196
|
-
* Cucumber for functional testing <http://github.com/
|
197
|
-
* Aruba for CLI testing <http://github.com/
|
198
|
-
* YARD for documentation generation <http://github.com/lsegal/yard>
|
199
|
-
|
192
|
+
* Rspec for unit testing <http://github.com/rspec/rspec>
|
193
|
+
* Cucumber for functional testing <http://github.com/cucumber/cucumber>
|
194
|
+
* Aruba for CLI testing <http://github.com/cucumber/aruba>
|
200
195
|
|
201
196
|
Copyright
|
202
197
|
---------
|
203
198
|
|
204
|
-
Copyright (c) 2010 GearheadForHire, LLC. See [LICENSE](LICENSE) for details.
|
199
|
+
Copyright (c) 2010-2017 GearheadForHire, LLC. See [LICENSE](LICENSE) for details.
|
data/Rakefile
CHANGED
@@ -1,25 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
require '
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
file = File.expand_path('../revenc.gemspec', __FILE__)
|
14
|
-
eval(File.read(file), binding, file)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
require 'spec'
|
19
|
-
require 'spec/rake/spectask'
|
20
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
21
|
-
spec.libs << 'lib' << 'spec'
|
22
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
3
|
+
# Bundler is managing $LOAD_PATH, any gem needed by this Rakefile must be
|
4
|
+
# listed as a development dependency in the gemspec
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'bundler/gem_tasks'
|
7
|
+
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
desc "Run RSpec"
|
10
|
+
RSpec::Core::RakeTask.new do |spec|
|
11
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
12
|
+
spec.rspec_opts = ['--color', '--format nested']
|
23
13
|
end
|
24
14
|
|
25
15
|
require 'cucumber'
|
@@ -33,23 +23,23 @@ task :test => [:spec, :features]
|
|
33
23
|
|
34
24
|
task :default => :test
|
35
25
|
|
36
|
-
|
37
|
-
|
38
|
-
doc_destination = File.join(project_root, 'rdoc')
|
26
|
+
# put the gemfiles task in the :build dependency chain
|
27
|
+
task :build => [:gemfiles]
|
39
28
|
|
40
|
-
|
41
|
-
|
29
|
+
desc "Generate .gemfiles via 'git ls-files'"
|
30
|
+
task :gemfiles do
|
31
|
+
files = `git ls-files`
|
42
32
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
33
|
+
filename = File.join(File.dirname(__FILE__), '.gemfiles')
|
34
|
+
cached_files = File.exists?(filename) ? File.open(filename, "r") {|f| f.read} : nil
|
35
|
+
|
36
|
+
# maintain EOL
|
37
|
+
files.gsub!(/\n/, "\r\n") if cached_files && cached_files.match("\r\n")
|
49
38
|
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
if cached_files != files
|
40
|
+
puts "Updating .gemfiles"
|
41
|
+
File.open(filename, 'wb') {|f| f.write(files)}
|
53
42
|
end
|
54
43
|
|
44
|
+
raise "unable to process gemfiles" unless files
|
55
45
|
end
|
data/TODO.markdown
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1
|
1
|
+
0.2.1
|
data/bin/revenc
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
4
4
|
|
5
|
+
require 'rubygems'
|
5
6
|
require 'revenc'
|
6
7
|
require 'optparse'
|
7
8
|
require 'term/ansicolor'
|
@@ -18,28 +19,29 @@ banner << "\nActions: #{available_actions.join(' ')}\n" unless available_actions
|
|
18
19
|
help = banner
|
19
20
|
help += <<HELP
|
20
21
|
Mount: revenc mount <unencrypted source> <empty mountpoint>
|
21
|
-
Unmount: revenc unmount <mounted encypted folder>
|
22
|
+
Unmount: revenc unmount <mounted encypted folder>
|
22
23
|
Copy: revenc copy <encrypted source> <destination>
|
23
24
|
Note: Copying is normally done via rsync
|
24
25
|
|
25
26
|
Options:
|
26
|
-
|
27
|
+
|
27
28
|
HELP
|
28
29
|
|
29
30
|
options = {}
|
30
31
|
OptionParser.new do |opts|
|
31
32
|
opts.banner = help
|
32
33
|
|
33
|
-
# set defaults
|
34
|
-
options[:verbose] = false
|
35
|
-
options[:coloring] = true
|
36
|
-
|
37
34
|
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
38
35
|
options[:verbose] = v
|
39
36
|
end
|
40
37
|
|
41
|
-
opts.on("-c", "--[no-]coloring", "
|
42
|
-
options[:coloring] = c
|
38
|
+
opts.on("-c", "--[no-]coloring [MODE]", "ANSI color in output. MODE=AUTO (default) or ALWAYS") do |c|
|
39
|
+
options[:coloring] = c.nil? ? "AUTO" : c
|
40
|
+
options[:coloring].upcase! if options[:coloring]
|
41
|
+
unless [nil, false, "AUTO", "ALWAYS"].include?(options[:coloring])
|
42
|
+
puts "revenc, invalid color option: #{options[:coloring]}"
|
43
|
+
exit 1
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
opts.on("--version", "Display current version") do
|
@@ -52,7 +54,7 @@ OptionParser.new do |opts|
|
|
52
54
|
end
|
53
55
|
|
54
56
|
opts.on("--config FILE", "Load configuration options from FILE") do |file|
|
55
|
-
options[:config] = file
|
57
|
+
options[:config] = file
|
56
58
|
end
|
57
59
|
|
58
60
|
# no argument, shows at tail. This will print an options summary.
|
@@ -60,7 +62,7 @@ OptionParser.new do |opts|
|
|
60
62
|
puts opts
|
61
63
|
exit 0
|
62
64
|
end
|
63
|
-
|
65
|
+
|
64
66
|
begin
|
65
67
|
opts.parse!
|
66
68
|
rescue OptionParser::InvalidOption => e
|
@@ -71,11 +73,26 @@ OptionParser.new do |opts|
|
|
71
73
|
|
72
74
|
end
|
73
75
|
|
74
|
-
if
|
76
|
+
# options from config file, if it exists, will not overwrite command line
|
77
|
+
options = Revenc::Settings.new(FileUtils.pwd, options).options
|
78
|
+
|
79
|
+
if STDOUT.isatty || (options[:coloring] == 'ALWAYS')
|
75
80
|
Term::ANSIColor::coloring = options[:coloring]
|
81
|
+
|
82
|
+
if options[:coloring] && Revenc::WINDOWS
|
83
|
+
unless ENV['ANSICON']
|
84
|
+
begin
|
85
|
+
require 'Win32/Console/ANSI'
|
86
|
+
rescue LoadError
|
87
|
+
Term::ANSIColor::coloring = false
|
88
|
+
STDERR.puts 'WARNING: You must "gem install win32console" (1.2.0 or higher) or use the ANSICON driver (https://github.com/adoxa/ansicon) to get color output on MRI/Windows'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
76
93
|
else
|
77
94
|
Term::ANSIColor::coloring = false
|
78
95
|
end
|
79
96
|
|
80
|
-
app = Revenc::App.new(FileUtils.pwd, options)
|
81
|
-
app.
|
97
|
+
app = Revenc::App.new(FileUtils.pwd, ARGV.dup, options)
|
98
|
+
app.execute
|