app_builder 0.2.7 → 0.2.9

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: 6f2c3eb1f29506c9d100320779e17513e7c32661209c48f849a31f5cba48bfb3
4
- data.tar.gz: 68d348db9295814fcb9b351e7e36f97891ff7e501701d5dc661ace572e2e311c
3
+ metadata.gz: 17548e7a9045b333ec79ef1e8f0abeb616d6c6ace73d3a306516f140906a4df3
4
+ data.tar.gz: 19890dc60cbc42ea8b2656a8e8889c91642e59818ed4a761b26bebfef6dafb82
5
5
  SHA512:
6
- metadata.gz: 3d170c4d5b76988d117e46bce7f40ed5fc56a97cef5732a66c4960ebf5841bcf2e538e2b1245568ebd80b5d08a4a1f600fc3c25614ed2309919728d4c5d4dc58
7
- data.tar.gz: bb8066f6826e2618c7ad5453a398b74c96e7f76a9ca3994775eb89b30d1bd77d6b2ddade6264e796aea35278d6353a201b59dccf3bceaae83d773613116c80e9
6
+ metadata.gz: 3b1ad7ed2325454f51eb6f1cfa7277f79469bfa01a67475fb7f92cc173abd8940a462f7648a52e739f5ba4b472371f4312f911dbb959368fa86c336bbad30775
7
+ data.tar.gz: af54e1427a7e8c15c56901d78702c79b25403ba5d106cb4e95b3cb71233141135e506f098cd94a1be9f19d7bf70cb395711a2b4af3552978e8d7e9e2ff77984d
data/lib/app_builder.rb CHANGED
@@ -17,4 +17,3 @@ require "app_builder/base"
17
17
  require "app_builder/archiver"
18
18
  require "app_builder/builder"
19
19
  require "app_builder/uploader"
20
- require "app_builder/environment.rb"
@@ -43,7 +43,7 @@ module AppBuilder
43
43
  if local?
44
44
  if erb
45
45
  log(:info, "Create #{dest_path} from #{src_path}")
46
- File.open(dest_path, "w") { |f| f.write(ERB.new(File.read(src_path)).result) }
46
+ File.open(dest_path, "w") { |f| f.write(ERB.new(File.read(src_path), nil, "-").result) }
47
47
  else
48
48
  execute("cp #{src_path} #{dest_path}")
49
49
  end
@@ -53,7 +53,7 @@ module AppBuilder
53
53
  if erb
54
54
  begin
55
55
  f = Tempfile.open(File.basename(dest_path))
56
- f.write(ERB.new(File.read(src_path)).result)
56
+ f.write(ERB.new(File.read(src_path), nil, "-").result)
57
57
  f.close
58
58
  ssh.scp.upload!(f.path, dest_path)
59
59
  rescue
@@ -47,7 +47,7 @@ module AppBuilder
47
47
 
48
48
  def generate_manifest
49
49
  checksum = `openssl sha256 #{builded_src_path} | awk -F"=" '{ print $2 }'`.strip
50
- manifest = ERB.new(File.read(manifest_template_path)).result(binding)
50
+ manifest = ERB.new(File.read(manifest_template_path), nil, "-").result(binding)
51
51
  File.open(builded_manifest_path, "w") { |f| f.write(manifest) }
52
52
  end
53
53
 
@@ -1,3 +1,3 @@
1
1
  module AppBuilder
2
- VERSION = "0.2.7".freeze
2
+ VERSION = "0.2.9".freeze
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.7
4
+ version: 0.2.9
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-30 00:00:00.000000000 Z
11
+ date: 2018-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -129,7 +129,6 @@ files:
129
129
  - lib/app_builder/base.rb
130
130
  - lib/app_builder/builder.rb
131
131
  - lib/app_builder/config.rb
132
- - lib/app_builder/environment.rb
133
132
  - lib/app_builder/logger.rb
134
133
  - lib/app_builder/server.rb
135
134
  - lib/app_builder/template/manifest.yml.erb
@@ -1,58 +0,0 @@
1
- module AppBuilder
2
- class Environment
3
- attr_accessor :name
4
- attr_reader :repo_path, :branch, :source_path, :source_type
5
-
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
- @source_path = source_path
11
- @source_type = options.fetch(:source_type, :git) # :git (git show branch:path) or :path (File.read(path))
12
- end
13
-
14
- def create_file(template_path, output_path)
15
- File.open(output_path, "w") do |f|
16
- f.write(ERB.new(File.read(template_path)).result(binding))
17
- end
18
- end
19
-
20
- def [](key)
21
- hash.fetch(key.to_s, nil)
22
- end
23
-
24
- def to_hash
25
- raw_source.fetch(name.to_s)
26
- end
27
- alias :hash :to_hash
28
-
29
- def raw_source
30
- @source ||= load_source
31
- end
32
-
33
- private
34
-
35
- def load_source
36
- case source_type
37
- when :git
38
- raw_src = Dir.chdir(repo_path) { `git show #{branch}:#{source_path}` }
39
- when :path
40
- raw_src = File.read(source_path)
41
- else
42
- raise "Unknown source_type: #{source_type}"
43
- end
44
-
45
- YAML.load(ERB.new(raw_src).result(binding))
46
- end
47
-
48
- def method_missing(name, *args, &block)
49
- super unless hash.has_key?(name.to_s)
50
-
51
- hash.fetch(name.to_s)
52
- end
53
-
54
- def respond_to_missing?(name, include_private = false)
55
- hash.has_key?(name.to_s)
56
- end
57
- end
58
- end