cloudspin-stack-rake 0.1.17 → 0.1.18

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: c743a9b518a96958cd198915e9ef83bb59efdfc91fc6d8ad5df56ba4d8f83fbf
4
- data.tar.gz: 4098215b277c4df095d433b7168700e575700a0cb745a4839f35b95d5ee2a350
3
+ metadata.gz: 8fd7e71574a680bb058b48cbae71eed41acc118d68eb964e6fd60701f19773f6
4
+ data.tar.gz: 9f76039b22270373ffb3fc2bc9efd73a89a0a9bb5171b271dc94d23cc550c2bc
5
5
  SHA512:
6
- metadata.gz: 3f526ed2df69623a827710de015fbd3b4dfb954199a5fb4f2deeb47a30884eec6545bf01902f7029179cb11f31765f26fc905fff5e2a856b4497f1588ec5f5de
7
- data.tar.gz: bc4945d21bb7ff5330fee853117a35c21f9930a771fb891c56e935e6698fb5b431e9ef12cb004f56fece373a1fb8f910d36e83896b8d8a5062bb3941be3bd3fc
6
+ metadata.gz: a598546bfd6b2105fa0a64c5c5e7af0938dc4c603f8e1947fe59617dd7436c392dffa6260feafe8661cf7a1d279691a39da7b9f993674076429b2f45b9dd21c1
7
+ data.tar.gz: 83f9e0413f3223f139867b7e4d3c5221dce2e6b0dcf68f06a8b12c9c0b6ee101d2cab6fd8b8f6a0fffb0c98dc42e79a6ebbbd058637fe311c99efe4537effaf0
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.3
data/.travis.yml CHANGED
@@ -1,5 +1,12 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.3
5
- before_install: gem install bundler -v 1.16.2
4
+ - 2.5.1
5
+ before_install:
6
+ - curl -sLo /tmp/terraform.zip https://releases.hashicorp.com/terraform/0.11.10/terraform_0.11.10_linux_amd64.zip
7
+ - unzip /tmp/terraform.zip -d /tmp
8
+ - mkdir -p ~/bin
9
+ - mv /tmp/terraform ~/bin
10
+ - chmod 0755 ~/bin/terraform
11
+ - export PATH="~/bin:$PATH"
12
+ - gem install bundler -v 1.17.1
@@ -21,7 +21,7 @@ module Cloudspin
21
21
  @environment = environment
22
22
  @stack_name = stack_name
23
23
  @base_folder = base_folder
24
- @configuration_files = configuration_files || the_usual_configuration_files
24
+ set_configuration_files(configuration_files)
25
25
 
26
26
  # TODO: Pick this up from the configuration files?
27
27
  @definition_location = if definition_location
@@ -37,51 +37,8 @@ module Cloudspin
37
37
  define
38
38
  end
39
39
 
40
- def instance
41
- @instance ||= begin
42
- local_definition_folder = fetch_definition
43
- puts "Will use local stack definition files in #{local_definition_folder}"
44
-
45
- the_instance = Cloudspin::Stack::Instance.from_folder(
46
- @configuration_files,
47
- stack_name: stack_name,
48
- definition_folder: local_definition_folder,
49
- base_folder: @base_folder,
50
- base_working_folder: "#{@base_folder}/work"
51
- )
52
-
53
- if the_instance.configuration.has_remote_state_configuration?
54
- add_terraform_backend_source(local_definition_folder)
55
- end
56
-
57
- the_instance
58
- end
59
- end
60
-
61
- def fetch_definition
62
- if /^http.*\.zip$/.match @definition_location
63
- puts "Downloading stack definition source from a remote zipfile"
64
- fetch_definition_zipfile
65
- elsif /^[\.\/]/.match @definition_location
66
- puts "Using local stack definition source"
67
- @definition_location
68
- else
69
- raise UnsupportedStackDefinitionLocationError, @definition_location
70
- end
71
- end
72
-
73
- def add_terraform_backend_source(terraform_source_folder)
74
-
75
- puts "Creating file #{terraform_source_folder}/_cloudspin_created_backend.tf"
76
-
77
- File.open("#{terraform_source_folder}/_cloudspin_created_backend.tf", 'w') { |backend_file|
78
- backend_file.write(<<~TF_BACKEND_SOURCE
79
- terraform {
80
- backend "s3" {}
81
- }
82
- TF_BACKEND_SOURCE
83
- )
84
- }
40
+ def set_configuration_files(additional_configuration_files)
41
+ @configuration_files = (the_usual_configuration_files << additional_configuration_files).flatten.compact
85
42
  end
86
43
 
87
44
  def the_usual_configuration_files
@@ -98,8 +55,8 @@ module Cloudspin
98
55
 
99
56
  def default_configuration_files
100
57
  [
101
- "#{@base_folder}/stack-#{@stack_name}-defaults.yaml",
102
- "#{@base_folder}/stack-#{@stack_name}-local.yaml"
58
+ "#{@base_folder}/stack-instance-defaults.yaml",
59
+ "#{@base_folder}/stack-instance-local.yaml"
103
60
  ]
104
61
  end
105
62
 
@@ -145,8 +102,53 @@ module Cloudspin
145
102
  end
146
103
  end
147
104
 
105
+ def instance
106
+ @instance ||= begin
107
+ local_definition_folder = fetch_definition
108
+ puts "Will use local stack definition files in #{local_definition_folder}"
109
+
110
+ the_instance = Cloudspin::Stack::Instance.from_folder(
111
+ @configuration_files,
112
+ stack_name: stack_name,
113
+ definition_folder: local_definition_folder,
114
+ base_folder: @base_folder,
115
+ base_working_folder: "#{@base_folder}/work"
116
+ )
117
+
118
+ if the_instance.configuration.has_remote_state_configuration?
119
+ add_terraform_backend_source(local_definition_folder)
120
+ end
121
+
122
+ the_instance
123
+ end
124
+ end
125
+
126
+ def add_terraform_backend_source(terraform_source_folder)
127
+ puts "Creating file #{terraform_source_folder}/_cloudspin_created_backend.tf"
128
+ File.open("#{terraform_source_folder}/_cloudspin_created_backend.tf", 'w') { |backend_file|
129
+ backend_file.write(<<~TF_BACKEND_SOURCE
130
+ terraform {
131
+ backend "s3" {}
132
+ }
133
+ TF_BACKEND_SOURCE
134
+ )
135
+ }
136
+ end
137
+
148
138
  # TODO: This stuff belongs in a core class, so the CLI and other stuff can use it, too.
149
139
 
140
+ def fetch_definition
141
+ if /^http.*\.zip$/.match @definition_location
142
+ puts "Downloading stack definition source from a remote zipfile"
143
+ fetch_definition_zipfile
144
+ elsif /^[\.\/]/.match @definition_location
145
+ puts "Using local stack definition source"
146
+ @definition_location
147
+ else
148
+ raise UnsupportedStackDefinitionLocationError, @definition_location
149
+ end
150
+ end
151
+
150
152
  def fetch_definition_zipfile
151
153
  unpack(download_artefact(@definition_location), '.cloudspin/definitions')
152
154
  end
@@ -1,7 +1,7 @@
1
1
  module Cloudspin
2
2
  module Stack
3
3
  module Rake
4
- VERSION = '0.1.17'
4
+ VERSION = '0.1.18'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudspin-stack-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'kief '
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-05 00:00:00.000000000 Z
11
+ date: 2018-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cloudspin-stack
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
+ - ".ruby-version"
78
79
  - ".travis.yml"
79
80
  - CODE_OF_CONDUCT.md
80
81
  - Gemfile