forger 2.0.4 → 2.0.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
  SHA256:
3
- metadata.gz: 87afc9047bd6ddfd919e409829ff4a41eb4e4278a9b49f8e4ed2d4203392aa20
4
- data.tar.gz: 1f57d952114627db436d8c66847fcfd297138b8741090388a4a96dd5cb7f77c4
3
+ metadata.gz: 24b35480802991ec9af7a567180f74723adabcf858c5b4ddcc6fc14a3944d7f7
4
+ data.tar.gz: 046b74aae0f9b3d7cdeefbcaabd6409f0485cb2974c111667e6e03b26f2e473c
5
5
  SHA512:
6
- metadata.gz: 6eea81c540ba1eaf35aa6ce7cc5e6308019ca4eb6927664380c1029a2458122577c26c8357c02838625781b428b52bd859000bafd043376cc4ac4cf6f273edc0
7
- data.tar.gz: a1d92f74984329a186d0e7bee07f9ad60adb3277737f81e9b2c80c67e51723a63fa9a78671abdae3ca85d13ac3a5f0f02325fd8fcfbd4d4619cf782635c8b265
6
+ metadata.gz: fb5996ebc2e3059ff16f6ffb4487be82c2348495167479c834de6f33550b282995a717ecfa67ebd739b1773b61e6c231e0744c3b3546fe6c54ddcd9959773f19
7
+ data.tar.gz: da660ea8453c5905d74507a19a34e9243610d943e60fcacc2f3abcc341141926abf5c3dabdbe9ebc7b0eaae0cc5a8d952bc86e4d0b44c01a32b4026110c244f4
@@ -0,0 +1,67 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ # specify the version you desire here
10
+ - image: circleci/ruby:2.5.3
11
+
12
+ working_directory: ~/repo
13
+
14
+ steps:
15
+ - checkout
16
+
17
+ - run:
18
+ name: submodule sync
19
+ command: |
20
+ git submodule sync
21
+ git submodule update --init
22
+
23
+ # Download and cache dependencies
24
+ # Cannot cache with Gemfile.lock since it is gitignore.
25
+ # Not caching with Gemfile, would rather not.
26
+ # - restore_cache:
27
+ # keys:
28
+ # - v2-dependencies-{{ checksum "Gemfile.lock" }}
29
+ # # fallback to using the latest cache if no exact match is found
30
+ # - v2-dependencies-
31
+
32
+ - run:
33
+ name: install dependencies
34
+ command: |
35
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
36
+
37
+ # - save_cache:
38
+ # paths:
39
+ # - ./vendor/bundle
40
+ # key: v2-dependencies-{{ checksum "Gemfile.lock" }}
41
+
42
+ # test require this
43
+ - run:
44
+ name: configure git
45
+ command: |
46
+ git config --global user.email "tongueroo@gmail.com"
47
+ git config --global user.name "Tung Nguyen"
48
+
49
+ # run tests!
50
+ - run:
51
+ name: run tests
52
+ command: |
53
+ mkdir /tmp/test-results
54
+
55
+ cat >.rspec <<EOL
56
+ --format documentation
57
+ --require spec_helper
58
+ EOL
59
+
60
+ bundle exec rspec
61
+
62
+ # collect reports
63
+ - store_test_results:
64
+ path: /tmp/test-results
65
+ - store_artifacts:
66
+ path: /tmp/test-results
67
+ destination: test-results
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [2.0.5]
7
+ - add circle config: circleci 2.0
8
+ - use rainbow gem for terminal colors
9
+
6
10
  ## [2.0.4]
7
11
  - Merge pull request #15 from tongueroo/tmp-write-area: move write operations to /tmp area
8
12
 
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- forger (2.0.4)
4
+ forger (2.0.5)
5
5
  activesupport
6
6
  aws-sdk-ec2
7
7
  aws-sdk-s3
8
- colorize
9
8
  dotenv
10
9
  filesize
11
10
  hashie
12
11
  memoist
12
+ rainbow
13
13
  render_me_pretty
14
14
  thor
15
15
 
@@ -22,30 +22,29 @@ GEM
22
22
  minitest (~> 5.1)
23
23
  tzinfo (~> 1.1)
24
24
  aws-eventstream (1.0.1)
25
- aws-partitions (1.125.0)
26
- aws-sdk-core (3.44.0)
25
+ aws-partitions (1.135.0)
26
+ aws-sdk-core (3.46.0)
27
27
  aws-eventstream (~> 1.0)
28
28
  aws-partitions (~> 1.0)
29
29
  aws-sigv4 (~> 1.0)
30
30
  jmespath (~> 1.0)
31
- aws-sdk-ec2 (1.63.0)
31
+ aws-sdk-ec2 (1.67.0)
32
32
  aws-sdk-core (~> 3, >= 3.39.0)
33
33
  aws-sigv4 (~> 1.0)
34
34
  aws-sdk-kms (1.13.0)
35
35
  aws-sdk-core (~> 3, >= 3.39.0)
36
36
  aws-sigv4 (~> 1.0)
37
- aws-sdk-s3 (1.30.0)
37
+ aws-sdk-s3 (1.30.1)
38
38
  aws-sdk-core (~> 3, >= 3.39.0)
39
39
  aws-sdk-kms (~> 1)
40
40
  aws-sigv4 (~> 1.0)
41
41
  aws-sigv4 (1.0.3)
42
42
  byebug (10.0.2)
43
43
  coderay (1.1.2)
44
- colorize (0.8.1)
45
44
  concurrent-ruby (1.1.4)
46
45
  diff-lcs (1.3)
47
- dotenv (2.5.0)
48
- ffi (1.9.25)
46
+ dotenv (2.6.0)
47
+ ffi (1.10.0)
49
48
  filesize (0.2.0)
50
49
  formatador (0.2.5)
51
50
  guard (2.15.0)
@@ -57,8 +56,8 @@ GEM
57
56
  pry (>= 0.9.12)
58
57
  shellany (~> 0.0)
59
58
  thor (>= 0.18.1)
60
- guard-bundler (2.1.0)
61
- bundler (~> 1.0)
59
+ guard-bundler (2.2.1)
60
+ bundler (>= 1.3.0, < 3)
62
61
  guard (~> 2.2)
63
62
  guard-compat (~> 1.1)
64
63
  guard-compat (1.2.1)
@@ -67,7 +66,7 @@ GEM
67
66
  guard-compat (~> 1.1)
68
67
  rspec (>= 2.99.0, < 4.0)
69
68
  hashie (3.6.0)
70
- i18n (1.2.0)
69
+ i18n (1.5.3)
71
70
  concurrent-ruby (~> 1.0)
72
71
  jmespath (1.4.0)
73
72
  listen (3.1.5)
@@ -85,13 +84,14 @@ GEM
85
84
  pry (0.12.2)
86
85
  coderay (~> 1.1.0)
87
86
  method_source (~> 0.9.0)
87
+ rainbow (3.0.0)
88
88
  rake (12.3.2)
89
89
  rb-fsevent (0.10.3)
90
90
  rb-inotify (0.10.0)
91
91
  ffi (~> 1.0)
92
- render_me_pretty (0.8.1)
92
+ render_me_pretty (0.8.2)
93
93
  activesupport
94
- colorize
94
+ rainbow
95
95
  tilt
96
96
  rspec (3.8.0)
97
97
  rspec-core (~> 3.8.0)
@@ -21,11 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "activesupport"
22
22
  spec.add_dependency "aws-sdk-ec2"
23
23
  spec.add_dependency "aws-sdk-s3"
24
- spec.add_dependency "colorize"
25
24
  spec.add_dependency "dotenv"
26
25
  spec.add_dependency "filesize"
27
26
  spec.add_dependency "hashie"
28
27
  spec.add_dependency "memoist"
28
+ spec.add_dependency "rainbow"
29
29
  spec.add_dependency "render_me_pretty"
30
30
  spec.add_dependency "thor"
31
31
 
@@ -1,6 +1,6 @@
1
1
  $:.unshift(File.expand_path("../", __FILE__))
2
2
  require "forger/version"
3
- require "colorize"
3
+ require "rainbow/ext/string"
4
4
  require "render_me_pretty"
5
5
  require "memoist"
6
6
 
@@ -27,7 +27,7 @@ module Forger
27
27
 
28
28
  def validate_in_project!
29
29
  unless File.exist?("#{root}/profiles")
30
- puts "Could not find a profiles folder in the current directory. It does not look like you are running this command within a forger project. Please confirm that you are in a forger project and try again.".colorize(:red)
30
+ puts "Could not find a profiles folder in the current directory. It does not look like you are running this command within a forger project. Please confirm that you are in a forger project and try again.".color(:red)
31
31
  exit
32
32
  end
33
33
  end
@@ -17,7 +17,7 @@ module Forger
17
17
  Hook.run(:before_run_instances, @options)
18
18
  sync_scripts_to_s3
19
19
 
20
- puts "Creating EC2 instance #{@name.colorize(:green)}"
20
+ puts "Creating EC2 instance #{@name.color(:green)}"
21
21
  info = Info.new(@options, params)
22
22
  info.ec2_params
23
23
  if @options[:noop]
@@ -24,7 +24,7 @@ EOL
24
24
  end
25
25
 
26
26
  def print_error_message(exception, message)
27
- puts "ERROR: Unable to launch the instance.".colorize(:red)
27
+ puts "ERROR: Unable to launch the instance.".color(:red)
28
28
  puts message
29
29
  puts exception.message
30
30
  puts "For the full internal backtrace re-run the command with DEBUG=1"
@@ -62,7 +62,7 @@ class Forger::Create
62
62
  end
63
63
 
64
64
  def display_ssh(command)
65
- puts "=> #{command.join(' ')}".colorize(:green)
65
+ puts "=> #{command.join(' ')}".color(:green)
66
66
  end
67
67
 
68
68
  def retry_until_success(*command)
@@ -21,7 +21,7 @@ module Forger
21
21
  end
22
22
 
23
23
  def sh(command)
24
- puts "=> #{command}".colorize(:green)
24
+ puts "=> #{command}".color(:green)
25
25
  success = system(command)
26
26
  abort("Command failed") unless success
27
27
  end
@@ -19,7 +19,7 @@ module Forger
19
19
  if default_vpc
20
20
  default_vpc.vpc_id
21
21
  else
22
- puts "A default vpc was not found in this AWS account and region.".colorize(:red)
22
+ puts "A default vpc was not found in this AWS account and region.".color(:red)
23
23
  puts "Because there is no default vpc, please specify the --vpc-id option. More info: http://ufoships.com/reference/ufo-init/"
24
24
  exit 1
25
25
  end
@@ -15,15 +15,15 @@ module Forger
15
15
  file = profile_file(profile_name)
16
16
  return if File.exist?(file)
17
17
 
18
- puts "Unable to find a #{file.colorize(:green)} profile file."
19
- puts "Please double check that it exists or that you specified the right profile.".colorize(:red)
18
+ puts "Unable to find a #{file.color(:green)} profile file."
19
+ puts "Please double check that it exists or that you specified the right profile.".color(:red)
20
20
  exit 1
21
21
  end
22
22
 
23
23
  def load_profile(file)
24
24
  return {} unless File.exist?(file)
25
25
 
26
- puts "Using profile: #{file}".colorize(:green)
26
+ puts "Using profile: #{file}".color(:green)
27
27
  text = RenderMePretty.result(file, context: context)
28
28
  begin
29
29
  data = YAML.load(text)
@@ -31,7 +31,7 @@ module Forger
31
31
  tmp_file = file.sub("profiles", Forger.build_root)
32
32
  FileUtils.mkdir_p(File.dirname(tmp_file))
33
33
  IO.write(tmp_file, text)
34
- puts "There was an error evaluating in your yaml file #{file}".colorize(:red)
34
+ puts "There was an error evaluating in your yaml file #{file}".color(:red)
35
35
  puts "The evaludated yaml file has been saved at #{tmp_file} for debugging."
36
36
  puts "ERROR: #{e.message}"
37
37
  exit 1
@@ -20,7 +20,7 @@ class Forger::Script
20
20
  end
21
21
 
22
22
  def compile_folder(folder, layout_path=false)
23
- puts "Compiling app/#{folder} to tmp/app/#{folder}.".colorize(:green)
23
+ puts "Compiling app/#{folder} to tmp/app/#{folder}.".color(:green)
24
24
  Dir.glob("#{Forger.root}/app/#{folder}/**/*").each do |path|
25
25
  next if File.directory?(path)
26
26
  next if path.include?("layouts")
@@ -4,7 +4,7 @@ class Forger::Script
4
4
  class Compress < Forger::Base
5
5
  def compress
6
6
  reset
7
- puts "Tarballing #{BUILD_ROOT}/app/scripts folder to scripts.tgz".colorize(:green)
7
+ puts "Tarballing #{BUILD_ROOT}/app/scripts folder to scripts.tgz".color(:green)
8
8
  tarball_path = create_tarball
9
9
  save_scripts_info(tarball_path)
10
10
  puts "Tarball created at #{tarball_path}"
@@ -27,18 +27,18 @@ class Forger::Script
27
27
  return
28
28
  end
29
29
 
30
- puts "Uploading scripts.tgz (#{filesize}) to #{s3_dest}".colorize(:green)
30
+ puts "Uploading scripts.tgz (#{filesize}) to #{s3_dest}".color(:green)
31
31
  obj = s3_resource.bucket(bucket_name).object(key)
32
32
  start_time = Time.now
33
33
  upload_to_s3(obj, tarball_path)
34
- time_took = pretty_time(Time.now-start_time).colorize(:green)
34
+ time_took = pretty_time(Time.now-start_time).color(:green)
35
35
  puts "Time to upload code to s3: #{time_took}"
36
36
  end
37
37
 
38
38
  def upload_to_s3(obj, tarball_path)
39
39
  obj.upload_file(tarball_path)
40
40
  rescue Aws::S3::Errors::PermanentRedirect => e
41
- puts "ERROR: #{e.class} #{e.message}".colorize(:red)
41
+ puts "ERROR: #{e.class} #{e.message}".color(:red)
42
42
  puts "The bucket you are trying to upload scripts to is in a different region than the region the instance is being launched in."
43
43
  puts "You must configured FORGER_S3_ENDPOINT env variable to prevent this error. Example:"
44
44
  puts " FORGER_S3_ENDPOINT=https://s3.us-west-2.amazonaws.com"
@@ -46,7 +46,7 @@ class Forger::Script
46
46
  exit 1
47
47
  rescue Aws::S3::Errors::AccessDenied, Aws::S3::Errors::AllAccessDisabled
48
48
  e = $!
49
- puts "ERROR: #{e.class} #{e.message}".colorize(:red)
49
+ puts "ERROR: #{e.class} #{e.message}".color(:red)
50
50
  puts "You do not have permission to upload scripts to this bucket: #{bucket_name}. Are you sure the right bucket is configured?"
51
51
  if ENV['AWS_PROFILE']
52
52
  puts "Also maybe check your AWS_PROFILE env. Current AWS_PROFILE=#{ENV['AWS_PROFILE']}"
@@ -1,5 +1,4 @@
1
1
  require 'fileutils'
2
- require 'colorize'
3
2
  require 'active_support/core_ext/string'
4
3
  require 'thor'
5
4
  require 'bundler'
@@ -13,7 +13,7 @@ module Forger
13
13
  return @@data if @@data
14
14
 
15
15
  if @check_project && !File.exist?(project_settings_path)
16
- puts "ERROR: No settings file at #{project_settings_path}. Are you sure you are in a forger project?".colorize(:red)
16
+ puts "ERROR: No settings file at #{project_settings_path}. Are you sure you are in a forger project?".color(:red)
17
17
  exit 1
18
18
  end
19
19
 
@@ -16,7 +16,7 @@ module Forger::Template::Helper::AmiHelper
16
16
  if image
17
17
  image.image_id
18
18
  else
19
- puts "latest_ami helper method could not find an AMI with the query of: #{query.inspect}".colorize(:red)
19
+ puts "latest_ami helper method could not find an AMI with the query of: #{query.inspect}".color(:red)
20
20
  exit 1
21
21
  end
22
22
  end
@@ -9,7 +9,7 @@ module Forger::Template::Helper::CoreHelper
9
9
 
10
10
  path = "#{Forger.root}/app/user_data/#{name}"
11
11
  unless File.exist?(path)
12
- puts "ERROR: user-data script #{path.colorize(:red)} does not exist"
12
+ puts "ERROR: user-data script #{path.color(:red)} does not exist"
13
13
  exit
14
14
  end
15
15
  result = RenderMePretty.result(path, context: self, layout: layout_path)
@@ -50,7 +50,7 @@ module Forger::Template::Helper::CoreHelper
50
50
 
51
51
  # other named layouts should error if it doesnt exit
52
52
  unless File.exist?(layout_path)
53
- puts "ERROR: Layout #{layout_path} does not exist. Are you sure it exists? Exiting".colorize(:red)
53
+ puts "ERROR: Layout #{layout_path} does not exist. Are you sure it exists? Exiting".color(:red)
54
54
  exit 1
55
55
  end
56
56
 
@@ -55,11 +55,11 @@ private
55
55
  end
56
56
 
57
57
  if paths.size > 1 # ambiguous match
58
- puts "ERROR: Multiple possible partials found:".colorize(:red)
58
+ puts "ERROR: Multiple possible partials found:".color(:red)
59
59
  paths.each do |path|
60
60
  puts " #{path}"
61
61
  end
62
- puts "Please specify an extension in the name to remove the ambiguity.".colorize(:green)
62
+ puts "Please specify an extension in the name to remove the ambiguity.".color(:green)
63
63
  exit 1
64
64
  end
65
65
 
@@ -10,7 +10,7 @@ module Forger::Template::Helper::ScriptHelper
10
10
  user = options[:as] || "ec2-user"
11
11
 
12
12
  if Dir.glob("#{Forger.root}/app/scripts*").empty?
13
- puts "WARN: you are using the extract_scripts helper method but you do not have any app/scripts.".colorize(:yellow)
13
+ puts "WARN: you are using the extract_scripts helper method but you do not have any app/scripts.".color(:yellow)
14
14
  calling_line = caller[0].split(':')[0..1].join(':')
15
15
  puts "Called from: #{calling_line}"
16
16
  return ""
@@ -38,7 +38,7 @@ private
38
38
  lines = caller.reject { |l| l =~ %r{lib/forger} } # hide internal forger trace
39
39
  puts " #{lines[0]}"
40
40
 
41
- puts "Please configure your config/settings.yml with an s3_folder.".colorize(:red)
41
+ puts "Please configure your config/settings.yml with an s3_folder.".color(:red)
42
42
  exit 1
43
43
  end
44
44
 
@@ -1,3 +1,3 @@
1
1
  module Forger
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
@@ -11,7 +11,8 @@ describe Forger::CLI do
11
11
 
12
12
  it "ERB evaluates dotenv files" do
13
13
  out = execute("exe/forger create server #{@args}")
14
- user_data = IO.readlines("spec/fixtures/demo_project/tmp/user-data.txt")
14
+ project_name = ENV['CIRCLECI'] ? 'repo' : 'forger'
15
+ user_data = IO.readlines("/tmp/forger/#{project_name}/user-data.txt")
15
16
  found = !user_data.select { |l| l =~ /test_key: test-key-value/ }.empty?
16
17
  expect(found).to be true
17
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-17 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: colorize
56
+ name: dotenv
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: dotenv
70
+ name: filesize
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: filesize
84
+ name: hashie
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: hashie
98
+ name: memoist
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: memoist
112
+ name: rainbow
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -242,6 +242,7 @@ executables:
242
242
  extensions: []
243
243
  extra_rdoc_files: []
244
244
  files:
245
+ - ".circleci/config.yml"
245
246
  - ".gitignore"
246
247
  - ".gitmodules"
247
248
  - ".rspec"