marhan_cli 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog.md CHANGED
@@ -31,4 +31,8 @@
31
31
 
32
32
  ## v0.0.8
33
33
 
34
- * Name (configuration key) of device as parameter of mount command. (command => crypt:mount)
34
+ * Name (configuration key) of device as parameter of mount command. (command => crypt:mount)
35
+
36
+ ## v0.0.9
37
+
38
+ * Name (configuration key) of device as parameter of unmount command. (command => crypt:unmount)
@@ -9,12 +9,12 @@ module MarhanCli
9
9
  @mount_folder = mount_folder
10
10
  end
11
11
 
12
- def mount_command(encrypted_device, mount_to_folder)
13
- "#{@binary} --mount #{encrypted_device} #{@mount_folder}/#{mount_to_folder}"
12
+ def mount_command(encrypted_device, mount_sub_folder)
13
+ "#{@binary} --mount #{encrypted_device} #{@mount_folder}/#{mount_sub_folder}"
14
14
  end
15
15
 
16
- def unmount_command()
17
- "#{@binary} -d #{@mount_folder}/enc1"
16
+ def unmount_command(mount_sub_folder)
17
+ "#{@binary} -d #{@mount_folder}/#{mount_sub_folder}"
18
18
  end
19
19
 
20
20
  def mount_folder
@@ -20,7 +20,7 @@ module MarhanCli
20
20
  unless File.exists?(config_file_path)
21
21
  raise "Stop processing! Command needs the configuration file '#{CONFIG_FILE}' in you're home directory."
22
22
  end
23
- say "I will use the '#{CONFIG_FILE}' configuration file in you're home directory.", :cyan
23
+ #say "I will use the '#{CONFIG_FILE}' configuration file in you're home directory.", :cyan
24
24
  config = Ambience.create(config_file_path)
25
25
  config.to_mash
26
26
  end
@@ -16,10 +16,10 @@ module MarhanCli
16
16
 
17
17
  def mount
18
18
  begin
19
- config = load_config
19
+ config = load_crypt_config
20
+ true_crypt = TrueCryptApp.new(config.mount_folder)
20
21
  device = get_or_ask(:device)
21
- @app = TrueCryptApp.new(config.crypt.mount_folder)
22
- run @app.mount_command(config.crypt.encrypted_devices[device], device)
22
+ run true_crypt.mount_command(config.encrypted_devices[device], device)
23
23
  say "finished", :green
24
24
  rescue Exception => e
25
25
  exit_with_error(e)
@@ -28,11 +28,17 @@ module MarhanCli
28
28
 
29
29
  desc "crypt:umount", "Unmounts encrypted disk with TrueCrypt"
30
30
 
31
- def unmount
31
+ method_option :device,
32
+ :type => :string,
33
+ :aliases => "-d",
34
+ :desc => "Name of device in configuration file."
35
+
36
+ def umount
32
37
  begin
33
- config = load_config
34
- @app = TrueCryptApp.new(config.crypt.mount_folder)
35
- run @app.unmount_command
38
+ config = load_crypt_config
39
+ true_crypt = TrueCryptApp.new(config.mount_folder)
40
+ device = get_or_ask(:device)
41
+ run true_crypt.unmount_command(device)
36
42
  say "finished", :green
37
43
  rescue Exception => e
38
44
  exit_with_error(e)
@@ -43,12 +49,18 @@ module MarhanCli
43
49
 
44
50
  def umount_all
45
51
  begin
46
- @app = TrueCryptApp.new
47
- run @app.unmount_all_command
52
+ true_crypt = TrueCryptApp.new
53
+ run true_crypt.unmount_all_command
48
54
  say "finished", :green
49
55
  rescue Exception => e
50
56
  exit_with_error(e)
51
57
  end
52
58
  end
59
+
60
+ protected
61
+
62
+ def load_crypt_config
63
+ load_config.crypt
64
+ end
53
65
  end
54
66
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module MarhanCli
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
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.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: