docker-template 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +8 -126
- data/lib/docker/template.rb +9 -11
- data/lib/docker/template/cli/build.rb +3 -1
- data/lib/docker/template/repo.rb +3 -4
- data/lib/docker/template/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c619f82805d6347fc614a212828d5bcb1b185783171a771c2720c9f277c175a
|
4
|
+
data.tar.gz: d1dc93f95b9f840b82e5d4d29017d7b681660a1f3921626d128f140508676c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10fa2829cfb98fb41a19dfbd92ef71926024c4e0e3bee74d2950823e7cd397e8fcca4728d56e0b1bec89a37b1a2951f573329ebe513646d267c290d5d0e01570
|
7
|
+
data.tar.gz: 97c360cb05d1356f81189bc226228fb57d0f16e946f84b886c16b8e6dec78d410253a39289d03a29511ff10e89adbdb3a67bffaa2e786610ee1497d9a77e964a
|
data/Rakefile
CHANGED
@@ -1,130 +1,12 @@
|
|
1
1
|
# Frozen-string-literal: true
|
2
|
-
# Copyright:
|
2
|
+
# Copyright: 2017 - 2018 - MIT License
|
3
|
+
# Source: https://github.com/envygeeks/devfiles
|
4
|
+
# Author: Jordon Bedwell
|
3
5
|
# Encoding: utf-8
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require "simple/ansi"
|
12
|
-
require "rspec/core/rake_task"
|
13
|
-
require "docker/template/cli"
|
14
|
-
require "open3"
|
15
|
-
|
16
|
-
# --
|
17
|
-
|
18
|
-
task :default => [:spec]
|
19
|
-
RSpec::Core::RakeTask.new :spec
|
20
|
-
task :test => :spec
|
21
|
-
|
22
|
-
# --
|
23
|
-
# TODO: Cleanup and remove this whenever you can.
|
24
|
-
# --
|
25
|
-
module CompList
|
26
|
-
module_function
|
27
|
-
|
28
|
-
# --
|
29
|
-
# Update the pak file to have all the completions.
|
30
|
-
# --
|
31
|
-
def update(data = get_commands, msgp = data.to_msgpack)
|
32
|
-
pak_file.binwrite(
|
33
|
-
msgp
|
34
|
-
)
|
35
|
-
end
|
36
|
-
|
37
|
-
# --
|
38
|
-
|
39
|
-
def normalize_command(command)
|
40
|
-
if command.is_a?(Array)
|
41
|
-
then command.map do |key|
|
42
|
-
key.tr(
|
43
|
-
"_", "-"
|
44
|
-
)
|
45
|
-
end
|
46
|
-
else
|
47
|
-
command.tr(
|
48
|
-
"_", "-"
|
49
|
-
)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# --
|
54
|
-
# Provides the base "_reply" for your auto-complete data output.
|
55
|
-
# --
|
56
|
-
def base(const, skip = %w(help))
|
57
|
-
keys = const.all_commands.keys
|
58
|
-
return "_reply" => normalize_command(keys), "help" => {
|
59
|
-
"_reply" => normalize_command(keys) - skip
|
60
|
-
}
|
61
|
-
end
|
62
|
-
|
63
|
-
# --
|
64
|
-
|
65
|
-
def add_opts(out, const)
|
66
|
-
const.all_commands.each do |key, val, command = normalize_command(key)|
|
67
|
-
val.options.map do |_, opt|
|
68
|
-
out[command] ||= { "_reply" => [] }
|
69
|
-
ary = out[command][
|
70
|
-
"_reply"
|
71
|
-
]
|
72
|
-
|
73
|
-
if !opt.boolean?
|
74
|
-
ary << "#{
|
75
|
-
opt.switch_name
|
76
|
-
}="
|
77
|
-
|
78
|
-
else
|
79
|
-
ary << opt.switch_name
|
80
|
-
ary << "--no-#{opt.switch_name.gsub(
|
81
|
-
/\A--/, ""
|
82
|
-
)}"
|
83
|
-
end
|
84
|
-
|
85
|
-
ary | opt.aliases
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
out
|
90
|
-
end
|
91
|
-
|
92
|
-
# --
|
93
|
-
# Recursively pulls out and set's up your commands and opts.
|
94
|
-
# --
|
95
|
-
def get_commands(const = Docker::Template::CLI)
|
96
|
-
out = base(
|
97
|
-
const
|
98
|
-
)
|
99
|
-
|
100
|
-
const.subcommands.each do |key, command = normalize_command(key)|
|
101
|
-
const_list = const.to_namespace.push(command.to_namespace)
|
102
|
-
out[command] = send(__method__, Thor::Namespace.resolv(
|
103
|
-
const_list
|
104
|
-
))
|
105
|
-
end
|
106
|
-
|
107
|
-
add_opts(
|
108
|
-
out, const
|
109
|
-
)
|
110
|
-
end
|
111
|
-
|
112
|
-
# --
|
113
|
-
|
114
|
-
def pak_file
|
115
|
-
Pathutil.new("comp/list.pak").expand_path.tap(
|
116
|
-
&:touch
|
117
|
-
)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
# --
|
122
|
-
|
123
|
-
namespace :update do
|
124
|
-
desc "Update the completion list."
|
125
|
-
task "comp-list" do
|
126
|
-
require "msgpack"
|
127
|
-
require "docker/template"
|
128
|
-
CompList.update
|
129
|
-
end
|
7
|
+
task default: [:spec]
|
8
|
+
task(:spec) { exec "script/test" }
|
9
|
+
task(:test) { exec "script/test" }
|
10
|
+
Dir.glob("script/rake.d/*.rake").each do |v|
|
11
|
+
load v
|
130
12
|
end
|
data/lib/docker/template.rb
CHANGED
@@ -35,7 +35,7 @@ module Docker
|
|
35
35
|
|
36
36
|
def root
|
37
37
|
@root ||= begin
|
38
|
-
Pathutil.new(Dir.pwd)
|
38
|
+
Pathutil.new(Dir.pwd).realpath
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -78,26 +78,22 @@ module Docker
|
|
78
78
|
def _require(what)
|
79
79
|
require what
|
80
80
|
if block_given?
|
81
|
-
yield
|
81
|
+
yield true
|
82
82
|
end
|
83
|
-
|
84
83
|
rescue LoadError
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
if block_given?
|
85
|
+
yield false
|
86
|
+
end
|
88
87
|
end
|
89
88
|
|
90
89
|
# --
|
91
90
|
|
92
91
|
def tmpdir
|
93
92
|
if ENV["DOCKER_TEMPLATE_TMPDIR"]
|
94
|
-
|
95
|
-
|
96
|
-
&:mkdir_p
|
97
|
-
)
|
93
|
+
dir = Pathutil.new(ENV["DOCKER_TEMPLATE_TMPDIR"])
|
94
|
+
.tap(&:mkdir_p)
|
98
95
|
else
|
99
96
|
dir = root.join("tmp")
|
100
|
-
|
101
97
|
if !dir.exist?
|
102
98
|
# Make the directory and then throw it out at exit.
|
103
99
|
dir.mkdir_p; ObjectSpace.define_finalizer(dir, proc do
|
@@ -107,6 +103,8 @@ module Docker
|
|
107
103
|
|
108
104
|
dir
|
109
105
|
end
|
106
|
+
|
107
|
+
dir.realpath
|
110
108
|
end
|
111
109
|
end
|
112
110
|
end
|
data/lib/docker/template/repo.rb
CHANGED
@@ -143,10 +143,9 @@ module Docker
|
|
143
143
|
# --
|
144
144
|
|
145
145
|
def tmpdir(*args, root: Template.tmpdir)
|
146
|
-
args.unshift(user, name, tag)
|
147
|
-
Pathutil.tmpdir(
|
148
|
-
|
149
|
-
)
|
146
|
+
args.unshift(user.gsub(/[^A-Za-z0-9_\-]+/, "--"), name, tag)
|
147
|
+
out = Pathutil.tmpdir(args, nil, root)
|
148
|
+
out.realpath
|
150
149
|
end
|
151
150
|
|
152
151
|
# --
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -114,20 +114,6 @@ dependencies:
|
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '1.8'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: rugged
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 0.25.1
|
124
|
-
type: :runtime
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 0.25.1
|
131
117
|
description: Build and template awesome Docker images a variety of ways.
|
132
118
|
email:
|
133
119
|
- jordon@envygeeks.io
|
@@ -187,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
173
|
version: '0'
|
188
174
|
requirements: []
|
189
175
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.7.
|
176
|
+
rubygems_version: 2.7.7
|
191
177
|
signing_key:
|
192
178
|
specification_version: 4
|
193
179
|
summary: Build and template Docker images a variety of ways.
|