cloud_encrypted_sync 0.2.0 → 0.3.0

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloud_encrypted_sync (0.2.0)
4
+ cloud_encrypted_sync (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -14,8 +14,8 @@ module CloudEncryptedSync
14
14
  @children ||= {}
15
15
  end
16
16
 
17
- def parse_command_line_options(opts,command_line_options)
18
- instance.parse_command_line_options(opts,command_line_options)
17
+ def parse_command_line_options(parser)
18
+ instance.parse_command_line_options(parser)
19
19
  end
20
20
 
21
21
  def write(data, key)
@@ -49,7 +49,7 @@ module CloudEncryptedSync
49
49
 
50
50
  end
51
51
 
52
- def parse_command_line_options(opts,command_line_options)
52
+ def parse_command_line_options(parser)
53
53
  raise Errors::TemplateMethodCalled.new('parse_command_line_options')
54
54
  end
55
55
 
@@ -66,16 +66,16 @@ module CloudEncryptedSync
66
66
  executable_name = File.basename($PROGRAM_NAME)
67
67
  clo = {:data_dir => "#{Etc.getpwuid.dir}/.cloud_encrypted_sync"}
68
68
 
69
- @option_parser = OptionParser.new do |opts|
70
- opts.banner = "Usage: #{executable_name} [options] /path/to/folder/to/sync"
71
- opts.on('--data-dir PATH',"Data directory where indexes and config file are found.") do |path|
69
+ @option_parser = OptionParser.new do |parser|
70
+ parser.banner = "Usage: #{executable_name} [options] /path/to/folder/to/sync"
71
+ parser.on('--data-dir PATH',"Data directory where indexes and config file are found.") do |path|
72
72
  clo[:data_dir] = path
73
73
  end
74
- opts.on('--adapter ADAPTERNAME', 'Name of cloud adapter to use.') do |adapter_name|
74
+ parser.on('--adapter ADAPTERNAME', 'Name of cloud adapter to use.') do |adapter_name|
75
75
  clo[:adapter_name] = adapter_name
76
- clo = AdapterLiaison.instance.adapters[adapter_name.to_sym].parse_command_line_options(opts,clo)
76
+ AdapterLiaison.instance.adapters[adapter_name.to_sym].parse_command_line_options(parser)
77
77
  end
78
- opts.on('--encryption-key KEY') do |key|
78
+ parser.on('--encryption-key KEY') do |key|
79
79
  clo[:encryption_key] = key
80
80
  end
81
81
  end
@@ -1,16 +1,16 @@
1
1
  module CloudEncryptedSync
2
2
  module Adapters
3
3
  class Dummy < Template
4
+ attr_accessor :bucket_name
4
5
 
5
6
  def write(data,key)
6
7
  stored_data[bucket_name][key] = data
7
8
  end
8
9
 
9
- def parse_command_line_options(opts,command_line_options)
10
- opts.on('--bucket BUCKETNAME', 'Name of cloud adapter to use.') do |bucket_name|
11
- command_line_options[:bucket] = bucket_name
10
+ def parse_command_line_options(parser)
11
+ parser.on('--bucket BUCKETNAME', 'Name of cloud adapter to use.') do |bucket_argument|
12
+ self.bucket_name = bucket_argument
12
13
  end
13
- return command_line_options
14
14
  end
15
15
 
16
16
  def read(key)
@@ -34,10 +34,6 @@ module CloudEncryptedSync
34
34
  @stored_data ||= { bucket_name => {} }
35
35
  end
36
36
 
37
- def bucket_name
38
- Configuration.settings[:bucket].to_sym
39
- end
40
-
41
37
  end
42
38
  end
43
39
  end
@@ -1,3 +1,3 @@
1
1
  module CloudEncryptedSync
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
data/test/test_helper.rb CHANGED
@@ -33,11 +33,13 @@ module CloudEncryptedSync
33
33
  :sync_path => test_source_folder
34
34
  })
35
35
  Configuration.stubs(:data_folder_path).returns("#{Etc.getpwuid.dir}/.cloud_encrypted_sync")
36
+ Adapters::Dummy.any_instance.stubs(:bucket_name).returns('test-bucket')
36
37
  end
37
38
 
38
39
  def unstub_configuration
39
40
  Configuration.unstub(:settings)
40
41
  Configuration.unstub(:data_folder_path)
42
+ Adapters::Dummy.any_instance.unstub(:bucket_name)
41
43
  end
42
44
 
43
45
  def test_source_folder
@@ -15,7 +15,7 @@ module CloudEncryptedSync
15
15
  test 'should raise errors on public methods' do
16
16
 
17
17
  method_argument_map = {
18
- :parse_command_line_options => [:foo,:bar],
18
+ :parse_command_line_options => :foo,
19
19
  :write => [:foo,:bar],
20
20
  :read => :foobar,
21
21
  :delete => :foobar,
@@ -17,7 +17,7 @@ module CloudEncryptedSync
17
17
  assert_equal('dummy',settings[:adapter_name])
18
18
  assert_equal('~/test/folder',settings[:data_dir])
19
19
  assert_equal('somestringofcharacters',settings[:encryption_key])
20
- assert_equal('foobar',settings[:bucket])
20
+ assert_equal('foobar',Adapters::Dummy.instance.bucket_name)
21
21
  end
22
22
 
23
23
  test 'should gracefully fail without path in ARGV' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_encrypted_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: