terraspace-bundler 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a02d9119392f13a0a31079c756f565f1de0e4d200a3af9f84c732f4656ed6fc
4
- data.tar.gz: d9e07212f6efce634f6836bb8ac2a1dd184dc5a34562c24252c8e69c27f4889c
3
+ metadata.gz: 2837b88a7aebfc3da49d6cd0fb1b620bf83466ea375ff238cb8a854ad98218b8
4
+ data.tar.gz: d7c0637b9275fc66bc7865fe2fbf87671bb9257092c6de7b616f9238defbadbe
5
5
  SHA512:
6
- metadata.gz: 6e79f9d42d0ddc7856877ce4d1ce0dd2452eddb883e68694b28bc776512a56bcf829747bd589a66a28bf9687dca590404ff6cc8906df57c96a8dc62c40d12571
7
- data.tar.gz: 1915a7ec28c0cdce027b5f5ebcee59924853d4ad3ad8de2cc6e0db5ab5ff7f6d4d2260881e9df42cbeddc226d5574793701533647d07c86f576c04c4b3dcc7dc
6
+ metadata.gz: f0db0f6f68bb6bca532ac9fa6c1eefbcf9620324b39be2a52ae4b915faf2e9c5f5645f72aa96398b9d1624400930351273615d6916c588e8d4b53e25fec66441
7
+ data.tar.gz: 812d72dc1cfcd4039b08487574e7e4dced650e7ede4f119e43b45968732ea9203291b5823500b8db4b541eb1fff33687f3d82a7d5a92462f58df5d98ce8c0ba4
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.3.3] - 2021-02-24
7
+ - [#8](https://github.com/boltops-tools/terraspace-bundler/pull/8) fix https sources
8
+ - [#9](https://github.com/boltops-tools/terraspace-bundler/pull/9) Git checkout retry with v
9
+
6
10
  ## [0.3.2]
7
11
  - #4 only purge and export explicit mods
8
12
  - are you sure prompt for purge_cache
@@ -7,6 +7,7 @@ require "dsl_evaluator"
7
7
  require "fileutils"
8
8
  require "memoist"
9
9
  require "rainbow/ext/string"
10
+ require "singleton"
10
11
  require "terraspace_bundler/version"
11
12
  require "yaml"
12
13
 
@@ -37,7 +37,7 @@ class TerraspaceBundler::CLI
37
37
  terrafile_option.call
38
38
  def update(*mods)
39
39
  TB.update_mode = true
40
- TB::Runner.new(options.merge(mods: mods, mode: "update")).run
40
+ TB::Runner.new(options.merge(mods: mods)).run
41
41
  end
42
42
  end
43
43
  end
@@ -12,10 +12,9 @@ module TerraspaceBundler
12
12
  @version, @ref, @tag, @branch = @props[:version], @props[:ref], @props[:tag], @props[:branch]
13
13
  end
14
14
 
15
+ # support variety of options, prefer version
15
16
  def checkout_version
16
- v = detected_version
17
- v = "v#{v}" if type == "registry" && @version && !v.starts_with?("v")
18
- v
17
+ @version || @ref || @tag || @branch
19
18
  end
20
19
 
21
20
  # use url instead of source because for registry modules, the repo name is different
@@ -23,8 +22,11 @@ module TerraspaceBundler
23
22
  url_words[-1]
24
23
  end
25
24
 
25
+ # https://github.com/tongueroo/pet - 2nd to last word
26
+ # git@github.com:tongueroo/pet - 2nd to last word without chars before :
26
27
  def org
27
- url_words[-2] # second to last word
28
+ s = url_words[-2] # second to last word
29
+ s.split(':').last # in case of git@github.com:tongueroo/pet form
28
30
  end
29
31
 
30
32
  def full_repo
@@ -38,11 +40,6 @@ module TerraspaceBundler
38
40
  end
39
41
 
40
42
  private
41
- # support variety of options, prefer version
42
- def detected_version
43
- @version || @ref || @tag || @branch
44
- end
45
-
46
43
  def url_words
47
44
  url.split('/')
48
45
  end
@@ -35,7 +35,20 @@ class TerraspaceBundler::Mod
35
35
  if registry?
36
36
  registry.github_url
37
37
  else
38
- "#{TB.config.base_clone_url}#{source}" # Note: make sure to not use @source, is org may no be added
38
+ git_source_url
39
+ end
40
+ end
41
+
42
+ def git_source_url
43
+ if @source.include?('http') || @source.include?(':')
44
+ # Examples:
45
+ # mod "pet", source: "https://github.com/tongueroo/pet"
46
+ # mod "pet", source: "git@github.com:tongueroo/pet"
47
+ @source
48
+ else
49
+ # Examples:
50
+ # mod "pet", source: "tongueroo/pet"
51
+ "#{TB.config.base_clone_url}#{source}" # Note: make sure to not use @source, org may not be added
39
52
  end
40
53
  end
41
54
 
@@ -51,7 +51,7 @@ module TerraspaceBundler
51
51
  end
52
52
 
53
53
  def update_all?
54
- @options[:mode] == "update" && @options[:mods].empty?
54
+ TB.update_mode? && @options[:mods].empty?
55
55
  end
56
56
 
57
57
  def subtract(mods1, mods2)
@@ -21,10 +21,16 @@ module TerraspaceBundler::Util
21
21
  def git(command)
22
22
  sh("git #{command}")
23
23
  rescue TB::GitError => e
24
- logger.error "ERROR: There was a git error".color(:red)
25
- logger.error "Current dir: #{Dir.pwd}"
26
- logger.error "The error occur when running:"
27
- logger.error e.message
24
+ action, version = command.split(' ')
25
+ if action == "checkout" && version !~ /^v/
26
+ command = "checkout v#{version}"
27
+ retry
28
+ else
29
+ logger.error "ERROR: There was a git error".color(:red)
30
+ logger.error "Current dir: #{Dir.pwd}"
31
+ logger.error "The error occur when running:"
32
+ logger.error e.message
33
+ end
28
34
  exit 1
29
35
  end
30
36
  end
@@ -1,3 +1,3 @@
1
1
  module TerraspaceBundler
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  - !ruby/object:Gem::Version
251
251
  version: '0'
252
252
  requirements: []
253
- rubygems_version: 3.1.2
253
+ rubygems_version: 3.2.5
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: Bundles terraform modules