heirloom 0.12.4 → 0.12.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: 387329119518755b3986e46b25f5bf67213cbff2
4
- data.tar.gz: ebfd043ec1a6bb70acbb49cf76532b4dbb2ca8e7
3
+ metadata.gz: 6e53875623addc8598279fefdfec8c4a71d29a68
4
+ data.tar.gz: bcbc2a1ab5f612bc66a8a2b6f0f037fbb1a8bb0b
5
5
  SHA512:
6
- metadata.gz: b37e92d8b09bef36e6cf1acf078383e62d6c2cd7812e5a18a3d3a9751a36b57d18076ce089dc08cb9271bcbc6b46e74f94c50e55c0fb14adae04929588dc2697
7
- data.tar.gz: 0e2084f9ed3d225aae3989bac5bc6b181454a806a18a96fd68fa1d3d427070ad71cad3164cb5590c63cfe5a6e17551f691a8b9d507bfdf9e9f45d4e1fc663a4c
6
+ metadata.gz: 00dc8d2c29b1d01cf3d6796cc82de0141f21cf9efb7e9c9fcc545ad6a59b49e9f1a27d5df4468db08cc041fc7a234b26d050d031378cfc52a9ab5d6653be14c2
7
+ data.tar.gz: 555db1a43b07d64393361199307373706e7ebdb22a59e2fc07b44319d86233b0da141b166680884cc9b52cd6d5540fd88d04dd33b2af2ddfcd181b46543307e4
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 0.12.4: (04/02/2014):
1
+ ## 0.12.5 (04/03/2014):
2
+
3
+ * Updated download CLI argument validation
4
+
5
+ ## 0.12.4 (04/02/2014):
2
6
 
3
7
  * Bug fix in setup to properly read metadata region from config
4
8
  * Update to CLI environment message
data/README.md CHANGED
@@ -25,16 +25,16 @@ gem install heirloom --no-ri --no-rdoc
25
25
  To get started, copy the sample below to ~/.heirloom.yml and update the specified fields.
26
26
 
27
27
  ```
28
- # default environment
29
-
30
28
  default:
31
29
  access_key: UPDATE_ME
32
30
  secret_key: UPDATE_ME
33
31
  metadata_region: us-west-1
32
+ ```
34
33
 
35
- # multiple environments can be defined in heirloom.yml and selected
36
- # via the cli with the -e or --environment option
34
+ Multiple environments can be defined in heirloom.yml and selected via the cli
35
+ with the -e or --environment option
37
36
 
37
+ ```
38
38
  prod:
39
39
  access_key: UPDATE_ME
40
40
  secret_key: UPDATE_ME
@@ -46,14 +46,17 @@ preprod:
46
46
  metadata_region: us-west-1
47
47
  ```
48
48
 
49
- By default, heirloom will load **.heirloom.yml** from your home directory.
49
+ You can now use Heirloom. For a list of commands
50
50
 
51
- You can specify an alternate config file by setting the HEIRLOOM_CONFIG_FILE
52
- environment variable
51
+ heirloom -h
53
52
 
54
- ```
55
- export HEIRLOOM_CONFIG_FILE="~/special_config.yml"
56
- ```
53
+ For help on a specific command, append -h to the command:
54
+
55
+ heirloom setup -h
56
+
57
+ For help an overview of heirloom, see the [Overview Wiki](https://github.com/intuit/heirloom/wiki/Overview).
58
+
59
+ For detailed setup instructions, see the [Getting Started Guide](https://github.com/intuit/heirloom/wiki/GettingStarted).
57
60
 
58
61
  Documentation
59
62
  -------------
@@ -21,23 +21,20 @@ module Heirloom
21
21
  @catalog = Heirloom::Catalog.new :name => @opts[:name],
22
22
  :config => @config
23
23
 
24
+ # Determine if we can download directly from S3
25
+ # Or if we need to query additional information from the catalog
26
+ validate_or_bypass_catalog
27
+
28
+ # Lookup id, region & bucket_prefix from simpledb unless specified
24
29
  # Can't use fetch as Trollop sets :id to nil
25
- id = @opts[:id] ||( latest_id :name => @opts[:name],
26
- :config => @config)
30
+ @region = @opts[:region] || @catalog.regions.first
31
+ @bucket_prefix = @opts[:bucket_prefix] || @catalog.bucket_prefix
32
+ id = @opts[:id] || (latest_id :name => @opts[:name],
33
+ :config => @config)
27
34
 
28
35
  @archive = Archive.new :name => @opts[:name],
29
36
  :config => @config,
30
37
  :id => id
31
-
32
- unless @opts[:bucket_prefix]
33
- ensure_archive_exists :archive => @archive,
34
- :config => @config
35
- end
36
-
37
- # Lookup region & bucket_prefix from simpledb unless specified
38
- # To Do, valid validation message that simpledb exists
39
- @region = @opts[:region] || @catalog.regions.first
40
- @bucket_prefix = @opts[:bucket_prefix] || @catalog.bucket_prefix
41
38
  end
42
39
 
43
40
  def download
@@ -55,6 +52,25 @@ module Heirloom
55
52
 
56
53
  private
57
54
 
55
+ def validate_or_bypass_catalog
56
+ missing_bypass_catalog_args = [:bucket_prefix, :id, :region].reject {|a| @opts[a]}
57
+
58
+ if missing_bypass_catalog_args.none?
59
+ @logger.info "Required arguments to download Heirloom without querying catalog provided. Downloading..."
60
+ else
61
+ @logger.info "Querying catalog for '#{@opts[:name]}' information."
62
+ @logger.info "Add #{missing_bypass_catalog_args.join(', ')} to bypass querying catalog."
63
+
64
+ # Only verify the domain exists in Heirloom
65
+ # if we don't bypass the catalog
66
+ ensure_catalog_domain_exists :config => @config,
67
+ :catalog => @catalog
68
+ ensure_entry_exists_in_catalog :config => @config,
69
+ :catalog => @catalog,
70
+ :entry => @opts[:name]
71
+ end
72
+ end
73
+
58
74
  def read_options
59
75
  Trollop::options do
60
76
  version Heirloom::VERSION
@@ -80,14 +96,13 @@ EOS
80
96
  opt :metadata_region, "AWS region to store Heirloom metadata.", :type => :string
81
97
  opt :name, "Name of Heirloom.", :type => :string
82
98
  opt :output, "Path to output downloaded Heirloom. Must be existing directory.", :type => :string
83
- opt :region, "Region to download Heirloom.", :type => :string,
84
- :default => 'us-west-1'
99
+ opt :region, "Region to download Heirloom.", :type => :string
85
100
  opt :secret, "Secret for encrypted Heirloom.", :type => :string
86
101
  opt :secret_file, "Read secret from file.", :type => :string,
87
102
  :short => :none
88
- opt :aws_access_key, "AWS Access Key ID", :type => :string,
103
+ opt :aws_access_key, "AWS Access Key ID", :type => :string,
89
104
  :short => :none
90
- opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
105
+ opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
91
106
  :short => :none
92
107
  opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
93
108
  opt :environment, "Environment (defined in heirloom config file)", :type => :string
@@ -1,3 +1,3 @@
1
1
  module Heirloom
2
- VERSION = "0.12.4"
2
+ VERSION = "0.12.5"
3
3
  end
@@ -4,7 +4,7 @@ require 'heirloom/cli'
4
4
  describe Heirloom do
5
5
 
6
6
  before do
7
- @logger_double = double 'logger'
7
+ @logger_double = double 'logger', :info => true
8
8
  @config_double = double_config :logger => @logger_double
9
9
  @archive_double = double 'archive'
10
10
  Heirloom::HeirloomLogger.should_receive(:new).
@@ -56,8 +56,10 @@ describe Heirloom do
56
56
 
57
57
  context "id, region and bucket prefix not specified" do
58
58
  before do
59
- @catalog_double = double 'catalog', :regions => ['us-east-1', 'us-west-1'],
60
- :bucket_prefix => 'bp'
59
+ @catalog_double = double 'catalog', :regions => ['us-east-1', 'us-west-1'],
60
+ :bucket_prefix => 'bp',
61
+ :entry_exists_in_catalog? => true,
62
+ :catalog_domain_exists? => true
61
63
  @archive_double.stub :exists? => true
62
64
  options = { :name => 'archive_name',
63
65
  :level => 'info',
@@ -84,10 +86,10 @@ describe Heirloom do
84
86
 
85
87
  it "should download the latest archive from the first region" do
86
88
  @archive_double.should_receive(:download).with(:output => '/tmp/test123',
87
- :region => 'us-east-1',
88
- :bucket_prefix => 'bp',
89
- :extract => false,
90
- :secret => nil).
89
+ :region => 'us-east-1',
90
+ :bucket_prefix => 'bp',
91
+ :extract => false,
92
+ :secret => nil).
91
93
  and_return '/tmp/test123'
92
94
  @cli_download.should_receive(:ensure_path_is_directory).
93
95
  with(:config => @config_double,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heirloom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.4
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Weaver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake