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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0cda82ca1043fd288c27ea1ba7d407dbfcc9a73e48b7f05611b166891e45220
4
- data.tar.gz: 78db32348bee99238d155d6ba9107b2b6c10f704fb0a6e5aaef5ffc763b9a976
3
+ metadata.gz: 3173253884ec857d662944d0647e1861ad3d51e279771d53e6c8abb429756aae
4
+ data.tar.gz: 1f1bac980c6215572dbf16a66bed9c15bd8d98b5a5d794188dcbf69e6aaaecc9
5
5
  SHA512:
6
- metadata.gz: a109c1cb7480cd771539e2d15310ba767b04ea3a77624394a8a58f80bc787de3d44bc3a231c648943afa5244cd00dc229233eab286bcb290261f566e9520aa22
7
- data.tar.gz: 742cb157bd79786924cd16d9e52cc2ee39cc1e234631997461fd9b83cdf7dda3df11c80ab67b7a0b4fc4eb73d671810a0c9ca63f7493e75347152d15c77df935
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, name: nil, repo_path: nil, branch: nil)
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 ||= YAML.load(
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
@@ -1,3 +1,3 @@
1
1
  module AppBuilder
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
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
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-20 00:00:00.000000000 Z
11
+ date: 2018-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh