cody 0.9.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -9
  3. data/CHANGELOG.md +8 -0
  4. data/Gemfile +0 -2
  5. data/cody.gemspec +3 -3
  6. data/lib/cody.rb +4 -8
  7. data/lib/cody/aws_services.rb +1 -1
  8. data/lib/cody/aws_services/helpers.rb +20 -3
  9. data/lib/cody/cli.rb +2 -13
  10. data/lib/cody/{badge.rb → cli/badge.rb} +1 -1
  11. data/lib/cody/{base.rb → cli/base.rb} +9 -3
  12. data/lib/cody/{delete.rb → cli/delete.rb} +3 -3
  13. data/lib/cody/cli/deploy.rb +7 -0
  14. data/lib/cody/cli/help.rb +11 -0
  15. data/lib/cody/{help → cli/help}/deploy.md +0 -0
  16. data/lib/cody/{help → cli/help}/init.md +0 -0
  17. data/lib/cody/{help → cli/help}/logs.md +0 -0
  18. data/lib/cody/{help → cli/help}/start.md +0 -0
  19. data/lib/cody/{help → cli/help}/stop.md +0 -0
  20. data/lib/cody/{init.rb → cli/init.rb} +1 -2
  21. data/lib/cody/{list.rb → cli/list.rb} +7 -3
  22. data/lib/cody/cli/logs.rb +10 -0
  23. data/lib/cody/{sequence.rb → cli/sequence.rb} +3 -3
  24. data/lib/cody/{start.rb → cli/start.rb} +3 -3
  25. data/lib/cody/{status.rb → cli/status.rb} +2 -1
  26. data/lib/cody/{stop.rb → cli/stop.rb} +2 -1
  27. data/lib/cody/command.rb +11 -0
  28. data/lib/cody/core.rb +5 -5
  29. data/lib/cody/dsl/base.rb +9 -0
  30. data/lib/cody/dsl/project.rb +54 -49
  31. data/lib/cody/dsl/role.rb +11 -11
  32. data/lib/cody/dsl/schedule.rb +8 -8
  33. data/lib/cody/list/no_builds_project.rb +1 -1
  34. data/lib/cody/list/project.rb +1 -1
  35. data/lib/cody/project.rb +23 -23
  36. data/lib/cody/role.rb +20 -20
  37. data/lib/cody/schedule.rb +37 -37
  38. data/lib/cody/stack.rb +16 -71
  39. data/lib/cody/stack/base.rb +104 -0
  40. data/lib/cody/{create.rb → stack/create.rb} +2 -2
  41. data/lib/cody/{update.rb → stack/update.rb} +2 -2
  42. data/lib/cody/tailer.rb +1 -1
  43. data/lib/cody/version.rb +1 -1
  44. data/lib/template/project/buildspec.yml +1 -1
  45. data/lib/template/project/project.rb.tt +5 -19
  46. metadata +64 -70
  47. data/lib/cody/completer.rb +0 -159
  48. data/lib/cody/completer/script.rb +0 -6
  49. data/lib/cody/completer/script.sh +0 -10
  50. data/lib/cody/deploy.rb +0 -40
  51. data/lib/cody/help.rb +0 -9
  52. data/lib/cody/help/completion.md +0 -22
  53. data/lib/cody/help/completion_script.md +0 -3
  54. data/lib/cody/logs.rb +0 -14
  55. data/vendor/aws_data/CHANGELOG.md +0 -7
  56. data/vendor/aws_data/Gemfile +0 -4
  57. data/vendor/aws_data/LICENSE.txt +0 -21
  58. data/vendor/aws_data/README.md +0 -42
  59. data/vendor/aws_data/Rakefile +0 -6
  60. data/vendor/aws_data/aws_data.gemspec +0 -30
  61. data/vendor/aws_data/bin/console +0 -14
  62. data/vendor/aws_data/bin/setup +0 -8
  63. data/vendor/aws_data/lib/aws_data.rb +0 -91
  64. data/vendor/aws_data/lib/aws_data/version.rb +0 -3
  65. data/vendor/aws_data/spec/aws_data_spec.rb +0 -5
  66. data/vendor/aws_data/spec/spec_helper.rb +0 -14
  67. data/vendor/cfn-status/Gemfile +0 -4
  68. data/vendor/cfn-status/LICENSE.txt +0 -21
  69. data/vendor/cfn-status/README.md +0 -56
  70. data/vendor/cfn-status/Rakefile +0 -6
  71. data/vendor/cfn-status/bin/console +0 -14
  72. data/vendor/cfn-status/bin/setup +0 -8
  73. data/vendor/cfn-status/cfn-status.gemspec +0 -30
  74. data/vendor/cfn-status/lib/cfn/aws_service.rb +0 -56
  75. data/vendor/cfn-status/lib/cfn/status.rb +0 -220
  76. data/vendor/cfn-status/lib/cfn/status/version.rb +0 -5
  77. data/vendor/cfn-status/spec/cfn/status_spec.rb +0 -81
  78. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +0 -1080
  79. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +0 -1080
  80. data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +0 -1086
  81. data/vendor/cfn-status/spec/spec_helper.rb +0 -14
  82. data/vendor/cfn_camelizer/CHANGELOG.md +0 -10
  83. data/vendor/cfn_camelizer/Gemfile +0 -4
  84. data/vendor/cfn_camelizer/LICENSE.txt +0 -21
  85. data/vendor/cfn_camelizer/README.md +0 -40
  86. data/vendor/cfn_camelizer/Rakefile +0 -6
  87. data/vendor/cfn_camelizer/bin/console +0 -14
  88. data/vendor/cfn_camelizer/bin/setup +0 -8
  89. data/vendor/cfn_camelizer/cfn_camelizer.gemspec +0 -32
  90. data/vendor/cfn_camelizer/lib/camelizer.yml +0 -33
  91. data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +0 -92
  92. data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +0 -3
  93. data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +0 -79
  94. data/vendor/cfn_camelizer/spec/spec_helper.rb +0 -14
@@ -1,9 +0,0 @@
1
- module Cody::Help
2
- class << self
3
- def text(namespaced_command)
4
- path = namespaced_command.to_s.gsub(':','/')
5
- path = File.expand_path("../help/#{path}.md", __FILE__)
6
- IO.read(path) if File.exist?(path)
7
- end
8
- end
9
- end
@@ -1,22 +0,0 @@
1
- Example:
2
-
3
- cody completion
4
-
5
- Prints words for TAB auto-completion.
6
-
7
- Examples:
8
-
9
- cody completion
10
- cody completion hello
11
- cody completion hello name
12
-
13
- To enable, TAB auto-completion add the following to your profile:
14
-
15
- eval $(cody completion_script)
16
-
17
- Auto-completion example usage:
18
-
19
- cody [TAB]
20
- cody hello [TAB]
21
- cody hello name [TAB]
22
- cody hello name --[TAB]
@@ -1,3 +0,0 @@
1
- To use, add the following to your `~/.bashrc` or `~/.profile`
2
-
3
- eval $(cody completion_script)
@@ -1,14 +0,0 @@
1
- module Cody
2
- class Logs < Base
3
- def run
4
- unless build_id
5
- puts "WARN: No builds found for #{@project_name.color(:green)} project"
6
- return
7
- end
8
-
9
- run_with_exception_handling do
10
- Tailer.new(@options, build_id).run
11
- end
12
- end
13
- end
14
- end
@@ -1,7 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
-
6
- ## [0.1.0]
7
- - Initial release
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in aws_data.gemspec
4
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019 Tung Nguyen
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,42 +0,0 @@
1
- # AwsData
2
-
3
- Simple AWS data library helper. Info like region and account id.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'aws_data'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install aws_data
20
-
21
- ## Usage
22
-
23
- ```ruby
24
- require "aws_data"
25
- aws = AwsData.new
26
- aws.account # account id
27
- aws.region # region
28
- ```
29
-
30
- ## Development
31
-
32
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
-
34
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
-
36
- ## Contributing
37
-
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aws_data.
39
-
40
- ## License
41
-
42
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,30 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "aws_data/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "aws_data"
7
- spec.version = AwsData::VERSION
8
- spec.authors = ["Tung Nguyen"]
9
- spec.email = ["tongueroo@gmail.com"]
10
-
11
- spec.summary = "AWS info like region and account id"
12
- spec.homepage = "https://github.com/tongueroo/aws_data"
13
- spec.license = "MIT"
14
-
15
- # Specify which files should be added to the gem when it is released.
16
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_dependency "memoist"
25
- spec.add_dependency "aws-sdk-core" # contains sts service
26
-
27
- spec.add_development_dependency "bundler", "~> 2.0"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
- end
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "aws_data"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,91 +0,0 @@
1
- require "aws_data/version"
2
- require "aws-sdk-core"
3
- require "aws-sdk-sts"
4
- require "memoist"
5
-
6
- class AwsData
7
- class Error < StandardError; end
8
- extend Memoist
9
-
10
- def region
11
- return 'us-east-1' if test?
12
-
13
- return ENV['AWS_REGION'] if ENV['AWS_REGION'] # highest precedence
14
-
15
- region = nil
16
-
17
- # First if aws binary is available
18
- # try to get it from the ~/.aws/config
19
- if which('aws')
20
- region = `aws configure get region 2>&1`.strip rescue nil
21
- exit_code = $?.exitstatus
22
- if exit_code != 0
23
- exception_message = region.split("\n").grep(/botocore\.exceptions/).first
24
- if exception_message
25
- puts "WARN: #{exception_message}".color(:yellow)
26
- else
27
- # show full message as warning
28
- puts region.color(:yellow)
29
- end
30
- puts "You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region"
31
- region = nil
32
- end
33
- region = nil if region == ''
34
- return region if region
35
- end
36
-
37
- # Second try the metadata endpoint, should be available on AWS Lambda environment
38
- # https://stackoverflow.com/questions/4249488/find-region-from-within-an-ec2-instance
39
- begin
40
- az = `curl -s --max-time 3 --connect-timeout 5 http://169.254.169.254/latest/meta-data/placement/availability-zone`
41
- region = az.strip.chop # remove last char
42
- region = nil if region == ''
43
- rescue
44
- end
45
- return region if region
46
-
47
- 'us-east-1' # default if all else fails
48
- end
49
- memoize :region
50
-
51
- # aws sts get-caller-identity
52
- def account
53
- return '123456789' if test?
54
- return ENV['AWS_ACCOUNT'] if ENV['AWS_ACCOUNT']
55
-
56
- # ensure region set, required for sts.get_caller_identity.account to work
57
- ENV['AWS_REGION'] ||= region
58
- begin
59
- sts.get_caller_identity.account
60
- rescue Aws::Errors::MissingCredentialsError
61
- puts "INFO: You're missing AWS credentials. Only local services are currently available"
62
- end
63
- end
64
- memoize :account
65
-
66
- private
67
- def test?
68
- ENV['TEST']
69
- end
70
-
71
- # Cross-platform way of finding an executable in the $PATH.
72
- #
73
- # which('ruby') #=> /usr/bin/ruby
74
- #
75
- # source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
76
- def which(cmd)
77
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
78
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
79
- exts.each { |ext|
80
- exe = File.join(path, "#{cmd}#{ext}")
81
- return exe if File.executable?(exe) && !File.directory?(exe)
82
- }
83
- end
84
- return nil
85
- end
86
-
87
- def sts
88
- Aws::STS::Client.new
89
- end
90
- memoize :sts
91
- end
@@ -1,3 +0,0 @@
1
- class AwsData
2
- VERSION = "0.1.0"
3
- end
@@ -1,5 +0,0 @@
1
- RSpec.describe AwsData do
2
- it "has a version number" do
3
- expect(AwsData::VERSION).not_to be nil
4
- end
5
- end
@@ -1,14 +0,0 @@
1
- require "bundler/setup"
2
- require "aws_data"
3
-
4
- RSpec.configure do |config|
5
- # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = ".rspec_status"
7
-
8
- # Disable RSpec exposing methods globally on `Module` and `main`
9
- config.disable_monkey_patching!
10
-
11
- config.expect_with :rspec do |c|
12
- c.syntax = :expect
13
- end
14
- end
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in cfn-status.gemspec
4
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019 Tung Nguyen
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,56 +0,0 @@
1
- # Cfn Status
2
-
3
- Helper library provides status of CloudFormation stack.
4
-
5
- ## Usage
6
-
7
- Add this line to your gem's gemspec:
8
-
9
- ```ruby
10
- gem.add_development_dependency "cfn-status"
11
- ```
12
-
13
- Require it to your library:
14
-
15
- ```ruby
16
- require "cfn/status"
17
- ```
18
-
19
- Use like so:
20
-
21
- ```ruby
22
- status = Cfn::Status.new(stack_name)
23
- status.run # prints out stack events
24
- ```
25
-
26
- The `status.run` will:
27
-
28
- * print out the most recent stack events and return right away if the stack is in a completed state.
29
- * print out the most recent stack events and poll for more events until the stack in a completed state.
30
-
31
- To find out whether the most recent completed state of the stack was a success or a fail, you can use `status.success?`.
32
-
33
- ```ruby
34
- status.success?
35
- ```
36
-
37
- If you need to just wait for the stack to complete, you can also use `status.wait`.
38
-
39
- ```ruby
40
- status.wait
41
- status.success?
42
- ```
43
-
44
- ## Development
45
-
46
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
-
48
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
-
50
- ## Contributing
51
-
52
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cfn-status.
53
-
54
- ## License
55
-
56
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "cfn/status"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,30 +0,0 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "cfn/status/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cfn-status"
8
- spec.version = Cfn::Status::VERSION
9
- spec.authors = ["Tung Nguyen"]
10
- spec.email = ["tongueroo@gmail.com"]
11
-
12
- spec.summary = "CloudFormation status library"
13
- spec.homepage = "https://github.com/tongueroo/cfn-status"
14
- spec.license = "MIT"
15
-
16
- # Specify which files should be added to the gem when it is released.
17
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- end
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ["lib"]
24
-
25
- spec.add_dependency "aws-sdk-cloudformation"
26
-
27
- spec.add_development_dependency "bundler", "~> 2.0"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
- end