terraspace-bundler 0.4.4 → 0.5.0

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: 152f604d7d2ba7bd4b6cfeccad223aa81c598d2f68ac1c6cb91f5b7ea5457c43
4
- data.tar.gz: 794f51b937c2559483912e007f3160b0957fa9276140167bb7b628aebd52e871
3
+ metadata.gz: 1917be53c7c75191b7630d35198eac5c1d3d9e606dd2663f1874093c469eba73
4
+ data.tar.gz: 54bd018c6a82eee7b35035984342db92c98d8ff2f8028c492b9d3780417520ea
5
5
  SHA512:
6
- metadata.gz: 06e52a0ea25a5bddeb5b46018a6eca99c18301c6a532c4f9c7750707cce67afea7df938d8744026e445ef96fb3a9007bc5522846eab1f560e8f963f2e84ba8da
7
- data.tar.gz: 0726b7ee532842d720ad59a189181ff26982dc5663b94f0f081fa71a7262de82e05e65fa385d527e32813762d2c7666955ca65ec22fa23f5acd755223ad7b385
6
+ metadata.gz: 59c11be8fb8ae722b15e2e60f00dd0d240c428370f9307b6df15fcd5b056912422fbceb1dddb521a38c8cd2a7b4c70b2f41c1018ad278dfd201ce370a7c0dae7
7
+ data.tar.gz: 8d2ec411f5f520bde8f6f04efc5eb5587a6362d5674bd5192f2b9ba03ded77dac92bdcf42948ed6cb73320110146e34f7fecba182c3bc0a5976a8de2dc4265bb
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
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.5.0] - 2022-01-15
7
+ - [#17](https://github.com/boltops-tools/terraspace-bundler/pull/17) ssh notation support
8
+
6
9
  ## [0.4.3] - 2021-11-20
7
10
  - [#14](https://github.com/boltops-tools/terraspace-bundler/pull/14) get version and use only that part of api since the latest version is currently down with a 502
8
11
  - [#15](https://github.com/boltops-tools/terraspace-bundler/pull/15) terraspace bundle example command
@@ -1,7 +1,7 @@
1
1
  class TerraspaceBundler::Dsl
2
2
  module Syntax
3
- def org(url)
4
- config.org = url
3
+ def org(value)
4
+ config.org = value
5
5
  end
6
6
  alias_method :user, :org
7
7
 
@@ -11,7 +11,8 @@ module TerraspaceBundler::Mod::Concerns
11
11
  end
12
12
 
13
13
  def remove_subfolder_notation(source)
14
- parts = clean_notation(source).split('//')
14
+ clean = clean_notation(source)
15
+ parts = clean.split('//')
15
16
  if parts.size == 2 # has subfolder
16
17
  source.split('//')[0..-2].join('//') # remove only subfolder, keep rest of original source
17
18
  else
@@ -20,7 +21,8 @@ module TerraspaceBundler::Mod::Concerns
20
21
  end
21
22
 
22
23
  def subfolder(source)
23
- parts = clean_notation(source).split('//')
24
+ clean = clean_notation(source)
25
+ parts = clean.split('//')
24
26
  if parts.size == 2 # has subfolder
25
27
  remove_ref_notation(parts.last)
26
28
  end
@@ -35,8 +37,23 @@ module TerraspaceBundler::Mod::Concerns
35
37
  end
36
38
  end
37
39
 
40
+
38
41
  def clean_notation(source)
39
- source.sub(/.*::/,'').sub(%r{http[s?]://},'').sub(%r{git@(.*?):},'') # also remove git@ notation
42
+ clean = source
43
+ .sub(/.*::/,'') # remove git::
44
+ .sub(%r{http[s?]://},'') # remove https://
45
+ .sub(%r{git@(.*?):},'') # remove git@word
46
+ remove_host(clean)
47
+ end
48
+
49
+ def remove_host(clean)
50
+ return clean unless clean.include?('ssh://')
51
+ if clean.count(':') == 1
52
+ uri = URI(clean)
53
+ uri.path
54
+ else
55
+ clean.split(':').last
56
+ end
40
57
  end
41
58
  end
42
59
  end
@@ -18,11 +18,11 @@ module TerraspaceBundler::Mod::Concerns
18
18
  end
19
19
 
20
20
  def cache_path(name)
21
- [cache_root, parent_stage_folder, name].compact.join('/')
21
+ [cache_root, @mod.type, name].compact.join('/')
22
22
  end
23
23
 
24
24
  def stage_path(name)
25
- [stage_root, parent_stage_folder, name].compact.join('/')
25
+ [stage_root, @mod.type, name].compact.join('/')
26
26
  end
27
27
 
28
28
  # Fetcher: Downloader/Local copies to a slightly different folder.
@@ -41,21 +41,8 @@ module TerraspaceBundler::Mod::Concerns
41
41
  when 'http'
42
42
  path = type_path # https://www.googleapis.com/storage/v1/BUCKET_NAME/PATH/TO/module.zip
43
43
  remove_ext(path) # terraform-example-modules/modules/example-module
44
- when -> (_) { @mod.source.include?('git::') }
45
- @mod.name # example-module
46
- else # inferred git, registry
47
- @mod.full_repo # tongueroo/example-module
48
- end
49
- end
50
-
51
- def parent_stage_folder
52
- case @mod.type
53
- when 'local'
54
- 'local'
55
- when 'http'
56
- 'http'
57
- else # gcs, s3, git, registry
58
- @mod.vcs_provider
44
+ else # inferred git, registry, git::, ssh://, git::ssh://
45
+ @mod.repo_folder # tongueroo/example-module
59
46
  end
60
47
  end
61
48
 
@@ -4,11 +4,11 @@ class TerraspaceBundler::Mod::Fetcher
4
4
 
5
5
  def run
6
6
  setup_tmp
7
- org_path = cache_path(@mod.org)
8
- FileUtils.mkdir_p(org_path)
7
+ org_folder = cache_path(@mod.org_folder)
8
+ FileUtils.mkdir_p(org_folder)
9
9
 
10
- Dir.chdir(org_path) do
11
- logger.debug "Current root dir: #{org_path}"
10
+ Dir.chdir(org_folder) do
11
+ logger.debug "Current root dir: #{org_folder}"
12
12
  clone unless File.exist?(@mod.repo)
13
13
 
14
14
  Dir.chdir(@mod.repo) do
@@ -45,12 +45,13 @@ class TerraspaceBundler::Mod::Fetcher
45
45
  if found
46
46
  found.split(':').last.strip
47
47
  else
48
- 'master'
48
+ ENV['TS_GIT_DEFAULT_BRANCH'] || 'master'
49
49
  end
50
50
  end
51
51
 
52
52
  def switch_version(version)
53
53
  stage_path = stage_path(rel_dest_dir)
54
+ logger.debug "stage_path #{stage_path}"
54
55
  Dir.chdir(stage_path) do
55
56
  git "checkout #{version}"
56
57
  @sha = git("rev-parse HEAD").strip
@@ -0,0 +1,65 @@
1
+ class TerraspaceBundler::Mod
2
+ class OrgRepo
3
+ def initialize(url)
4
+ @url = url.sub('ssh://','') # important to copy so dont change the string reference
5
+ end
6
+
7
+ def repo
8
+ org_repo_words[-1]
9
+ end
10
+
11
+ def org
12
+ s = org_folder.split('/').last
13
+ s ? s.split('/').last : 'none'
14
+ end
15
+
16
+ def org_folder
17
+ org_repo_words[-2] # second to last word
18
+ end
19
+
20
+ def repo_folder
21
+ org_repo_words.join('/')
22
+ end
23
+
24
+ def org_repo_words
25
+ if @url.include?(':') && !@url.match(%r{http[s?]://}) # user@host:repo git@github.com:org/repo
26
+ folder, repo = handle_string_with_colon
27
+ else # IE: https://github.com/org/repo, org/repo, etc
28
+ parts = @url.split('/')
29
+ folder = parts[0..-2].join('/')
30
+ repo = parts.last
31
+ end
32
+
33
+ org_path = clean_folder(folder)
34
+ repo = strip_dot_git(repo)
35
+ [org_path, repo]
36
+ end
37
+
38
+ def clean_folder(folder)
39
+ folder.sub(%r{.*@},'') # remove user@
40
+ .sub(%r{http[s?]://},'') # remove https://
41
+ end
42
+
43
+ # user@host:repo git@github.com:org/repo
44
+ def handle_string_with_colon
45
+ host, path = @url.split(':')
46
+ if path.size == 2
47
+ folder, repo = path.split(':')
48
+ else
49
+ folder = join(host, File.dirname(path))
50
+ repo = File.basename(path)
51
+ end
52
+ [folder, repo]
53
+ end
54
+
55
+ def join(*path)
56
+ path.compact!
57
+ path[1] = path[1].sub('/','') if path[1].starts_with?('/')
58
+ path.reject(&:blank?).join('/')
59
+ end
60
+
61
+ def strip_dot_git(s)
62
+ s.sub(/\.git$/,'')
63
+ end
64
+ end
65
+ end
@@ -12,7 +12,9 @@ class TerraspaceBundler::Mod::Props
12
12
 
13
13
  # IE: git or registry
14
14
  def type
15
- if source.include?('::')
15
+ if source.include?('ssh://')
16
+ "git"
17
+ elsif source.include?('::')
16
18
  source.split('::').first # IE: git:: s3:: gcs::
17
19
  elsif local?
18
20
  "local"
@@ -66,6 +66,20 @@ class TerraspaceBundler::Mod
66
66
  end
67
67
 
68
68
  # git_source_url is normalized
69
+ #
70
+ # See: https://stackoverflow.com/questions/6167905/git-clone-through-ssh
71
+ #
72
+ # ssh://username@host.xz/absolute/path/to/repo.git/ - just a forward slash for absolute path on server
73
+ # username@host.xz:relative/path/to/repo.git/ - just a colon (it mustn't have the ssh:// for relative path on server (relative to home dir of username on server machine)
74
+ #
75
+ # When colon is separator for relative path do not want ssh prepended
76
+ #
77
+ # git clone ec2-user@localhost:repo
78
+ #
79
+ # When slash is separator for absolute path want ssh prepended
80
+ #
81
+ # git clone ssh://ec2-user@localhost/path/to/repo => valid URI
82
+ #
69
83
  def git_source_url
70
84
  if @source.include?('http') || @source.include?(':')
71
85
  # Examples:
@@ -76,7 +90,15 @@ class TerraspaceBundler::Mod
76
90
  # mod "example3", source: "git::https://example.com/example-module.git"
77
91
  #
78
92
  # sub to allow for generic git repo notiation
79
- @source.sub('git::','')
93
+ source = @source.sub('git::','')
94
+ if source.include?('ssh://')
95
+ if source.count(':') == 1
96
+ return source
97
+ else
98
+ return source.sub('ssh://', '')
99
+ end
100
+ end
101
+ source
80
102
  else
81
103
  # Examples:
82
104
  # mod "pet", source: "tongueroo/pet"
@@ -1,7 +1,9 @@
1
1
  module TerraspaceBundler
2
2
  class Mod
3
+ extend Memoist
3
4
  extend Props::Extension
4
5
  props :export_to, :name, :sha, :source, :subfolder, :type, :url, :clone_with
6
+ delegate :repo, :org, :repo_folder, :org_folder, to: :org_repo
5
7
 
6
8
  include Concerns::StackConcern
7
9
  include Concerns::LocalConcern
@@ -18,22 +20,6 @@ module TerraspaceBundler
18
20
  @version || @ref || @tag || @branch
19
21
  end
20
22
 
21
- # use url instead of source because for registry modules, the repo name is different
22
- def repo
23
- url_words[-1].sub(/\.git$/,'')
24
- end
25
-
26
- # https://github.com/tongueroo/pet - 2nd to last word
27
- # git@github.com:tongueroo/pet - 2nd to last word without chars before :
28
- def org
29
- s = url_words[-2] # second to last word
30
- s.split(':').last # in case of git@github.com:tongueroo/pet form
31
- end
32
-
33
- def full_repo
34
- "#{org}/#{repo}"
35
- end
36
-
37
23
  def latest_sha
38
24
  fetcher = Fetcher.new(self).instance
39
25
  fetcher.run
@@ -44,15 +30,18 @@ module TerraspaceBundler
44
30
  if url.include?('http')
45
31
  # "https://github.com/org/repo" => github.com
46
32
  url.match(%r{http[s]?://(.*?)/})[1]
47
- else # git@
33
+ elsif url.include?('http') # git@
48
34
  # "git@github.com:org/repo" => github.com
49
35
  url.match(%r{git@(.*?):})[1]
36
+ else # ssh://user@domain.com/path/to/repo
37
+ 'none'
50
38
  end
51
39
  end
52
40
 
53
41
  private
54
- def url_words
55
- url.split('/')
42
+ def org_repo
43
+ OrgRepo.new(url)
56
44
  end
45
+ memoize :org_repo
57
46
  end
58
47
  end
@@ -1,3 +1,3 @@
1
1
  module TerraspaceBundler
2
- VERSION = "0.4.4"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -1,10 +1,12 @@
1
1
  $:.unshift(File.expand_path("../", __FILE__))
2
+ require "active_support"
2
3
  require "active_support/core_ext/class"
3
4
  require "active_support/core_ext/hash"
4
5
  require "active_support/core_ext/string"
5
6
  require "active_support/ordered_options"
6
7
  require "dsl_evaluator"
7
8
  require "fileutils"
9
+ require "json"
8
10
  require "memoist"
9
11
  require "rainbow/ext/string"
10
12
  require "singleton"
@@ -0,0 +1,39 @@
1
+ # Here's an example Terrafile that can be used to qa the different types of sources.
2
+ # Based on: https://terraspace.cloud/docs/terrafile/sources/
3
+ # Note: Actually need to make sure that have access to the sources, IE: s3, gcs, github, etc
4
+ # This is still useful as an example to help with QA.
5
+
6
+ # Use modules from the Terraform registry
7
+ mod "sqs", source: "terraform-aws-modules/sqs/aws"
8
+ mod "s3", source: "git@github.com:boltops-tools/terraform-aws-s3"
9
+ mod "s3test", source: "boltops-tools/terraform-aws-s3"
10
+
11
+ mod "test1", source: "git::https://github.com/boltops-tools/terraform-aws-s3"
12
+ mod "test2", source: "git::ssh://ec2-user@localhost:/home/ec2-user/environment/repo"
13
+ mod "test3", source: "git::ssh://ec2-user@localhost:environment/repo"
14
+ mod "test4", source: "git::ssh://localhost:environment/repo"
15
+ mod "test5", source: "ssh://ec2-user@localhost/home/ec2-user/environment/repo"
16
+ mod "test6", source: "ssh://ec2-user@localhost:/home/ec2-user/environment/repo"
17
+ mod "test7", source: "ssh://ec2-user@localhost:/home/ec2-user/environment/repo//subfolder"
18
+ mod "test8", source: "ssh://ec2-user@localhost:environment/repo"
19
+ mod "test9", source: "ssh://ec2-user@localhost:repo"
20
+
21
+ mod "pet1", source: "tongueroo/pet"
22
+ mod "pet2", source: "https://github.com/tongueroo/pet"
23
+ mod "example1", source: "git@bitbucket.org:tongueroo/example-module.git"
24
+ mod "example2", source: "git@gitlab.com:tongueroo/example-module"
25
+
26
+ org "tongueroo"
27
+ mod "pet3", source: "pet" # inferred org
28
+
29
+ mod "sg", source: "terraform-aws-modules/security-group/aws" # terraform registry public example
30
+ mod "pet4", source: "app.terraform.io/boltops/pet/random" # , clone_with: "https"
31
+
32
+ mod "demo1", source: "s3::https://s3-us-west-2.amazonaws.com/demo-terraform-test/modules/example-module.tgz"
33
+ mod "demo2", source: "s3::https://s3-us-west-2.amazonaws.com/demo-terraform-test/modules/example-module.zip"
34
+ mod "demo3", source: "gcs::https://www.googleapis.com/storage/v1/terraform-example-modules/modules/example-module.zip//subfolder"
35
+ mod "demo4", source: "gcs::https://www.googleapis.com/storage/v1/terraform-example-modules/modules/example-module.tgz//subfolder"
36
+
37
+ mod "local1", source: "/home/ec2-user/environment/downloads/example-module"
38
+ mod "local2", source: "./example-module"
39
+ mod "local3", source: "~/environment/infra-terrafile/example-module"
@@ -0,0 +1,35 @@
1
+ class NotationTest
2
+ include TB::Mod::Concerns::NotationConcern
3
+ end
4
+
5
+ describe NotationTest do
6
+ let(:notation) { described_class.new }
7
+
8
+ context "clean_notation" do
9
+ it "cleans" do
10
+ source = "git::ssh://ec2-user@localhost:/home/ec2-user/environment/repo"
11
+ cleaned = notation.clean_notation(source)
12
+ expect(cleaned).to eq "/home/ec2-user/environment/repo"
13
+
14
+ source = "ssh://ec2-user@localhost:/home/ec2-user/environment/repo"
15
+ cleaned = notation.clean_notation(source)
16
+ expect(cleaned).to eq "/home/ec2-user/environment/repo"
17
+
18
+ source = "ssh://ec2-user@localhost:/home/ec2-user/environment/repo//subfolder"
19
+ cleaned = notation.clean_notation(source)
20
+ expect(cleaned).to eq "/home/ec2-user/environment/repo//subfolder"
21
+
22
+ source = "git::ssh://ec2-user@localhost:environment/repo"
23
+ cleaned = notation.clean_notation(source)
24
+ expect(cleaned).to eq "environment/repo"
25
+
26
+ source = "ssh://ec2-user@localhost:~/environment/repo"
27
+ cleaned = notation.clean_notation(source)
28
+ expect(cleaned).to eq "~/environment/repo"
29
+
30
+ source = "git::ssh://localhost:environment/repo"
31
+ cleaned = notation.clean_notation(source)
32
+ expect(cleaned).to eq "environment/repo"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,45 @@
1
+ describe TB::Mod::OrgRepo do
2
+ let(:org_repo) { described_class.new(url) }
3
+
4
+ context "ssh://ec2-user@localhost/repo" do
5
+ let(:url) { "ssh://ec2-user@localhost/repo" }
6
+ it "org repo" do
7
+ # puts "org_repo.org #{org_repo.org}"
8
+ # puts "org_repo.repo #{org_repo.repo}"
9
+ expect(org_repo.org_folder).to eq "localhost"
10
+ expect(org_repo.repo_folder).to eq "localhost/repo"
11
+ end
12
+ end
13
+
14
+ context "ssh://ec2-user@localhost/long/path/to/repo" do
15
+ let(:url) { "ssh://ec2-user@localhost/long/path/to/repo" }
16
+ it "org repo" do
17
+ expect(org_repo.org_folder).to eq "localhost/long/path/to"
18
+ expect(org_repo.repo_folder).to eq "localhost/long/path/to/repo"
19
+ end
20
+ end
21
+
22
+ context "ec2-user@localhost:long/path/to/repo" do
23
+ let(:url) { "ec2-user@localhost:long/path/to/repo" }
24
+ it "org repo" do
25
+ expect(org_repo.org_folder).to eq "localhost/long/path/to"
26
+ expect(org_repo.repo_folder).to eq "localhost/long/path/to/repo"
27
+ end
28
+ end
29
+
30
+ context "git@github.com:org/repo" do
31
+ let(:url) { "git@github.com:org/repo" }
32
+ it "org repo" do
33
+ expect(org_repo.org_folder).to eq "github.com/org"
34
+ expect(org_repo.repo_folder).to eq "github.com/org/repo"
35
+ end
36
+ end
37
+
38
+ context "https://github.com/org/repo" do
39
+ let(:url) { "https://github.com/org/repo" }
40
+ it "org repo" do
41
+ expect(org_repo.org_folder).to eq "github.com/org"
42
+ expect(org_repo.repo_folder).to eq "github.com/org/repo"
43
+ end
44
+ end
45
+ end
@@ -31,4 +31,134 @@ describe TB::Mod::Props do
31
31
  expect(url).to eq "git@gitlab.com:tongueroo/example-module.git"
32
32
  end
33
33
  end
34
+
35
+ # context terrafile = evaulated Terrafile DSL results in these type of options being passed to Props#build
36
+ context "terrafile" do
37
+ let(:params) do
38
+ {
39
+ :args=>["repo"],
40
+ :options=>{:source=>source},
41
+ :source=>"git::ssh://ec2-user@localhost:/home/ec2-user/environment/repo",
42
+ :name=>"repo",
43
+ :type=>"git",
44
+ :url=>"ssh:",
45
+ :subfolder=>"ec2-user@localhost:/home/ec2-user/environment/repo", :ref=>nil
46
+
47
+ }
48
+ end
49
+ context "git@github.com source" do
50
+ let(:source) { "git@github.com:boltops-tools/terraform-aws-s3" }
51
+ it "properties" do
52
+ result = props.build
53
+ expect(result).to eq(
54
+ {:source=>"git@github.com:boltops-tools/terraform-aws-s3",
55
+ :name=>"repo",
56
+ :type=>"git",
57
+ :url=>"git@github.com:boltops-tools/terraform-aws-s3",
58
+ :subfolder=>nil,
59
+ :ref=>nil}
60
+ )
61
+ expect(props.url).to eq "git@github.com:boltops-tools/terraform-aws-s3"
62
+ expect(props.type).to eq "git"
63
+ expect(props.source).to eq "git@github.com:boltops-tools/terraform-aws-s3"
64
+ end
65
+ end
66
+ context "https://github.com source" do
67
+ let(:source) { "https://github.com/boltops-tools/random_pet" }
68
+ it "properties" do
69
+ expect(props.url).to eq "https://github.com/boltops-tools/random_pet"
70
+ expect(props.type).to eq "git"
71
+ expect(props.source).to eq "https://github.com/boltops-tools/random_pet"
72
+ end
73
+ end
74
+ context "explicit org source" do
75
+ let(:source) { "boltopspro/terraform-aws-elasticache" }
76
+ it "properties" do
77
+ expect(props.url).to eq "https://github.com/boltopspro/terraform-aws-elasticache"
78
+ expect(props.type).to eq "git"
79
+ expect(props.source).to eq "boltopspro/terraform-aws-elasticache"
80
+ end
81
+ end
82
+ context "terraform registry source" do
83
+ let(:source) { "terraform-aws-modules/security-group/aws" }
84
+ it "properties" do
85
+ expect(props.url).to eq "https://github.com/terraform-aws-modules/terraform-aws-security-group"
86
+ expect(props.type).to eq "registry"
87
+ expect(props.source).to eq "terraform-aws-modules/security-group/aws"
88
+ end
89
+ end
90
+ context "ssh with explicit user source" do
91
+ let(:source) { "ssh://user@host:/path/to/repo" }
92
+ it "properties" do
93
+ result = props.build
94
+ expect(result).to eq(
95
+ {:source=>"ssh://user@host:/path/to/repo",
96
+ :name=>"repo",
97
+ :type=>"git",
98
+ :url=>"user@host:/path/to/repo",
99
+ :subfolder=>nil,
100
+ :ref=>nil}
101
+ )
102
+ end
103
+ end
104
+ context "ssh with implied user source" do
105
+ let(:source) { "ssh://host:/path/to/repo" }
106
+ it "properties" do
107
+ result = props.build
108
+ expect(result).to eq(
109
+ {:source=>"ssh://host:/path/to/repo",
110
+ :name=>"repo",
111
+ :type=>"git",
112
+ :url=>"host:/path/to/repo",
113
+ :subfolder=>nil,
114
+ :ref=>nil}
115
+ )
116
+ end
117
+ end
118
+
119
+ context "ssh 2-level folder source" do
120
+ let(:source) { "ssh://ec2-user@localhost:environment/repo" }
121
+ it "properties" do
122
+ result = props.build
123
+ expect(result).to eq(
124
+ {:source=>"ssh://ec2-user@localhost:environment/repo",
125
+ :name=>"repo",
126
+ :type=>"git",
127
+ :url=>"ec2-user@localhost:environment/repo",
128
+ :subfolder=>nil,
129
+ :ref=>nil}
130
+ )
131
+ end
132
+ end
133
+
134
+ context "ssh 1-level folder source" do
135
+ let(:source) { "ssh://ec2-user@localhost:repo" }
136
+ it "properties" do
137
+ result = props.build
138
+ expect(result).to eq(
139
+ {:source=>"ssh://ec2-user@localhost:repo",
140
+ :name=>"repo",
141
+ :type=>"git",
142
+ :url=>"ec2-user@localhost:repo",
143
+ :subfolder=>nil,
144
+ :ref=>nil}
145
+ )
146
+ end
147
+ end
148
+
149
+ context "ssh without colon supports only absolute path source" do
150
+ let(:source) { "ssh://ec2-user@localhost/home/ec2-user/repo" }
151
+ it "properties" do
152
+ result = props.build
153
+ expect(result).to eq(
154
+ {:source=>"ssh://ec2-user@localhost/home/ec2-user/repo",
155
+ :name=>"repo",
156
+ :type=>"git",
157
+ :url=>"ssh://ec2-user@localhost/home/ec2-user/repo",
158
+ :subfolder=>nil,
159
+ :ref=>nil}
160
+ )
161
+ end
162
+ end
163
+ end
34
164
  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.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-27 00:00:00.000000000 Z
11
+ date: 2022-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -263,6 +263,7 @@ files:
263
263
  - lib/terraspace_bundler/mod/fetcher/s3.rb
264
264
  - lib/terraspace_bundler/mod/http/concern.rb
265
265
  - lib/terraspace_bundler/mod/http/source.rb
266
+ - lib/terraspace_bundler/mod/org_repo.rb
266
267
  - lib/terraspace_bundler/mod/props.rb
267
268
  - lib/terraspace_bundler/mod/props/extension.rb
268
269
  - lib/terraspace_bundler/mod/props/typer.rb
@@ -274,6 +275,7 @@ files:
274
275
  - lib/terraspace_bundler/util/logging.rb
275
276
  - lib/terraspace_bundler/util/sure.rb
276
277
  - lib/terraspace_bundler/version.rb
278
+ - readme/qa/Terrafile
277
279
  - spec/fixtures/Terrafile
278
280
  - spec/fixtures/rewrite/example-subfolder.tf
279
281
  - spec/fixtures/rewrite/module-subfolder.tf
@@ -286,6 +288,8 @@ files:
286
288
  - spec/fixtures/terrafiles/example/Terrafile
287
289
  - spec/spec_helper.rb
288
290
  - spec/terraform_bundler/exporter/stacks/rewrite_spec.rb
291
+ - spec/terraform_bundler/mod/concerns/notation_concern_spec.rb
292
+ - spec/terraform_bundler/mod/org_repo_spec.rb
289
293
  - spec/terraform_bundler/mod/props_spec.rb
290
294
  - spec/terraform_bundler/mod_spec.rb
291
295
  - spec/terraform_bundler/runner_spec.rb
@@ -326,6 +330,8 @@ test_files:
326
330
  - spec/fixtures/terrafiles/example/Terrafile
327
331
  - spec/spec_helper.rb
328
332
  - spec/terraform_bundler/exporter/stacks/rewrite_spec.rb
333
+ - spec/terraform_bundler/mod/concerns/notation_concern_spec.rb
334
+ - spec/terraform_bundler/mod/org_repo_spec.rb
329
335
  - spec/terraform_bundler/mod/props_spec.rb
330
336
  - spec/terraform_bundler/mod_spec.rb
331
337
  - spec/terraform_bundler/runner_spec.rb