marhan_cli 0.0.7 → 0.0.8

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.
@@ -27,4 +27,8 @@
27
27
  ## v0.0.7
28
28
 
29
29
  * TrueCrypt command for unmount all devices added.
30
- * Expect configuration file '.marhan_cli.yaml' in home directory to define encrypted devices and mount folder.
30
+ * Expect configuration file '.marhan_cli.yaml' in home directory to define encrypted devices and mount folder.
31
+
32
+ ## v0.0.8
33
+
34
+ * Name (configuration key) of device as parameter of mount command. (command => crypt:mount)
@@ -9,12 +9,12 @@ module MarhanCli
9
9
  @mount_folder = mount_folder
10
10
  end
11
11
 
12
- def mount_command(encrypted_devices)
13
- "#{@binary} --mount #{encrypted_devices[:enc1]} #{mount_folder}/#{:enc1.to_s}"
12
+ def mount_command(encrypted_device, mount_to_folder)
13
+ "#{@binary} --mount #{encrypted_device} #{@mount_folder}/#{mount_to_folder}"
14
14
  end
15
15
 
16
16
  def unmount_command()
17
- "#{@binary} -d #{mount_folder}/enc1"
17
+ "#{@binary} -d #{@mount_folder}/enc1"
18
18
  end
19
19
 
20
20
  def mount_folder
@@ -24,5 +24,15 @@ module MarhanCli
24
24
  config = Ambience.create(config_file_path)
25
25
  config.to_mash
26
26
  end
27
+
28
+ def get_or_ask(option_name)
29
+ options[option_name] || ask_for_option(option_name)
30
+ end
31
+
32
+ def ask_for_option(option)
33
+ value = ask("Please enter #{option}:")
34
+ raise Thor::Error, "You must enter a value for that field." if value.empty?
35
+ value
36
+ end
27
37
  end
28
38
  end
@@ -51,14 +51,5 @@ module MarhanCli
51
51
  options[option_name]
52
52
  end
53
53
 
54
- def get_or_ask(option_name)
55
- options[option_name] || ask_for_option(:host)
56
- end
57
-
58
- def ask_for_option(option)
59
- value = ask("Please enter #{option}:")
60
- raise Thor::Error, "You must enter a value for that field." if value.empty?
61
- value
62
- end
63
54
  end
64
55
  end
@@ -9,11 +9,17 @@ module MarhanCli
9
9
 
10
10
  desc "crypt:mount", "Mounts encrypted disk with TrueCrypt"
11
11
 
12
+ method_option :device,
13
+ :type => :string,
14
+ :aliases => "-d",
15
+ :desc => "Name of device in configuration file."
16
+
12
17
  def mount
13
18
  begin
14
19
  config = load_config
20
+ device = get_or_ask(:device)
15
21
  @app = TrueCryptApp.new(config.crypt.mount_folder)
16
- run @app.mount_command(config.crypt[:encrypted_devices])
22
+ run @app.mount_command(config.crypt.encrypted_devices[device], device)
17
23
  say "finished", :green
18
24
  rescue Exception => e
19
25
  exit_with_error(e)
@@ -44,6 +50,5 @@ module MarhanCli
44
50
  exit_with_error(e)
45
51
  end
46
52
  end
47
-
48
53
  end
49
54
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module MarhanCli
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marhan_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-02 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor