f2y_aws_tool 0.1.7 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1634d466b5e4424aee9ff293191e0d7044f53d6c
4
- data.tar.gz: 2e2aaf23e6a18bdc238e640c6efe141cb9da71a4
3
+ metadata.gz: 2f5a46a374ae7aba60050cc66b413fd851970e06
4
+ data.tar.gz: 90f7725f6b32753d4a7656d05ffb0289ee7e305c
5
5
  SHA512:
6
- metadata.gz: 17d893afff97107eae7ad01750fdc64058769108afd54a37d5521c02e76a093da8d9ceb21754fbe5e6f3415418fee69d6dd054469225c04d49ac05d60c69dfed
7
- data.tar.gz: 1a5cc1f3f46c1dc37beaccffff7c2ed762006641f4ffade11c20a3bece3de3b6bce7d6e08842624a72faa9be2785c6e0cbf3a1800347776d1baaea7d4f804bf8
6
+ metadata.gz: 31b827b2ffd1868f919ae0661522aa43a5178d40a62fae461b5397659bc3f4cb6dbd20820d94788200b98c9bfcc71a9c27d7f93699654cc03a1baed5b858f3a9
7
+ data.tar.gz: 014dc1412b33477450e9ccf6bd9a59b8c52420ee7216f90da17370e929ab5d9792cbed06d81de684c6128939135714e63ce7353cef0942b9465ccfaf06c022f3
data/bin/f2y-aws-tool CHANGED
@@ -2,17 +2,21 @@
2
2
  require "bundler/setup"
3
3
  require_relative '../lib/f2y_aws_tool'
4
4
  require 'thor'
5
+ require 'byebug'
5
6
 
6
7
  class F2yAwsToolCli < Thor
7
- method_option :stack_id, aliases: "-s", desc: "AWS Opsworks Stack Id", required: true, type: :string
8
- method_option :app_id, aliases: "-a", desc: "AWS Opsworks App Id", required: true, type: :string
9
- method_option :region, aliases: "-r", desc: "AWS Opsworks Region", required: true, type: :string
10
- method_option :wait, aliases: "-w", desc: "Wait until deploy is completed", type: :boolean, default: true
11
- method_option :migrate, aliases: "-m", desc: "Migrate database", type: :boolean, default: true
12
- method_option :access_key_id, aliases: "-k", desc: "AWS Access Key Id", type: :string, default: ENV['AWS_ACCESS_KEY_ID']
13
- method_option :secret_access_key, aliases: "-p", desc: "AWS Secret Access Key", type: :string, default: ENV['AWS_SECRET_ACCESS_KEY']
14
- method_option :log_level, aliases: "-l", desc: "Log level", type: :string, default: 'INFO', enum: ['DEBUG', 'INFO', 'ERROR']
15
- method_option :log_aws, aliases: "-s", desc: "Enable AWS Log", type: :boolean, default: false
8
+ method_option :target, desc: "Opsworks Target", type: :hash
9
+
10
+ method_option :access_key_id, desc: "AWS Access Key Id", type: :string, default: ENV['AWS_ACCESS_KEY_ID']
11
+ method_option :secret_access_key, desc: "AWS Secret Access Key", type: :string, default: ENV['AWS_SECRET_ACCESS_KEY']
12
+ method_option :region, desc: "AWS Opsworks Region", required: false, type: :string
13
+
14
+ method_option :wait, desc: "Wait until deploy is completed", type: :boolean, default: true
15
+ method_option :migrate, desc: "Migrate database", type: :boolean, default: true
16
+ method_option :log_level, desc: "Log level", type: :string, default: 'INFO', enum: ['DEBUG', 'INFO', 'ERROR']
17
+ method_option :log_aws, desc: "Enable AWS Log", type: :boolean, default: false
18
+
19
+
16
20
 
17
21
  desc "deploy", "Deploy Opsworks App"
18
22
  def deploy
data/f2y_aws_tool.gemspec CHANGED
@@ -40,5 +40,6 @@ Gem::Specification.new do |spec|
40
40
  spec.add_runtime_dependency "thor", "0.19.4"
41
41
  spec.add_runtime_dependency "aws-sdk", "2.7.7"
42
42
  spec.executables << "f2y-aws-tool"
43
+ spec.add_runtime_dependency "activesupport", "5.0.1"
43
44
 
44
45
  end
data/lib/f2y_aws_tool.rb CHANGED
@@ -1,11 +1,15 @@
1
1
  require 'aws-sdk'
2
2
  require 'yaml'
3
3
  require 'log4r'
4
+ require "active_support/hash_with_indifferent_access"
4
5
 
5
6
  require_relative "./f2y_aws_tool/version"
6
7
  require_relative "./f2y_aws_tool/deploy"
7
8
 
8
9
  module F2yAwsTool
10
+
11
+ class MissingAwsCredentials < StandardError; end
12
+
9
13
  extend self
10
14
 
11
15
  include Log4r
@@ -18,7 +22,7 @@ module F2yAwsTool
18
22
  end
19
23
 
20
24
  def log_format
21
- @log_format ||= Log4r::PatternFormatter.new(:pattern => "[%l] %d :: %m", :date_pattern => "%a %d %b %H:%M %p %Y")
25
+ @log_format ||= Log4r::PatternFormatter.new(:pattern => "F2Y-AWS-TOOL::%l %d :: %m", :date_pattern => "%a %d %b %H:%M %p %Y")
22
26
  end
23
27
 
24
28
  # Your code goes here...
@@ -43,11 +43,11 @@ module F2yAwsTool
43
43
  end
44
44
 
45
45
  def stack_id
46
- @stack_id ||= @options.fetch(:stack_id)
46
+ @stack_id ||= config.fetch(:stack_id)
47
47
  end
48
48
 
49
49
  def app_id
50
- @app_id ||= @options.fetch(:app_id)
50
+ @app_id ||= config.fetch(:app_id)
51
51
  end
52
52
 
53
53
  def region
@@ -92,6 +92,19 @@ module F2yAwsTool
92
92
  )
93
93
  end
94
94
 
95
+ def target
96
+ @target ||= HashWithIndifferentAccess.new(@options.fetch(:target))
97
+ end
98
+
99
+ def config
100
+ @config ||= begin
101
+ HashWithIndifferentAccess.new(YAML.load(File.read(target.fetch(:file))))
102
+ rescue KeyError
103
+ target
104
+ end
105
+ end
106
+
107
+
95
108
 
96
109
  end
97
110
 
@@ -1,3 +1,3 @@
1
1
  module F2yAwsTool
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: f2y_aws_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - nakedmoon
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.7.7
111
+ - !ruby/object:Gem::Dependency
112
+ name: activesupport
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 5.0.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 5.0.1
111
125
  description: Fit2You Amazon Web Services Tool.
112
126
  email:
113
127
  - tore.andrea@gmail.com