app_builder 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/app_builder/environment.rb +22 -11
- data/lib/app_builder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3173253884ec857d662944d0647e1861ad3d51e279771d53e6c8abb429756aae
|
4
|
+
data.tar.gz: 1f1bac980c6215572dbf16a66bed9c15bd8d98b5a5d794188dcbf69e6aaaecc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ceb59f49f272eff890091fb17da7593d13cd53846ccdfda858912aabe27bac3d95535ae3b2b2200eca9c8ef072bdba455ba553037e66a8d23edaf0ec1efd431
|
7
|
+
data.tar.gz: 3c94d733b78b32227e456254b01451ae59db4651c68f09f963cf279af77ef504a278a9dd7781924ee36733ca0826d0b2cb4ae80f9cc835640a867c53739d7db3
|
@@ -3,11 +3,12 @@ module AppBuilder
|
|
3
3
|
attr_accessor :name
|
4
4
|
attr_reader :repo_path, :branch, :source_path
|
5
5
|
|
6
|
-
def initialize(source_path,
|
7
|
-
@name = name || ENV.fetch("APP_ENV", "default")
|
8
|
-
@repo_path = repo_path || `git rev-parse --show-toplevel`.chomp
|
9
|
-
@branch = branch || ENV.fetch("TARGET_BRANCH", `git symbolic-ref --short HEAD`.chomp)
|
6
|
+
def initialize(source_path, options = {})
|
7
|
+
@name = options[:name] || ENV.fetch("APP_ENV", "default")
|
8
|
+
@repo_path = options[:repo_path] || `git rev-parse --show-toplevel`.chomp
|
9
|
+
@branch = options[:branch] || ENV.fetch("TARGET_BRANCH", `git symbolic-ref --short HEAD`.chomp)
|
10
10
|
@source_path = source_path
|
11
|
+
@from_branch = options.fetch(:from_branch, true)
|
11
12
|
end
|
12
13
|
|
13
14
|
def create_file(template_path, output_path)
|
@@ -33,13 +34,23 @@ module AppBuilder
|
|
33
34
|
alias :hash :to_hash
|
34
35
|
|
35
36
|
def source
|
36
|
-
@source ||=
|
37
|
-
ERB.new(
|
38
|
-
Dir.chdir(repo_path) {
|
39
|
-
`git show #{branch}:#{source_path}`
|
40
|
-
}
|
41
|
-
).result(binding)
|
42
|
-
)
|
37
|
+
@source ||= load_source
|
43
38
|
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def load_source
|
43
|
+
if from_branch
|
44
|
+
YAML.load(
|
45
|
+
ERB.new(
|
46
|
+
Dir.chdir(repo_path) {
|
47
|
+
`git show #{branch}:#{source_path}`
|
48
|
+
}
|
49
|
+
).result(binding)
|
50
|
+
)
|
51
|
+
else
|
52
|
+
YAML.load_file(source_path)
|
53
|
+
end
|
54
|
+
end
|
44
55
|
end
|
45
56
|
end
|
data/lib/app_builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- i2bskn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|