dc-deck 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f37eabed222fa4a18f32dd53e684203a26156522
4
- data.tar.gz: c53485c18058a251d5ea878e16058ab7e931a0eb
3
+ metadata.gz: 005566227f6f22c0e3623c54bfd82637b2a8bab8
4
+ data.tar.gz: ee82398dfbf26bfabdf60420b5b234d097b7e92c
5
5
  SHA512:
6
- metadata.gz: 345894e241846b2831d5c8a911033d8caad9c2727850cab28847751a065cf0245777c7d709f884d1ce3cbc5c1a65d66a37c5d0070db540e142627ca5df81e7c6
7
- data.tar.gz: 657ce336267204eeda2932bace07e57645ea41996a9e3d17080b12ba107834cc9b4cf3fd39b8f365de1571582115e8d354852a6b717c72062679b05e8fa1ec53
6
+ metadata.gz: 1715957696c24eb1e0ac4bc7499e139da4b6b4f41208a0058df0b785254ef4a327a1d19f113c2a610a300558e1d9483cc160dd5609797f7f243d31606ea9280b
7
+ data.tar.gz: 6587a23e6cbabedbafe51c3d0d11dcd55ca9a09d1ad42008507e299022a3d2f7c9e2e9f28dcdcbbbb9d6d63a2a016f9c970658dd4c30a7ef27fd689096cd30bf
data/bin/deck ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'deck'
3
+
4
+ Deck::CommandLine.start ARGV
data/lib/deck.rb CHANGED
@@ -1,14 +1,18 @@
1
1
  module Deck
2
- autoload :Submodule, 'deck/submodule'
3
- autoload :Build, 'deck/build'
4
- autoload :Run, 'deck/run'
2
+ autoload :Config, 'deck/config'
3
+ autoload :Submodule, 'deck/submodule'
4
+ autoload :Repeatable, 'deck/repeatable'
5
+ autoload :Container, 'deck/container'
6
+ autoload :Run, 'deck/run'
7
+ autoload :CommandLine, 'deck/command_line'
5
8
 
6
9
  class << self
7
- def build(name, &block)
8
- build = Build.new
9
- build.name name
10
- build.instance_eval &block
11
- build
10
+ def design(name, tag: nil, &block)
11
+ container = Container.new
12
+ container.name name
13
+ container.tag tag unless tag.nil?
14
+ container.instance_eval &block
15
+ container
12
16
  end
13
17
 
14
18
  def run
@@ -0,0 +1,65 @@
1
+ require 'thor'
2
+ require 'yaml'
3
+ require 'erb'
4
+
5
+ class Deck::CommandLine < Thor
6
+ require_relative 'command_line/container_helper'
7
+ class_option :dir, aliases: [:d], desc: 'path to locate definitions', default: Deck::Config['dir']
8
+
9
+ desc 'design NAME', 'build a docker image'
10
+ option :value, aliases: [:V], banner: 'KEY=VALUE', desc: 'override variable. format: key=value,key=value[,key=value...]'
11
+ def design(name)
12
+ reload_local_config
13
+ ensure_user_config
14
+
15
+ helper = ContainerHelper.new name, options
16
+
17
+ system helper.build_command
18
+ system helper.update_latest_tag
19
+ end
20
+
21
+ =begin
22
+ desc 'load NAME', 'running a docker container from image'
23
+ option :value, aliases: [:V], banner: 'KEY=VALUE', desc: 'override variable. format: key=value,key=value[,key=value...]'
24
+ def load(name)
25
+ reload_local_config
26
+
27
+ helper = ContainerHelper.new name, options
28
+
29
+ puts helper.run_command
30
+ end
31
+
32
+ desc 'config [NAME [VALUE]]', 'get/set configuration value'
33
+ def config(name = nil, value = nil)
34
+ reload_local_config
35
+
36
+ return config_list if name.nil? and value.nil?
37
+ return if value.nil? and !Deck::Config.keys.include? name
38
+ return puts(Deck::Config[name.to_sym]) if value.nil?
39
+ write_config name, value
40
+ end
41
+ =end
42
+
43
+ private
44
+ def reload_local_config
45
+ dir = options[:dir]
46
+ Deck::Config.source "#{dir}/config.yml"
47
+ Deck::Config.reload!
48
+ end
49
+
50
+ def config_list
51
+ maximum_length = Deck::Config.keys.reduce(0) { |memo,k| k.length > memo ? k.length : memo}
52
+ Deck::Config.keys.each do |key|
53
+ printf " %#{maximum_length}s : %s\n", key, Deck::Config[key]
54
+ end
55
+ end
56
+
57
+ def write_config(name, value)
58
+ hash = YAML.load(ERB.new(File.read "#{options[:dir]}/config.yml").result)
59
+ hash = {} if hash.nil? or hash.empty?
60
+ hash[name] = value
61
+ File.open("#{options[:dir]}/config.yml", 'w') do |f|
62
+ f.write(YAML.dump(hash))
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,55 @@
1
+ class Deck::CommandLine::ContainerHelper
2
+ attr_reader :container
3
+
4
+ def initialize(name, options)
5
+ @options = options
6
+
7
+ load_blueprint name
8
+ end
9
+
10
+ def run_command
11
+ command = @container.run_command
12
+ process_meta command
13
+ end
14
+
15
+ def build_command
16
+ command = raw_build_command
17
+ process_meta command
18
+ end
19
+
20
+ def update_latest_tag
21
+ process_meta "docker tag -f #{@container.image_name} #{@container.repository}/#{@container.name}:latest"
22
+ end
23
+
24
+ private
25
+ def load_blueprint(name)
26
+ @container = Deck.send(:eval, File.read("#{@options[:dir]}/#{name}.deck"))
27
+
28
+ process_variables
29
+ end
30
+
31
+ def process_meta(command)
32
+ result = command
33
+ @container.meta.each do |_, v|
34
+ result = v.process(result) if v.respond_to? :process
35
+ end
36
+
37
+ result
38
+ end
39
+
40
+ def process_variables
41
+ Hash[*(@options[:value].split(',').map { |item| item.split('=') }.flatten)].each do |key, value|
42
+ @container.meta[:variable].set key, value
43
+ end unless @options[:value].nil? or @options[:value].empty?
44
+
45
+ @container
46
+ end
47
+
48
+ def raw_build_command
49
+ <<-EOF
50
+ docker build --rm -t #{@container.image_name} - <<DOCKERFILE
51
+ #{@container.build_command}
52
+ DOCKERFILE
53
+ EOF
54
+ end
55
+ end
@@ -0,0 +1,21 @@
1
+ require 'settingslogic'
2
+ require 'fileutils'
3
+
4
+ USER_CONF_LOCATION = "#{ENV['HOME']}/.deck.d"
5
+ DEFAULT_CONF_LOCATION = ['/etc/deck', USER_CONF_LOCATION]
6
+
7
+ class Deck::Config < Settingslogic
8
+ DEFAULT_CONF_LOCATION.each do |location|
9
+ source "#{location}/config.yml"
10
+ end
11
+ end
12
+
13
+ if Deck::Config['dir'].nil?
14
+ Deck::Config['dir'] = USER_CONF_LOCATION
15
+ else
16
+ Deck::Config.source "#{Deck::Config.dir}/config.yml"
17
+ end
18
+
19
+ def ensure_user_config
20
+ FileUtils.mkdir_p USER_CONF_LOCATION
21
+ end
@@ -0,0 +1,75 @@
1
+ class Deck::Container
2
+ autoload :Repository, 'deck/container/repository'
3
+ autoload :Name, 'deck/container/name'
4
+ autoload :From, 'deck/container/from'
5
+ autoload :Expose, 'deck/container/expose'
6
+ autoload :Cmd, 'deck/container/cmd'
7
+ autoload :Archive, 'deck/container/archive'
8
+ autoload :Add, 'deck/container/add'
9
+ autoload :Start, 'deck/container/start'
10
+ autoload :WorkDir, 'deck/container/work_dir'
11
+ autoload :Tag, 'deck/container/tag'
12
+ autoload :Variable, 'deck/container/variable'
13
+ autoload :Publish, 'deck/container/publish'
14
+ autoload :Env, 'deck/container/env'
15
+
16
+ attr_reader :meta
17
+
18
+ def initialize
19
+ @information = {}
20
+ @meta = {}
21
+ @call_order = []
22
+ self.class.constants.each do |sub|
23
+ sub = self.class.const_get(sub).new
24
+ if sub.class.meta?
25
+ @meta[sub.class.register_name] = sub
26
+ else
27
+ @information[sub.class.register_name] = sub
28
+ end
29
+ end
30
+ end
31
+
32
+ def build_command
33
+ dockerfile = ''
34
+ @call_order.each do |info|
35
+ command = @information[info].build_command(@information)
36
+ dockerfile += "#{command}\n" unless command.nil?
37
+ @information[info].next if @information[info].class.include? Deck::Repeatable
38
+ end
39
+ dockerfile
40
+ end
41
+
42
+ def image_name
43
+ "#{repository.to_s}/#{name.to_s}:#{tag.to_s}"
44
+ end
45
+
46
+ def run_command
47
+ "docker run #{image_name}"
48
+ end
49
+
50
+ def method_missing(name, *args, &block)
51
+ return handle_information(name, *args, &block) if @information.include? name.to_sym
52
+ return handle_meta(name, *args, &block) if @meta.include? name.to_sym
53
+ raise NoMethodError, "do not define such method : #{name.inspect}"
54
+ end
55
+
56
+ private
57
+ def handle_information(name, *args, &block)
58
+ if args.nil? || args.empty?
59
+ @information[name.to_sym].send :get
60
+ else
61
+ info = @information[name.to_sym]
62
+ value = info.send :set, *args
63
+ @call_order << name.to_sym unless @call_order.include? name.to_sym and not info.class.repeatable?
64
+ value
65
+ end
66
+ end
67
+
68
+ def handle_meta(name, *args, &block)
69
+ if args.nil? || args.empty?
70
+ @meta[name.to_sym].send :get
71
+ else
72
+ @meta[name.to_sym].send :set, *args
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,22 @@
1
+ class Deck::Container::Add
2
+ include Deck::Submodule
3
+ include Deck::Repeatable
4
+
5
+ repeatable true
6
+ register_name :add
7
+
8
+ def define(file, path: '/')
9
+ step do
10
+ attributes[:file] = file
11
+ attributes[:path] = path
12
+ end
13
+ end
14
+
15
+ def export
16
+ attributes[:file]
17
+ end
18
+
19
+ def build_command(deps)
20
+ cmd = "ADD #{attributes[:file]} #{attributes[:path]}\n"
21
+ end
22
+ end
@@ -1,15 +1,19 @@
1
- class Deck::Build::Archive
1
+ class Deck::Container::Archive
2
2
  include Deck::Submodule
3
+ include Deck::Repeatable
3
4
 
5
+ repeatable true
4
6
  register_name :archive
5
7
 
6
- def execute(file, path: '/', type: :tar)
7
- attributes[:file] = file
8
- attributes[:path] = path
9
- attributes[:type] = type
8
+ def define(file, path: '/', type: :tar)
9
+ step do
10
+ attributes[:file] = file
11
+ attributes[:path] = path
12
+ attributes[:type] = type
13
+ end
10
14
  end
11
15
 
12
- def value
16
+ def export
13
17
  attributes[:file]
14
18
  end
15
19
 
@@ -26,6 +30,10 @@ class Deck::Build::Archive
26
30
  "cd #{attributes[:path]} && tar zxf #{filename}"
27
31
  end
28
32
 
33
+ def zip
34
+ "cd #{attributes[:path]} && unzip #{filename}"
35
+ end
36
+
29
37
  def filename
30
38
  File.basename attributes[:file]
31
39
  end
@@ -0,0 +1,25 @@
1
+ class Deck::Container::Cmd
2
+ include Deck::Submodule
3
+ include Deck::Repeatable
4
+
5
+ register_name :cmd
6
+ repeatable true
7
+
8
+ def initialize
9
+ end
10
+
11
+ def define(command, workdir: '/')
12
+ step do
13
+ attributes[:command] = command
14
+ attributes[:workdir] = workdir
15
+ end
16
+ end
17
+
18
+ def export
19
+ attributes[:command]
20
+ end
21
+
22
+ def build_command(deps)
23
+ "RUN cd #{attributes[:workdir]} && #{attributes[:command]}"
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ class Deck::Container::Env
2
+ include Deck::Submodule
3
+ include Deck::Repeatable
4
+
5
+ register_name :env
6
+ repeatable true
7
+
8
+ def initialize
9
+ end
10
+
11
+ def define(name, value)
12
+ step do
13
+ attributes[:name] = name
14
+ attributes[:value] = value
15
+ end
16
+ end
17
+
18
+ def export
19
+ {attributes[:name].to_sym => attributes[:value]}
20
+ end
21
+
22
+ def build_command(deps)
23
+ "ENV #{attributes[:name]} #{attributes[:value]}"
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ class Deck::Container::Expose
2
+ include Deck::Submodule
3
+
4
+ register_name :expose
5
+
6
+ def define(*ports)
7
+ attributes[:port] = ports
8
+ end
9
+
10
+ def export
11
+ attributes[:port]
12
+ end
13
+
14
+ def build_command(deps)
15
+ "EXPOSE #{export.join(' ')}"
16
+ end
17
+ end
@@ -1,21 +1,21 @@
1
- class Deck::Build::From
1
+ class Deck::Container::From
2
2
  include Deck::Submodule
3
3
 
4
4
  register_name :from
5
5
  dependancies :repository
6
6
 
7
- def execute(name, of: nil)
7
+ def define(name, of: nil)
8
8
  attributes[:name] = name
9
9
  attributes[:repository] = of
10
10
  end
11
11
 
12
- def value
12
+ def export
13
13
  attributes[:name]
14
14
  end
15
15
 
16
16
  def build_command(deps)
17
17
  repository = attributes[:repository]
18
- repository = deps[:repository].value if repository.nil?
19
- "FROM #{repository}/#{value}"
18
+ repository = deps[:repository].get if repository.nil?
19
+ "FROM #{repository}/#{export}"
20
20
  end
21
21
  end
@@ -1,14 +1,14 @@
1
- class Deck::Build::Name
1
+ class Deck::Container::Name
2
2
  include Deck::Submodule
3
3
 
4
4
  register_name :name
5
5
  dependancies :repository
6
6
 
7
- def execute(name)
7
+ def define(name)
8
8
  attributes[:name] = name
9
9
  end
10
10
 
11
- def value
11
+ def export
12
12
  attributes[:name]
13
13
  end
14
14
 
@@ -0,0 +1,14 @@
1
+ class Deck::Container::Publish
2
+ include Deck::Submodule
3
+
4
+ register_name :publish
5
+ type :meta
6
+
7
+ def initialize
8
+ @ports = []
9
+ end
10
+
11
+ def define(port)
12
+ @ports << port
13
+ end
14
+ end
@@ -1,13 +1,13 @@
1
- class Deck::Build::Repository
1
+ class Deck::Container::Repository
2
2
  include Deck::Submodule
3
3
 
4
4
  register_name :repository
5
5
 
6
- def execute(name)
6
+ def define(name)
7
7
  attributes[:repository] = name
8
8
  end
9
9
 
10
- def value
10
+ def export
11
11
  attributes[:repository]
12
12
  end
13
13
  end
@@ -1,15 +1,15 @@
1
- class Deck::Build::Start
1
+ class Deck::Container::Start
2
2
  include Deck::Submodule
3
3
 
4
4
  register_name :start
5
5
 
6
- def execute(type, command, workdir: '/')
6
+ def define(type, command, workdir: '.')
7
7
  attributes[:type] = type
8
8
  attributes[:command] = command
9
9
  attributes[:workdir] = workdir
10
10
  end
11
11
 
12
- def value
12
+ def export
13
13
  attributes[:command]
14
14
  end
15
15
 
@@ -0,0 +1,18 @@
1
+ class Deck::Container::Tag
2
+ include Deck::Submodule
3
+
4
+ register_name :tag
5
+ type :meta
6
+
7
+ def initialize
8
+ @tag = 'latest'
9
+ end
10
+
11
+ def define(value)
12
+ @tag = value
13
+ end
14
+
15
+ def prepare
16
+ @tag
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ class Deck::Container::Variable
2
+ include Deck::Submodule
3
+
4
+ register_name :variable
5
+ type :meta
6
+
7
+ def initialize
8
+ @variables = {}
9
+ end
10
+
11
+ def define(name, value)
12
+ @variables[name.to_sym] = value
13
+ end
14
+
15
+ def prepare
16
+ Hash[*@variables.map { |k,v| [k, "::#{k}::"]}.flatten].dup.freeze
17
+ end
18
+
19
+ def process(command)
20
+ @variables.each do |k,v|
21
+ command.gsub! "::#{k}::", v.to_s
22
+ end
23
+
24
+ command
25
+ end
26
+
27
+ def meta
28
+ @variables.dup.freeze
29
+ end
30
+ end
@@ -1,13 +1,13 @@
1
- class Deck::Build::WorkDir
1
+ class Deck::Container::WorkDir
2
2
  include Deck::Submodule
3
3
 
4
4
  register_name :workdir
5
5
 
6
- def execute(workdir)
6
+ def define(workdir)
7
7
  attributes[:workdir] = workdir
8
8
  end
9
9
 
10
- def value
10
+ def export
11
11
  attributes[:workdir]
12
12
  end
13
13
 
@@ -0,0 +1,26 @@
1
+ module Deck::Repeatable
2
+ class Step
3
+ attr_reader :attributes
4
+
5
+ def initialize
6
+ @attributes = {}
7
+ end
8
+ end
9
+
10
+ def step(&block)
11
+ @repeatable_attr ||= []
12
+ step = Step.new
13
+ step.instance_eval(&block) if block_given?
14
+
15
+ @repeatable_attr << step.attributes
16
+ end
17
+
18
+ def attributes
19
+ @index ||= 0
20
+ @repeatable_attr[@index]
21
+ end
22
+
23
+ def next
24
+ @index += 1
25
+ end
26
+ end
@@ -1,4 +1,17 @@
1
1
  module Deck::Submodule
2
+ def map
3
+ {
4
+ build: {
5
+ set: :define,
6
+ get: :export
7
+ },
8
+ meta: {
9
+ set: :define,
10
+ get: :prepare
11
+ }
12
+ }
13
+ end
14
+
2
15
  def attributes
3
16
  @attributes ||= {}
4
17
  @attributes
@@ -8,13 +21,39 @@ module Deck::Submodule
8
21
  attributes
9
22
  end
10
23
 
11
- def execute(*args)
24
+ def set(*args)
25
+ method = map[self.class.type][:set]
26
+ public_send method, *args if respond_to? method
27
+ end
28
+
29
+ def get
30
+ method = map[self.class.type][:get]
31
+ public_send method if respond_to? method
12
32
  end
13
33
 
14
34
  def build_command(deps)
15
35
  end
16
36
 
17
37
  module ClassMethods
38
+ def meta?
39
+ type == :meta
40
+ end
41
+
42
+ def repeatable?
43
+ @repeatable
44
+ end
45
+
46
+ def type(type=nil)
47
+ @type ||= :build
48
+ @type = type unless type.nil?
49
+ @type
50
+ end
51
+
52
+ def repeatable(value=nil)
53
+ @repeatable = value unless type.nil?
54
+ @repeatable
55
+ end
56
+
18
57
  def register_name(name=nil)
19
58
  @name = name unless name.nil?
20
59
  @name
metadata CHANGED
@@ -1,166 +1,177 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dc-deck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeong, Jiung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-13 00:00:00.000000000 Z
11
+ date: 2014-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.19.1
20
17
  - - "~>"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '0.19'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.19.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.19'
27
30
  - - ">="
28
31
  - !ruby/object:Gem::Version
29
32
  version: 0.19.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: dc-settingslogic
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
30
37
  - - "~>"
31
38
  - !ruby/object:Gem::Version
32
- version: '0.19'
39
+ version: '2.1'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.1'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: rake
35
49
  requirement: !ruby/object:Gem::Requirement
36
50
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 10.3.2
40
51
  - - "~>"
41
52
  - !ruby/object:Gem::Version
42
53
  version: '10.3'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 10.3.2
43
57
  type: :runtime
44
58
  prerelease: false
45
59
  version_requirements: !ruby/object:Gem::Requirement
46
60
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 10.3.2
50
61
  - - "~>"
51
62
  - !ruby/object:Gem::Version
52
63
  version: '10.3'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 10.3.2
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: wirble
55
69
  requirement: !ruby/object:Gem::Requirement
56
70
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: 0.1.3
60
71
  - - "~>"
61
72
  - !ruby/object:Gem::Version
62
73
  version: '0.1'
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 0.1.3
63
77
  type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 0.1.3
70
81
  - - "~>"
71
82
  - !ruby/object:Gem::Version
72
83
  version: '0.1'
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 0.1.3
73
87
  - !ruby/object:Gem::Dependency
74
88
  name: bundler
75
89
  requirement: !ruby/object:Gem::Requirement
76
90
  requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: 1.5.3
80
91
  - - "~>"
81
92
  - !ruby/object:Gem::Version
82
93
  version: '1.5'
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 1.5.3
83
97
  type: :development
84
98
  prerelease: false
85
99
  version_requirements: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 1.5.3
90
101
  - - "~>"
91
102
  - !ruby/object:Gem::Version
92
103
  version: '1.5'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 1.5.3
93
107
  - !ruby/object:Gem::Dependency
94
108
  name: pry
95
109
  requirement: !ruby/object:Gem::Requirement
96
110
  requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: 0.9.12
100
111
  - - "~>"
101
112
  - !ruby/object:Gem::Version
102
113
  version: '0.9'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 0.9.12
103
117
  type: :development
104
118
  prerelease: false
105
119
  version_requirements: !ruby/object:Gem::Requirement
106
120
  requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: 0.9.12
110
121
  - - "~>"
111
122
  - !ruby/object:Gem::Version
112
123
  version: '0.9'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 0.9.12
113
127
  - !ruby/object:Gem::Dependency
114
128
  name: yard
115
129
  requirement: !ruby/object:Gem::Requirement
116
130
  requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: 0.8.7
120
131
  - - "~>"
121
132
  - !ruby/object:Gem::Version
122
133
  version: '0.8'
123
- type: :development
124
- prerelease: false
125
- version_requirements: !ruby/object:Gem::Requirement
126
- requirements:
127
134
  - - ">="
128
135
  - !ruby/object:Gem::Version
129
136
  version: 0.8.7
130
- - - "~>"
131
- - !ruby/object:Gem::Version
132
- version: '0.8'
133
- - !ruby/object:Gem::Dependency
134
- name: rspec
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '2.99'
140
137
  type: :development
141
138
  prerelease: false
142
139
  version_requirements: !ruby/object:Gem::Requirement
143
140
  requirements:
144
141
  - - "~>"
145
142
  - !ruby/object:Gem::Version
146
- version: '2.99'
143
+ version: '0.8'
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 0.8.7
147
147
  description: Docker CLI helper
148
148
  email:
149
149
  - ethernuiel@gmail.com
150
- executables: []
150
+ executables:
151
+ - deck
151
152
  extensions: []
152
153
  extra_rdoc_files: []
153
154
  files:
155
+ - bin/deck
154
156
  - lib/deck.rb
155
- - lib/deck/build.rb
156
- - lib/deck/build/archive.rb
157
- - lib/deck/build/cmd.rb
158
- - lib/deck/build/expose.rb
159
- - lib/deck/build/from.rb
160
- - lib/deck/build/name.rb
161
- - lib/deck/build/repository.rb
162
- - lib/deck/build/start.rb
163
- - lib/deck/build/work_dir.rb
157
+ - lib/deck/command_line.rb
158
+ - lib/deck/command_line/container_helper.rb
159
+ - lib/deck/config.rb
160
+ - lib/deck/container.rb
161
+ - lib/deck/container/add.rb
162
+ - lib/deck/container/archive.rb
163
+ - lib/deck/container/cmd.rb
164
+ - lib/deck/container/env.rb
165
+ - lib/deck/container/expose.rb
166
+ - lib/deck/container/from.rb
167
+ - lib/deck/container/name.rb
168
+ - lib/deck/container/publish.rb
169
+ - lib/deck/container/repository.rb
170
+ - lib/deck/container/start.rb
171
+ - lib/deck/container/tag.rb
172
+ - lib/deck/container/variable.rb
173
+ - lib/deck/container/work_dir.rb
174
+ - lib/deck/repeatable.rb
164
175
  - lib/deck/run.rb
165
176
  - lib/deck/submodule.rb
166
177
  homepage:
@@ -188,3 +199,4 @@ signing_key:
188
199
  specification_version: 4
189
200
  summary: Docker Command line helper
190
201
  test_files: []
202
+ has_rdoc:
data/lib/deck/build.rb DELETED
@@ -1,34 +0,0 @@
1
- class Deck::Build
2
- autoload :Repository, 'deck/build/repository'
3
- autoload :Name, 'deck/build/name'
4
- autoload :From, 'deck/build/from'
5
- autoload :Expose, 'deck/build/expose'
6
- autoload :Cmd, 'deck/build/cmd'
7
- autoload :Archive, 'deck/build/archive'
8
- autoload :Start, 'deck/build/start'
9
- autoload :WorkDir, 'deck/build/work_dir'
10
-
11
- def initialize
12
- @informations = {}
13
- @call_order = []
14
- self.class.constants.each do |sub|
15
- sub = self.class.const_get(sub).new
16
- @informations[sub.class.register_name] = sub
17
- end
18
- end
19
-
20
- def build_command
21
- @call_order.each do |info|
22
- puts @informations[info].build_command(@informations) unless @informations[info].build_command(@informations).nil?
23
- end
24
- end
25
-
26
- def execute
27
- end
28
-
29
- def method_missing(name, *args, &block)
30
- raise NoMethodError, 'do not define such method' unless @informations.include? name.to_sym
31
- @informations[name.to_sym].send :execute, *args
32
- @call_order << name.to_sym unless @call_order.include? name.to_sym
33
- end
34
- end
@@ -1,18 +0,0 @@
1
- class Deck::Build::Cmd
2
- include Deck::Submodule
3
-
4
- register_name :cmd
5
-
6
- def execute(command, workdir: '/')
7
- attributes[:command] = command
8
- attributes[:workdir] = workdir
9
- end
10
-
11
- def value
12
- attributes[:command]
13
- end
14
-
15
- def build_command(deps)
16
- "RUN cd #{attributes[:workdir]} && #{attributes[:command]}"
17
- end
18
- end
@@ -1,17 +0,0 @@
1
- class Deck::Build::Expose
2
- include Deck::Submodule
3
-
4
- register_name :expose
5
-
6
- def execute(port)
7
- attributes[:port] = port
8
- end
9
-
10
- def value
11
- attributes[:port]
12
- end
13
-
14
- def build_command(deps)
15
- "EXPOSE #{value}"
16
- end
17
- end