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 +4 -4
- data/lib/app_builder.rb +0 -1
- data/lib/app_builder/server.rb +2 -2
- data/lib/app_builder/uploader.rb +1 -1
- data/lib/app_builder/version.rb +1 -1
- metadata +2 -3
- data/lib/app_builder/environment.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17548e7a9045b333ec79ef1e8f0abeb616d6c6ace73d3a306516f140906a4df3
|
4
|
+
data.tar.gz: 19890dc60cbc42ea8b2656a8e8889c91642e59818ed4a761b26bebfef6dafb82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b1ad7ed2325454f51eb6f1cfa7277f79469bfa01a67475fb7f92cc173abd8940a462f7648a52e739f5ba4b472371f4312f911dbb959368fa86c336bbad30775
|
7
|
+
data.tar.gz: af54e1427a7e8c15c56901d78702c79b25403ba5d106cb4e95b3cb71233141135e506f098cd94a1be9f19d7bf70cb395711a2b4af3552978e8d7e9e2ff77984d
|
data/lib/app_builder.rb
CHANGED
data/lib/app_builder/server.rb
CHANGED
@@ -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
|
data/lib/app_builder/uploader.rb
CHANGED
@@ -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
|
|
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.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-
|
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
|