hecks 0.0.8 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/hecks +1 -0
- data/lib/cli.rb +28 -0
- data/lib/cli/build.rb +13 -0
- data/lib/cli/{commands/console.rb → console.rb} +0 -0
- data/lib/cli/generate.rb +35 -0
- data/lib/cli/{commands/package.rb → package.rb} +2 -5
- data/lib/cli/test.rb +56 -0
- data/lib/{console/console.rb → console.rb} +1 -2
- data/lib/console/commands.rb +1 -1
- data/lib/hecks.rb +6 -6
- data/lib/packager.rb +2 -0
- data/lib/packager/generate_binary_package.rb +146 -0
- data/lib/packager/generate_lambda_package.rb +26 -0
- data/lib/{cli/commands/generate/templates/binary_package/build/resources → packager/templates}/Gemfile.tt +1 -1
- data/lib/{cli/commands/generate → packager}/templates/binary_package/build/linux-x86_64/lib/app/hello.rb +0 -0
- data/lib/{cli/commands/generate → packager}/templates/binary_package/build/resources/%domain_name%.rb.tt +6 -2
- data/lib/packager/templates/binary_package/build/resources/Dockerfile.tt +14 -0
- data/lib/{cli/commands/generate → packager}/templates/binary_package/build/resources/bundle/config +0 -0
- data/lib/{cli/commands/generate → packager}/templates/binary_package/build/resources/wrapper.tt +0 -0
- data/lib/{cli/commands/generate → packager}/templates/lambda_package/handler.js.tt +0 -0
- data/lib/{cli/commands/generate → packager}/templates/lambda_package/serverless.yml.tt +0 -0
- metadata +45 -94
- data/lib/adapters/adapters.rb +0 -6
- data/lib/adapters/events/events.rb +0 -27
- data/lib/adapters/logger/logger.rb +0 -18
- data/lib/adapters/memory_database/memory_database.rb +0 -18
- data/lib/adapters/resource_server/methods.rb +0 -22
- data/lib/adapters/resource_server/methods/create.rb +0 -49
- data/lib/adapters/resource_server/methods/delete.rb +0 -45
- data/lib/adapters/resource_server/methods/read.rb +0 -44
- data/lib/adapters/resource_server/methods/update.rb +0 -50
- data/lib/adapters/resource_server/resource_server.rb +0 -52
- data/lib/adapters/validator/validator.rb +0 -33
- data/lib/application/application.rb +0 -45
- data/lib/application/commands/commands.rb +0 -5
- data/lib/application/commands/create.rb +0 -52
- data/lib/application/commands/crud_handler.rb +0 -40
- data/lib/application/commands/delete.rb +0 -40
- data/lib/application/commands/runner.rb +0 -48
- data/lib/application/commands/update.rb +0 -41
- data/lib/application/queries/find_by_id.rb +0 -19
- data/lib/application/queries/queries.rb +0 -2
- data/lib/application/queries/query_runner.rb +0 -28
- data/lib/cli/cli.rb +0 -24
- data/lib/cli/commands.rb +0 -5
- data/lib/cli/commands/build.rb +0 -10
- data/lib/cli/commands/generate.rb +0 -26
- data/lib/cli/commands/generate/builder.rb +0 -60
- data/lib/cli/commands/generate/builder/aggregate_command_line_builder.rb +0 -18
- data/lib/cli/commands/generate/builder/reference_command_line_builder.rb +0 -19
- data/lib/cli/commands/generate/builder/value_object_command_line_builder.rb +0 -19
- data/lib/cli/commands/generate/generate_aws_package.rb +0 -17
- data/lib/cli/commands/generate/generate_binary_package.rb +0 -92
- data/lib/cli/commands/generate/generate_domain_object.rb +0 -71
- data/lib/cli/commands/generate/generate_domain_object/assignment_template.rb +0 -36
- data/lib/cli/commands/generate/generate_domain_object/option_formatter.rb +0 -30
- data/lib/cli/commands/generate/generate_lambda_package.rb +0 -20
- data/lib/cli/commands/generate/generate_resource_server.rb +0 -17
- data/lib/cli/commands/generate/new.rb +0 -47
- data/lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/%head_name%.rb.tt +0 -16
- data/lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/%name%.rb.tt +0 -9
- data/lib/cli/commands/generate/templates/aggregate/lib/domain/%name%/repository.rb.tt +0 -40
- data/lib/cli/commands/generate/templates/binary_package/build/resources/Dockerfile.tt +0 -8
- data/lib/cli/commands/generate/templates/domain/%name%.gemspec.tt +0 -12
- data/lib/cli/commands/generate/templates/domain/Version +0 -1
- data/lib/cli/commands/generate/templates/domain/lib/%name%.rb.tt +0 -21
- data/lib/cli/commands/generate/templates/domain/spec/spec_helper.rb.tt +0 -4
- data/lib/cli/commands/generate/templates/reference/lib/domain/%module_name%/%file_name%.rb.tt +0 -25
- data/lib/cli/commands/generate/templates/resource_server/config.ru.tt +0 -8
- data/lib/cli/commands/generate/templates/value_object/lib/domain/%module_name%/%name%.rb.tt +0 -24
- data/lib/cli/commands/test.rb +0 -41
- data/lib/domain_builder/attribute.rb +0 -33
- data/lib/domain_builder/domain.rb +0 -17
- data/lib/domain_builder/domain_builder.rb +0 -35
- data/lib/domain_builder/domain_module.rb +0 -26
- data/lib/domain_builder/domain_object.rb +0 -37
- data/lib/domain_builder/head.rb +0 -6
- data/lib/domain_builder/reference.rb +0 -17
- data/lib/domain_builder/value.rb +0 -6
@@ -1,40 +0,0 @@
|
|
1
|
-
class CRUDHandler
|
2
|
-
attr_reader :module_name, :application
|
3
|
-
|
4
|
-
def initialize(module_name:, application:)
|
5
|
-
@module_name = module_name
|
6
|
-
@application = application
|
7
|
-
end
|
8
|
-
|
9
|
-
def create(attributes)
|
10
|
-
application.call(
|
11
|
-
module_name: module_name,
|
12
|
-
command_name: :create,
|
13
|
-
args: attributes
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
def read(id)
|
18
|
-
application.query(
|
19
|
-
module_name: module_name,
|
20
|
-
query_name: :find_by_id,
|
21
|
-
args: {id: id}
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def update(id, attributes)
|
26
|
-
application.call(
|
27
|
-
module_name: module_name,
|
28
|
-
command_name: :update,
|
29
|
-
args: attributes.merge(id: id)
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
def delete(id)
|
34
|
-
application.call(
|
35
|
-
module_name: module_name,
|
36
|
-
command_name: :delete,
|
37
|
-
args: {id: id}
|
38
|
-
)
|
39
|
-
end
|
40
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Hecks
|
3
|
-
module Adapters
|
4
|
-
class Application
|
5
|
-
module Commands
|
6
|
-
class Delete
|
7
|
-
attr_accessor :args, :errors, :repository
|
8
|
-
|
9
|
-
def initialize(args: nil, repository:, domain_module:)
|
10
|
-
@args = args || chained_command.args
|
11
|
-
@repository = repository
|
12
|
-
@errors = { base: [] }
|
13
|
-
end
|
14
|
-
|
15
|
-
def call
|
16
|
-
delete
|
17
|
-
self
|
18
|
-
end
|
19
|
-
|
20
|
-
def name
|
21
|
-
self.class.to_s.split('::').last.underscore
|
22
|
-
end
|
23
|
-
|
24
|
-
def to_h
|
25
|
-
{ errors: errors, args: args }
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
attr_accessor :command_result, :repository
|
31
|
-
|
32
|
-
def delete
|
33
|
-
@result = repository.delete(args[:id])
|
34
|
-
@errors[:base] << "cound not find #{args[:id]}" unless @result
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Hecks
|
2
|
-
module Adapters
|
3
|
-
class Application
|
4
|
-
class Runner
|
5
|
-
attr_reader :module_name, :command
|
6
|
-
|
7
|
-
def initialize(command_name:, module_name:, args:, application:)
|
8
|
-
@command_name = command_name
|
9
|
-
@module_name = module_name
|
10
|
-
@args = args
|
11
|
-
@application = application
|
12
|
-
@domain_spec = application.domain_spec
|
13
|
-
end
|
14
|
-
|
15
|
-
def call()
|
16
|
-
fetch_command
|
17
|
-
run_command
|
18
|
-
broadcast
|
19
|
-
command
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_reader :command_name, :args, :application, :domain_spec
|
25
|
-
|
26
|
-
def broadcast
|
27
|
-
application.events_port.send(command: command, module_name: module_name)
|
28
|
-
end
|
29
|
-
|
30
|
-
def fetch_command
|
31
|
-
@command = Commands.const_get(command_name.to_s.camelcase).new(
|
32
|
-
repository: application.database[module_name],
|
33
|
-
args: args,
|
34
|
-
domain_module: fetch_module
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def fetch_module
|
39
|
-
domain_spec.domain_modules[module_name.to_s.camelize.to_sym]
|
40
|
-
end
|
41
|
-
|
42
|
-
def run_command
|
43
|
-
@command = command.call
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Hecks
|
3
|
-
module Adapters
|
4
|
-
class Application
|
5
|
-
module Commands
|
6
|
-
class Update
|
7
|
-
attr_accessor :args, :errors, :id, :repository
|
8
|
-
|
9
|
-
def initialize(args: nil, repository: Repository, domain_module:)
|
10
|
-
@repository = repository
|
11
|
-
@args = args
|
12
|
-
@errors = []
|
13
|
-
@id = @args.delete(:id)
|
14
|
-
end
|
15
|
-
|
16
|
-
def name
|
17
|
-
self.class.to_s.split('::').last.underscore
|
18
|
-
end
|
19
|
-
|
20
|
-
def call
|
21
|
-
update
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_h
|
26
|
-
{ id: id, args: args }
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
attr_reader :repository_result
|
32
|
-
|
33
|
-
def update
|
34
|
-
return if @errors.count.positive?
|
35
|
-
@repository_result = repository.update(id, args)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Hecks
|
3
|
-
module Adapters
|
4
|
-
class Application
|
5
|
-
module Queries
|
6
|
-
class FindById
|
7
|
-
def initialize(repository:)
|
8
|
-
@repository = repository
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(params)
|
12
|
-
return unless params.keys == [:id]
|
13
|
-
@repository.read(params[:id])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Hecks
|
2
|
-
module Adapters
|
3
|
-
class Application
|
4
|
-
class QueryRunner
|
5
|
-
def initialize(query_name:, application:, module_name:, args:)
|
6
|
-
@query_name = query_name
|
7
|
-
@application = application
|
8
|
-
@module_name = module_name
|
9
|
-
@args = args
|
10
|
-
end
|
11
|
-
|
12
|
-
def call()
|
13
|
-
fetch.new(repository: repository).call(@args)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def fetch
|
19
|
-
Queries.const_get(@query_name.to_s.camelcase)
|
20
|
-
end
|
21
|
-
|
22
|
-
def repository
|
23
|
-
@application.database[@module_name]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/cli/cli.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'active_support/inflector'
|
3
|
-
require_relative 'command_runner'
|
4
|
-
require_relative 'commands'
|
5
|
-
|
6
|
-
module Hecks
|
7
|
-
class CLI < Thor
|
8
|
-
package_name 'hecks'
|
9
|
-
|
10
|
-
desc 'generate', 'generate'
|
11
|
-
subcommand('generate', Generate)
|
12
|
-
|
13
|
-
desc 'package', 'package'
|
14
|
-
subcommand('package', Package) if File.file?('HECKS')
|
15
|
-
|
16
|
-
long_desc 'Generate a domain'
|
17
|
-
method_option :dryrun,
|
18
|
-
aliases: '-d',
|
19
|
-
type: :boolean,
|
20
|
-
desc: 'Output commands without running'
|
21
|
-
|
22
|
-
register(New, 'new', 'new', 'Create a new Domain') if File.file?('HECKS')
|
23
|
-
end
|
24
|
-
end
|
data/lib/cli/commands.rb
DELETED
data/lib/cli/commands/build.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'generate/new'
|
3
|
-
require_relative 'generate/generate_domain_object'
|
4
|
-
require_relative 'generate/generate_resource_server'
|
5
|
-
require_relative 'generate/builder'
|
6
|
-
|
7
|
-
|
8
|
-
class Generate < Thor
|
9
|
-
desc 'domain_objects', 'generate domain objects'
|
10
|
-
method_option :type,
|
11
|
-
aliases: '-t',
|
12
|
-
required: true,
|
13
|
-
desc: 'The type of the domain object you want to generate',
|
14
|
-
banner: '[OBJECT_TYPE]',
|
15
|
-
enum: %w(entity value_object aggregate reference)
|
16
|
-
register(GenerateDomainObject,
|
17
|
-
'domain_object',
|
18
|
-
'domain_object',
|
19
|
-
'Generate Domain Objects') if File.file?('HECKS')
|
20
|
-
|
21
|
-
desc 'resource_server', 'generate resource_server'
|
22
|
-
register(GenerateResourceServer,
|
23
|
-
'resource_server',
|
24
|
-
'resource_server',
|
25
|
-
'Generate A Resource Server for a domain') if File.file?('HECKS')
|
26
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
require_relative 'builder/value_object_command_line_builder'
|
5
|
-
require_relative 'builder/aggregate_command_line_builder'
|
6
|
-
require_relative 'builder/reference_command_line_builder'
|
7
|
-
|
8
|
-
module Hecks
|
9
|
-
class Builder
|
10
|
-
def initialize(hecks_file:, name:, dry_run: false)
|
11
|
-
@name = name
|
12
|
-
@domain = eval(hecks_file).domain
|
13
|
-
@dry_run = dry_run
|
14
|
-
@runner = CommandRunner.new(domain, name, dry_run)
|
15
|
-
end
|
16
|
-
|
17
|
-
def call
|
18
|
-
delete_tmpfile
|
19
|
-
puts "\n"
|
20
|
-
generate :domain
|
21
|
-
generate :modules
|
22
|
-
generate :value_objects
|
23
|
-
generate :references
|
24
|
-
execute_tmpfile && return unless @dry_run
|
25
|
-
print_tmpfile
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
attr_reader :runner, :name, :domain
|
31
|
-
|
32
|
-
def print_tmpfile
|
33
|
-
puts File.read('tmp/hecks')
|
34
|
-
end
|
35
|
-
|
36
|
-
def delete_tmpfile
|
37
|
-
return unless Pathname('tmp/hecks').exist?
|
38
|
-
FileUtils.rm('tmp/hecks')
|
39
|
-
end
|
40
|
-
|
41
|
-
def execute_tmpfile
|
42
|
-
exec('bash -x tmp/hecks')
|
43
|
-
end
|
44
|
-
|
45
|
-
def generate(command)
|
46
|
-
case command
|
47
|
-
when :references
|
48
|
-
ReferenceCommandLineBuilder.build(domain, runner)
|
49
|
-
when :domain
|
50
|
-
runner.call(['new', '-n', name])
|
51
|
-
when :modules
|
52
|
-
AggregateCommandLineBuilder.build(domain, runner)
|
53
|
-
when :value_objects
|
54
|
-
ValueObjectCommandLineBuilder.build(domain, runner)
|
55
|
-
else
|
56
|
-
raise "unrecognized command: #{command}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Hecks
|
2
|
-
class Builder
|
3
|
-
module AggregateCommandLineBuilder
|
4
|
-
def self.build(domain, runner)
|
5
|
-
domain.domain_modules.values.each do |domain_module|
|
6
|
-
runner.call(
|
7
|
-
[
|
8
|
-
'generate domain_object',
|
9
|
-
'-t', 'aggregate',
|
10
|
-
'-n', domain_module.name,
|
11
|
-
'--head_name', domain_module.head.name,
|
12
|
-
'-a', domain_module.head.attribute_string
|
13
|
-
])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Hecks
|
2
|
-
class Builder
|
3
|
-
module ReferenceCommandLineBuilder
|
4
|
-
def self.build(domain, runner)
|
5
|
-
domain.domain_modules.values.each do |domain_module|
|
6
|
-
domain_module.references.each do |reference|
|
7
|
-
runner.call([
|
8
|
-
'generate domain_object',
|
9
|
-
'-t', 'reference',
|
10
|
-
'-n', reference.name,
|
11
|
-
'-m', domain_module.name,
|
12
|
-
'-r', reference.referenced_entity
|
13
|
-
])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Hecks
|
2
|
-
class Builder
|
3
|
-
module ValueObjectCommandLineBuilder
|
4
|
-
def self.build(domain, runner)
|
5
|
-
domain.domain_modules.values.each do |domain_module|
|
6
|
-
(domain_module.objects - [domain_module.head]).each do |value_object|
|
7
|
-
runner.call([
|
8
|
-
'generate domain_object',
|
9
|
-
'-t', 'value_object',
|
10
|
-
'-n', value_object.name,
|
11
|
-
'-m', domain_module.name,
|
12
|
-
'-a', value_object.attribute_string
|
13
|
-
])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class GenerateResourceServer < Thor::Group; end
|
2
|
-
|
3
|
-
class GeneratePackage
|
4
|
-
include Thor::Actions
|
5
|
-
|
6
|
-
def self.source_root
|
7
|
-
File.dirname(__FILE__) + '/templates/'
|
8
|
-
end
|
9
|
-
|
10
|
-
def create_package
|
11
|
-
directory('package', './packages/lambda')
|
12
|
-
end
|
13
|
-
|
14
|
-
def domain
|
15
|
-
File.basename(Dir.getwd)
|
16
|
-
end
|
17
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
class GenerateBinaryPackage < Thor::Group
|
2
|
-
include Thor::Actions
|
3
|
-
|
4
|
-
HOST = "http://d6r77u77i8pq3.cloudfront.net/releases"
|
5
|
-
OSX_BINARY = "traveling-ruby-20150715-2.2.2-osx.tar.gz"
|
6
|
-
LINUX_BINARY = 'traveling-ruby-20150715-2.2.2-linux-x86_64.tar.gz'
|
7
|
-
BUILD_DIR = 'packages/binary/build'
|
8
|
-
RESOURCES_DIR = BUILD_DIR + '/resources'
|
9
|
-
OSX_DIR = BUILD_DIR + '/osx'
|
10
|
-
OSX_LIB_DIR = OSX_DIR + '/lib'
|
11
|
-
OSX_APP_DIR = OSX_LIB_DIR + '/app'
|
12
|
-
LINUX_DIR = BUILD_DIR + '/linux-x86_64'
|
13
|
-
LINUX_LIB_DIR = LINUX_DIR + 'lib'
|
14
|
-
LINUX_APP_DIR = LINUX_LIB_DIR + '/app'
|
15
|
-
|
16
|
-
def self.source_root
|
17
|
-
File.dirname(__FILE__) + '/templates'
|
18
|
-
end
|
19
|
-
|
20
|
-
def create_package_folder
|
21
|
-
run("rm -rf packages/binary")
|
22
|
-
directory('binary_package', './packages/binary')
|
23
|
-
end
|
24
|
-
|
25
|
-
def domain_name
|
26
|
-
Dir.pwd.split('/').last
|
27
|
-
end
|
28
|
-
|
29
|
-
def build
|
30
|
-
package(OSX_APP_DIR, OSX_LIB_DIR, OSX_BINARY, OSX_DIR)
|
31
|
-
package(LINUX_APP_DIR, LINUX_LIB_DIR, LINUX_BINARY, LINUX_DIR)
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def package(app_dir, lib_dir, binary, package_dir)
|
37
|
-
empty_directory(app_dir)
|
38
|
-
empty_directory(lib_dir + '/ruby')
|
39
|
-
download(binary, lib_dir)
|
40
|
-
copy_resources(app_dir, package_dir)
|
41
|
-
bundle_with_ruby_2_2_2(app_dir)
|
42
|
-
reduce_package_size(app_dir)
|
43
|
-
end
|
44
|
-
|
45
|
-
def reduce_package_size(app_dir)
|
46
|
-
files = %w(test tests spec features benchmark README* CHANGE* Change*
|
47
|
-
COPYING* LICENSE* MIT-LICENSE* TODO *.txt *.md *.rdoc doc docs example
|
48
|
-
examples sample doc-api
|
49
|
-
)
|
50
|
-
files.each do |file|
|
51
|
-
run("rm -rf #{app_dir}/vendor/ruby/*/gems/*/#{file}")
|
52
|
-
end
|
53
|
-
|
54
|
-
run("rm -rf #{app_dir}/vendor/*/*/cache/*")
|
55
|
-
%w(.gitignore .travis.yml).each do |file|
|
56
|
-
run("rm -rf #{app_dir}/vendor/ruby/*/gems/*/#{file}")
|
57
|
-
end
|
58
|
-
|
59
|
-
%w(MAKEfile */Makefile */tmp).each do |file|
|
60
|
-
run("rm -f #{app_dir}/vendor/ruby/*/gems/*/ext/#{file}")
|
61
|
-
end
|
62
|
-
|
63
|
-
%w(*.c *.cpp *.h *.rl *extconf.rb *.java *.class *.md).each do |file|
|
64
|
-
run("find #{app_dir}/vendor/ruby -name '#{file}' | xargs rm -f")
|
65
|
-
end
|
66
|
-
|
67
|
-
%w(*.0 *.so *.bundle).each do |file|
|
68
|
-
run("find #{app_dir}/vendor/ruby/*/gems -name '#{file}' | xargs rm -f")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def copy_resources(app_dir, package_dir)
|
73
|
-
run("cp #{RESOURCES_DIR}/Gemfile #{app_dir}")
|
74
|
-
run("cp -rf #{RESOURCES_DIR}/bundle #{app_dir}/.bundle")
|
75
|
-
run("cp -rf #{RESOURCES_DIR}/#{domain_name}.rb #{app_dir}/#{domain_name}.rb")
|
76
|
-
run("cp -rf #{RESOURCES_DIR}/wrapper #{package_dir}/#{domain_name}")
|
77
|
-
run("cd #{package_dir} && chmod 744 #{domain_name}")
|
78
|
-
end
|
79
|
-
|
80
|
-
def download(binary, lib_dir)
|
81
|
-
run("cd #{RESOURCES_DIR} && curl -O #{HOST}/#{binary}")
|
82
|
-
run("tar -xzf #{RESOURCES_DIR}/#{binary} -C #{lib_dir}/ruby")
|
83
|
-
end
|
84
|
-
|
85
|
-
def bundle_with_ruby_2_2_2(app_dir)
|
86
|
-
run("cp -rf #{RESOURCES_DIR}/Dockerfile #{app_dir}")
|
87
|
-
run("cp #{domain_name}-0.0.0.gem #{app_dir}" )
|
88
|
-
run("cd #{app_dir} && docker build -t #{domain_name} --no-cache .")
|
89
|
-
container = `docker create pizza_builder:latest`.gsub("\n", '')
|
90
|
-
run("docker cp #{container}:/usr/src/app/vendor #{app_dir}")
|
91
|
-
end
|
92
|
-
end
|