boxafe 0.1.4 → 0.1.5

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODMyZGQyNWI3ZDQyMTI2MzNkMjlhNGM4MTc3YzliMzhkZTlhNTM0Mg==
4
+ NmRhNGVkMDIxZjM2MjUyYTVhYTcxZDU5NDUwNzJhMWY3YjcxZTcxYw==
5
5
  data.tar.gz: !binary |-
6
- ZTkyMWRmY2M4NjU1MTAyNDQwMWU4YjEyNWZhYzAzNzgwYmUzNTZkOA==
7
- !binary "U0hBNTEy":
6
+ MGUzZWM0OWE1NThjN2U0ZmJlNzNkM2RkMDQ3MDU3YzU0N2RhMTBmNQ==
7
+ SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2UzNjNmMTg3NzY4MGNlN2I1MjZiNmU2MzNmNTZlMDNiNjdhYzVjNzNhMjdi
10
- ZmI2YWFhZjQ3MjY3MGI1Nzg1Y2ZiYzRmOGI0ZjBmYTBmOTY5NjNmZThmZTRj
11
- YjhkOGVjMjg4ZDIzZWIxODU0NTAwOWFiNGVhMmRlNzgwY2IxZGM=
9
+ MGY5MTBjNDBmOTRmMTQ3NGM3NDAwMzQ1NDUyMzg1ODI3ODNiZTM5MjI5MTc3
10
+ ZWRkYzI5ZTNiMGVmOTFmMzI5ZTU1NjUyMjMwY2EwNTBmYjMzNzNhZjNmZGY1
11
+ MDAwNWQ4MGUzOTgzZTVkNDZlZDljNjg3YzI2NzAxZGVjNWMzZTY=
12
12
  data.tar.gz: !binary |-
13
- ZjI2NWNhNmYzMjNjOGVkYWQ2ZWY5OTJkYjQ1ZjEwMWE3ZTNmMDAzNzgxNDVm
14
- MTE3NzlmMzIxMWE2ODA3OGZkNjNlMWNmMWE4YjFiNjdkOTRlMTQ1NjcyNzZh
15
- MDBjZDBmYzI3NDRhZTRhMTY0MzNhYmUzNWRjZjQ1ODk5YzZjOWU=
13
+ ZTc0ODMyYWQzYTU3Zjc5Mzg4OWI3YmY3NTQ4YWM3OGU1YjU5OTIxMzQ4NDI2
14
+ ZTk2ODVjM2JiMjgyNjllMzI5ZjY3Yzc5ZWY1YmRhZDNhNmU1YjMxYzI5MDE3
15
+ OWVjMjkwYTg4NDYzNjM2ZTllMWJlZWE5ODNlMzdiZGE4YjI4OWY=
data/Gemfile CHANGED
@@ -25,4 +25,5 @@ group :development do
25
25
  gem 'gem-release'
26
26
  gem 'rake-version'
27
27
  gem 'simplecov'
28
+ gem 'fakefs', require: 'fakefs/safe'
28
29
  end
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Build Status](https://secure.travis-ci.org/AlphaHydrae/boxafe.png)](http://travis-ci.org/AlphaHydrae/boxafe)
6
6
 
7
7
  Boxafe mounts EncFS filesystems or "boxes" that you define in a configuration file with a friendly DSL.
8
- It can also mount them on startup.
8
+ It can also mount them on startup. [EncFS](http://www.arg0.net/encfs) must be installed separately.
9
9
 
10
10
  **Note: Currently supports OS X. Partial Linux support.**
11
11
 
@@ -27,6 +27,14 @@ end
27
27
  # this command is run:
28
28
  # encfs "/secure/abox" "/Volumes/abox" -- -ovolname="A box"
29
29
 
30
+ # get the password from a file
31
+ box do
32
+ name 'Password file box'
33
+ root '/secure/password-file-box'
34
+ mount '/Volumes/password-file-box'
35
+ password_file '/secret/password'
36
+ end
37
+
30
38
  # get the password from the OS X keychain
31
39
  box do
32
40
  name 'Keychain box'
@@ -117,7 +125,7 @@ This is the list of planned features/changes:
117
125
 
118
126
  * Complete test suite.
119
127
  * Growl/OS X notifications.
120
- * Get password from a file.
128
+ * "Repair" feature to un-quarantine files on OS X.
121
129
  * Cron scheduling with [whenever](https://github.com/javan/whenever).
122
130
 
123
131
  ## Meta
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/lib/boxafe/box.rb CHANGED
@@ -3,7 +3,7 @@ require 'fileutils'
3
3
 
4
4
  class Boxafe::Box
5
5
 
6
- OPTION_KEYS = [ :name, :root, :mount, :volume, :encfs_config, :keychain ]
6
+ OPTION_KEYS = [ :name, :root, :mount, :volume, :encfs_config, :keychain, :password_file ]
7
7
 
8
8
  def initialize options = {}
9
9
 
@@ -60,7 +60,11 @@ class Boxafe::Box
60
60
  end
61
61
 
62
62
  s << "\nVolume Name: #{opts[:volume]}"
63
- s << "\nKeychain Password: #{opts[:keychain]}" if opts[:keychain]
63
+ if opts[:password_file]
64
+ s << "\nPassword File: #{opts[:password_file]}"
65
+ elsif opts[:keychain]
66
+ s << "\nKeychain Password: #{opts[:keychain]}"
67
+ end
64
68
  s << "\nEncFS Config: #{opts[:encfs_config]}" if opts[:encfs_config]
65
69
 
66
70
  s << "\nCommand: #{Paint[encfs.command, :yellow]}" if verbose
@@ -85,11 +89,18 @@ class Boxafe::Box
85
89
 
86
90
  def options
87
91
  @options.tap do |opts|
92
+
88
93
  opts[:root] = File.expand_path opts[:root] || "~/Dropbox/#{opts[:name]}"
89
94
  opts[:mount] = File.expand_path opts[:mount] || "/Volumes/#{opts[:name]}"
90
95
  opts[:encfs_config] = File.expand_path opts[:encfs_config] if opts[:encfs_config]
91
96
  opts[:volume] ||= opts[:name]
92
- opts[:keychain] = opts[:name] if opts[:keychain] == true
97
+
98
+ if opts[:password_file]
99
+ opts[:password_file] = File.expand_path opts[:password_file]
100
+ opts.delete :keychain
101
+ elsif opts[:keychain] == true
102
+ opts[:keychain] = opts[:name]
103
+ end
93
104
  end
94
105
  end
95
106
 
data/lib/boxafe/config.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  class Boxafe::Config
3
3
 
4
4
  # TODO: document unmount_delay
5
+ # TODO: add option to chdir, boxes relative to home dir by default
5
6
  OPTION_KEYS = [ :encfs, :umount, :umount_delay, :notify ]
6
7
 
7
8
  attr_reader :boxes, :options
data/lib/boxafe/encfs.rb CHANGED
@@ -8,18 +8,36 @@ class Boxafe::Encfs
8
8
  end
9
9
 
10
10
  def command
11
- # TODO: use shellwords for binary, test escaping
12
- [ encfs_config, @options[:encfs], Shellwords.escape(@options[:root]), Shellwords.escape(@options[:mount]), extpass, '--', volname ].compact.join ' '
11
+ [
12
+ encfs_config,
13
+ Shellwords.escape(@options[:encfs]),
14
+ Shellwords.escape(absolute_root_dir),
15
+ Shellwords.escape(absolute_mount_dir),
16
+ extpass,
17
+ '--',
18
+ volname
19
+ ].compact.join ' '
13
20
  end
14
21
 
15
22
  private
16
23
 
24
+ def absolute_root_dir
25
+ # TODO: remove Dir.pwd once fakefs is fixed (multiple occurrences in this file)
26
+ File.expand_path @options[:root], Dir.pwd
27
+ end
28
+
29
+ def absolute_mount_dir
30
+ File.expand_path @options[:mount], Dir.pwd
31
+ end
32
+
17
33
  def volname
18
34
  %/-ovolname=#{Shellwords.escape @options[:volume]}/
19
35
  end
20
36
 
21
37
  def extpass
22
- if @options[:keychain]
38
+ if @options[:password_file]
39
+ %|--extpass="head -n 1 #{Shellwords.escape @options[:password_file]}"|
40
+ elsif @options[:keychain]
23
41
  %*--extpass="security 2>&1 >/dev/null find-generic-password -gl '#{@options[:keychain]}' |grep password|cut -d \\\\\\" -f 2"*
24
42
  else
25
43
  nil
@@ -27,6 +45,6 @@ class Boxafe::Encfs
27
45
  end
28
46
 
29
47
  def encfs_config
30
- @options[:encfs_config] ? %/ENCFS6_CONFIG=#{Shellwords.escape File.expand_path(@options[:encfs_config])}/ : nil
48
+ @options[:encfs_config] ? %/ENCFS6_CONFIG=#{Shellwords.escape File.expand_path(@options[:encfs_config], Dir.pwd)}/ : nil
31
49
  end
32
50
  end
data/lib/boxafe.rb CHANGED
@@ -4,7 +4,7 @@ require 'dotenv'
4
4
  require 'mutaconf'
5
5
 
6
6
  module Boxafe
7
- VERSION = '0.1.4'
7
+ VERSION = '0.1.5'
8
8
 
9
9
  # TODO: add detailed error description for non-trace mode
10
10
  class Error < StandardError
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxafe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlphaHydrae
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-10 00:00:00.000000000 Z
11
+ date: 2013-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paint
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - ! '>='
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: fakefs
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ! '>='
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ! '>='
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
237
251
  description: Boxafe encrypts and auto-mounts a folder with encfs and whenever.
238
252
  email: hydrae.alpha@gmail.com
239
253
  executables:
@@ -280,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
294
  version: '0'
281
295
  requirements: []
282
296
  rubyforge_project:
283
- rubygems_version: 2.0.3
297
+ rubygems_version: 2.1.5
284
298
  signing_key:
285
299
  specification_version: 4
286
300
  summary: Secure your Dropbox with encfs.