s3-wrapper 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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a8d7dd2086141bb4f09dc2de3e72354d43cf73f
4
- data.tar.gz: d7ececcb3e5b8c57205052a2513d74597c30183f
3
+ metadata.gz: 3edd1f247b2163ba9637531a55c1a830693a7149
4
+ data.tar.gz: e706e5a26484056932380e8069a03bc5e80455b4
5
5
  SHA512:
6
- metadata.gz: 945cb7e7a791e782af043bc6e7585cd7299ea43e01eba05bb39d4f879b9696128594716b09fc8131ed4b8315838285957ecff6c32d450348d8dfca8c3ca156cf
7
- data.tar.gz: fc13d6c8a82eb7203d5ce1fbc95d9bba26dd7dfc87abe422e17930c556476302bb0db40bba04a3aeae1cc75f71b7e8235b4b5c97d228b194f86442cc02306d64
6
+ metadata.gz: 1ab6353e7da0d12f7c09dfebb342e5265362a3ced9dec28dc05c4cc4467e0572728e07b2f5d47b3d0eb6f2b6df5de799863828c1366af01c0d16020dd831d987
7
+ data.tar.gz: 810389b9147742adbc1393ec80d08f2b7ed7c4fcb9d10c999c284059f79d969ba13075d1bcad6ac068ba0d3338ca32af28d07ae31827b0db9c7089d58f74faff
data/README.md CHANGED
@@ -20,17 +20,25 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- Make your profile and upload files to s3.
23
+ Commands to manage the configuration file
24
24
 
25
25
  ```bash
26
26
  s3-wrapper config-default aws_access_key='aws-access-key' aws_secret_key='aws-secret-key' bucket_name='some-bucket-to-use' host_name='name-of-host-to-backup'
27
- s3-wrapper create-profile 'profile-name' key1=value1 key2=value2
28
- s3-wrapper update-profile 'profile-name' key1=value1 key2=value2
27
+ s3-wrapper create-profile 'profile-name' aws_access_key=value1 aws_secret_key=value2
28
+ s3-wrapper update-profile 'profile-name' host_name=value1
29
+ s3-wrapper get-profile 'profile-name'
29
30
  s3-wrapper delete-profile 'profile-name'
31
+ ```
32
+
33
+ Commands to upload files
30
34
 
35
+ ```bash
31
36
  s3-wrapper upload 'profile-name' file1 file2
32
37
  ```
33
38
 
39
+ This tool uploads files under following hierachy. The bucket needs to be created beforehand and directories are automatically created by the tool.
40
+ s3://@bucket_name@/@host_name@/@profile-name@/@curr_yy_mm@/@filename@
41
+
34
42
  ## Contributing
35
43
 
36
44
  1. Fork it ( https://github.com/carl8899/s3-wrapper/fork )
@@ -10,7 +10,7 @@ class S3Wrapper
10
10
  end
11
11
 
12
12
  def self.create(name, params)
13
- config = read_config(name)
13
+ config = read_config(name, false)
14
14
  params.each do |key, value|
15
15
  config[name][key] = value
16
16
  end
@@ -19,13 +19,13 @@ class S3Wrapper
19
19
  end
20
20
 
21
21
  def self.delete(name)
22
- config = read_config(name)
22
+ config = read_config(name, false)
23
23
  config.delete(name)
24
24
  self::write_config(config)
25
25
  end
26
26
 
27
27
  def self.get(name)
28
- config = read_config(name)
28
+ config = read_config(name, true)
29
29
  S3Wrapper::Profile.new(name, config[name])
30
30
  end
31
31
 
@@ -43,7 +43,7 @@ class S3Wrapper
43
43
  end
44
44
 
45
45
  private
46
- def self.read_config(name)
46
+ def self.read_config(name, with_default)
47
47
  config = {}
48
48
  begin
49
49
  config = File.open(ENV['HOME'] + '/' + CONFIG_FILE) { |f| YAML.load(f) }
@@ -52,6 +52,11 @@ class S3Wrapper
52
52
  end
53
53
  config = {} unless config
54
54
  config[name] = {} unless config[name]
55
+ if with_default && config['default'] && name != 'default'
56
+ config['default'].each do |key, value|
57
+ config[name][key] = value unless config[name][key] && value;
58
+ end
59
+ end
55
60
  config
56
61
  end
57
62
 
@@ -1,3 +1,3 @@
1
1
  class S3Wrapper
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3-wrapper
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
  - Carl Blomberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler