hecks 0.1.2 → 0.1.4.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hecks.rb +1 -1
- data/lib/packager/generate_binary_package.rb +10 -51
- data/lib/packager/templates/binary_package/build/resources/%domain_name%.rb.tt +2 -6
- data/lib/packager/templates/binary_package/build/resources/Dockerfile.tt +3 -9
- data/lib/packager/templates/{Gemfile.tt → binary_package/build/resources/Gemfile.tt} +1 -1
- metadata +45 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f3e26b92e6604c7d83338096afc2385b0063497
|
4
|
+
data.tar.gz: 5e0af5d947346bd07c97d6fce0cfac3078ae7810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e09d624063a237ab5e6fdac8bdb2bfc583c4ae41c4c4e7b1007328aecb065c6cd24c688df64a49e5d7d74e9180e9a2e6c86352544d5b6ee1bd0e3100ff52a6b
|
7
|
+
data.tar.gz: af802c0612cb31f41ebeb3c9fb44296adea5048e8281b789596f358f1cc2c5ea09d8e7e5bca35449e9dc9796d07680f5c48ce0642a8dddfafd598f77294c63f1
|
data/lib/hecks.rb
CHANGED
@@ -4,18 +4,12 @@ module Hecks
|
|
4
4
|
class GenerateBinaryPackage < Thor::Group
|
5
5
|
include Thor::Actions
|
6
6
|
|
7
|
-
class_option :
|
8
|
-
class_option :download, aliases: '-d', desc: 'download', default: true, type: :boolean
|
9
|
-
class_option :reduce_package_size, aliases: '-r', desc: 'delete unneeded cruft in gems', default: true, type: :boolean
|
10
|
-
class_option :latest, aliases: '-l', desc: 'Use the latest gem', default: true, type: :boolean
|
7
|
+
class_option :no_cache, aliases: '-n', desc: 'download resources', default: false, type: :boolean
|
11
8
|
|
12
9
|
HOST = "http://d6r77u77i8pq3.cloudfront.net/releases"
|
13
10
|
OSX_BINARY = "traveling-ruby-20150715-2.2.2-osx.tar.gz"
|
14
11
|
LINUX_BINARY = 'traveling-ruby-20150715-2.2.2-linux-x86_64.tar.gz'
|
15
|
-
GEM_FOLDER = 'traveling-ruby-gems-20150715-2.2.2-osx'
|
16
|
-
MYSQL_GEM = 'mysql2-0.3.18.tar.gz'
|
17
12
|
BUILD_DIR = 'packages/binary/build'
|
18
|
-
GEM_SERVER = 'http://0.0.0.0:8808'
|
19
13
|
RESOURCES_DIR = BUILD_DIR + '/resources'
|
20
14
|
OSX_DIR = BUILD_DIR + '/osx'
|
21
15
|
OSX_LIB_DIR = OSX_DIR + '/lib'
|
@@ -23,13 +17,6 @@ module Hecks
|
|
23
17
|
LINUX_DIR = BUILD_DIR + '/linux-x86_64'
|
24
18
|
LINUX_LIB_DIR = LINUX_DIR + 'lib'
|
25
19
|
LINUX_APP_DIR = LINUX_LIB_DIR + '/app'
|
26
|
-
HECKS_GEMS = %w(
|
27
|
-
hecks-application
|
28
|
-
hecks-adapters
|
29
|
-
hecks-adapters-sql-database
|
30
|
-
hecks-adapters-resource-server
|
31
|
-
hecks-domain
|
32
|
-
)
|
33
20
|
|
34
21
|
def self.source_root
|
35
22
|
File.dirname(__FILE__) + '/templates'
|
@@ -45,7 +32,7 @@ module Hecks
|
|
45
32
|
|
46
33
|
def build
|
47
34
|
package(OSX_APP_DIR, OSX_LIB_DIR, OSX_BINARY, OSX_DIR)
|
48
|
-
|
35
|
+
package(LINUX_APP_DIR, LINUX_LIB_DIR, LINUX_BINARY, LINUX_DIR)
|
49
36
|
end
|
50
37
|
|
51
38
|
private
|
@@ -53,26 +40,11 @@ module Hecks
|
|
53
40
|
def package(app_dir, lib_dir, binary, package_dir)
|
54
41
|
empty_directory(app_dir)
|
55
42
|
empty_directory(lib_dir + '/ruby')
|
56
|
-
|
57
|
-
|
58
|
-
download_gem(MYSQL_GEM, RESOURCES_DIR) if options[:download]
|
59
|
-
end
|
43
|
+
return unless refresh_cache?(app_dir)
|
44
|
+
# download(binary, lib_dir)
|
60
45
|
copy_resources(app_dir, package_dir)
|
61
46
|
bundle_with_ruby_2_2_2(app_dir)
|
62
|
-
|
63
|
-
unpack_gem(MYSQL_GEM, OSX_APP_DIR)
|
64
|
-
reduce_package_size(app_dir) if options[:reduce_package_size]
|
65
|
-
end
|
66
|
-
|
67
|
-
def unpack_gem(ruby_gem, lib_dir)
|
68
|
-
run("tar -xzf #{RESOURCES_DIR}/#{ruby_gem} -C #{OSX_APP_DIR}/vendor/ruby")
|
69
|
-
end
|
70
|
-
|
71
|
-
def remove_native_extensions
|
72
|
-
run("rm -rf #{OSX_APP_DIR}/vendor/ruby/*/extensions")
|
73
|
-
run("find #{OSX_APP_DIR}/vendor/ruby/*/gems -name '*.so' | xargs rm -f")
|
74
|
-
run("find #{OSX_APP_DIR}/vendor/ruby/*/gems -name '*.bundle' | xargs rm -f")
|
75
|
-
run("find #{OSX_APP_DIR}/vendor/ruby/*/gems -name '*.o' | xargs rm -f")
|
47
|
+
reduce_package_size(app_dir)
|
76
48
|
end
|
77
49
|
|
78
50
|
def refresh_cache?(app_dir)
|
@@ -81,44 +53,31 @@ module Hecks
|
|
81
53
|
end
|
82
54
|
|
83
55
|
def copy_resources(app_dir, package_dir)
|
84
|
-
|
85
|
-
run("cp -rf #{RESOURCES_DIR}/Gemfile #{app_dir}/Gemfile")
|
56
|
+
run("cp #{RESOURCES_DIR}/Gemfile #{app_dir}")
|
86
57
|
run("cp -rf #{RESOURCES_DIR}/bundle #{app_dir}/.bundle")
|
87
58
|
run("cp -rf #{RESOURCES_DIR}/#{domain_name}.rb #{app_dir}/#{domain_name}.rb")
|
88
59
|
run("cp -rf #{RESOURCES_DIR}/wrapper #{package_dir}/#{domain_name}")
|
89
60
|
run("cd #{package_dir} && chmod 744 #{domain_name}")
|
90
61
|
end
|
91
62
|
|
92
|
-
def
|
63
|
+
def download(binary, lib_dir)
|
93
64
|
run("cd #{RESOURCES_DIR} && curl -O #{HOST}/#{binary}")
|
94
65
|
run("tar -xzf #{RESOURCES_DIR}/#{binary} -C #{lib_dir}/ruby")
|
95
66
|
end
|
96
67
|
|
97
|
-
def download_gem(ruby_gem, lib_dir)
|
98
|
-
run("cd #{RESOURCES_DIR} && curl -O #{HOST}/#{GEM_FOLDER}/#{ruby_gem}")
|
99
|
-
end
|
100
|
-
|
101
68
|
def bundle_with_ruby_2_2_2(app_dir)
|
102
69
|
run("cp -rf #{RESOURCES_DIR}/Dockerfile #{app_dir}")
|
103
70
|
run("cp #{domain_name}-0.0.0.gem #{app_dir}")
|
104
|
-
|
71
|
+
run("cd #{app_dir} && gem fetch hecks-application hecks-adapters-sql-database")
|
105
72
|
run("cd #{app_dir} && docker build -t #{domain_name} --no-cache .")
|
106
73
|
container = `docker create pizza_builder:latest`.gsub("\n", '')
|
107
74
|
run("docker cp #{container}:/usr/src/app/vendor #{app_dir}")
|
108
75
|
end
|
109
76
|
|
110
|
-
def fetch_gems(app_dir)
|
111
|
-
return unless options[:latest]
|
112
|
-
|
113
|
-
HECKS_GEMS.each do |name|
|
114
|
-
run("cd #{app_dir} && gem fetch #{name} -s #{GEM_SERVER}")
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
77
|
def reduce_package_size(app_dir)
|
119
78
|
files = %w(test tests spec features benchmark README* CHANGE* Change*
|
120
|
-
COPYING* LICENSE* MIT-LICENSE* TODO *.txt *.md *.rdoc doc docs
|
121
|
-
|
79
|
+
COPYING* LICENSE* MIT-LICENSE* TODO *.txt *.md *.rdoc doc docs example
|
80
|
+
examples sample doc-api)
|
122
81
|
|
123
82
|
files.each do |file|
|
124
83
|
run("rm -rf #{app_dir}/vendor/ruby/*/gems/*/#{file}")
|
@@ -1,11 +1,7 @@
|
|
1
|
-
require 'hecks
|
2
|
-
require 'hecks-adapters'
|
1
|
+
require 'hecks'
|
3
2
|
require '<%= domain_name %>'
|
4
3
|
|
5
|
-
app = Hecks::Application.new(
|
6
|
-
domain: <%= domain_name.camelcase %>,
|
7
|
-
database: Hecks::Adapters::SQLDatabase
|
8
|
-
)
|
4
|
+
app = Hecks::Application.new(domain: <%= domain_name.camelcase %>)
|
9
5
|
|
10
6
|
# Ruby 2.2.2 doesn't support Fixnum#positive?, so monkey patch it.
|
11
7
|
class Fixnum
|
@@ -1,14 +1,8 @@
|
|
1
1
|
FROM ruby:2.2
|
2
2
|
|
3
|
-
COPY
|
4
|
-
|
5
|
-
RUN cd /usr/src/app/ && gem install hecks-adapters -v <%= Hecks.version %>
|
6
|
-
RUN cd /usr/src/app/ && gem install hecks-adapters-resource-server -v <%= Hecks.version %>
|
7
|
-
RUN cd /usr/src/app/ && gem install hecks-adapters-sql-database -v <%= Hecks.version %>
|
8
|
-
RUN cd /usr/src/app/ && gem install hecks-adapters-resource-server -v <%= Hecks.version %>
|
9
|
-
RUN cd /usr/src/app/ && gem install hecks-domain -v <%= Hecks.version %>
|
10
|
-
RUN cd /usr/src/app/ && gem install <%= domain_name %>
|
11
|
-
|
3
|
+
COPY <%= domain_name %>-0.0.0.gem /usr/src/app/<%= domain_name %>-0.0.0.gem
|
4
|
+
RUN gem install /usr/src/app/<%= domain_name %>-0.0.0.gem
|
12
5
|
COPY Gemfile /usr/src/app/Gemfile
|
13
6
|
RUN cd /usr/src/app/ && bundle package
|
14
7
|
RUN cd /usr/src/app/ && bundle install --path vendor
|
8
|
+
RUN ls /usr/src/app/
|
metadata
CHANGED
@@ -1,57 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hecks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4.rc
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Young
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hecks-application
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hecks-domain
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hecks-adapters
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
61
|
+
version: '5.0'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.19'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.19'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: codeclimate-test-reporter
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,10 +173,10 @@ files:
|
|
145
173
|
- lib/packager.rb
|
146
174
|
- lib/packager/generate_binary_package.rb
|
147
175
|
- lib/packager/generate_lambda_package.rb
|
148
|
-
- lib/packager/templates/Gemfile.tt
|
149
176
|
- lib/packager/templates/binary_package/build/linux-x86_64/lib/app/hello.rb
|
150
177
|
- lib/packager/templates/binary_package/build/resources/%domain_name%.rb.tt
|
151
178
|
- lib/packager/templates/binary_package/build/resources/Dockerfile.tt
|
179
|
+
- lib/packager/templates/binary_package/build/resources/Gemfile.tt
|
152
180
|
- lib/packager/templates/binary_package/build/resources/bundle/config
|
153
181
|
- lib/packager/templates/binary_package/build/resources/wrapper.tt
|
154
182
|
- lib/packager/templates/lambda_package/handler.js.tt
|
@@ -168,9 +196,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
196
|
version: '0'
|
169
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
198
|
requirements:
|
171
|
-
- - "
|
199
|
+
- - ">"
|
172
200
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
201
|
+
version: 1.3.1
|
174
202
|
requirements: []
|
175
203
|
rubyforge_project:
|
176
204
|
rubygems_version: 2.6.10
|