Class: DaggerRuby::Directory
Instance Attribute Summary
Attributes inherited from DaggerObject
#client, #query_builder
Class Method Summary
collapse
Instance Method Summary
collapse
#chain_operation, #id, #initialize
Class Method Details
.from_id(id, client) ⇒ Object
7
8
9
10
11
|
# File 'lib/dagger_ruby/directory.rb', line 7
def self.from_id(id, client)
query = QueryBuilder.new("directory")
query.load_from_id(id)
new(query, client)
end
|
.load_from_host(path, opts = {}, client) ⇒ Object
132
133
134
135
136
137
138
139
140
|
# File 'lib/dagger_ruby/directory.rb', line 132
def self.load_from_host(path, opts = {}, client)
args = { "path" => path }
args["exclude"] = opts[:exclude] if opts[:exclude]
args["include"] = opts[:include] if opts[:include]
host_query = QueryBuilder.new("host")
host_dir_query = host_query.chain_operation("directory", args)
Directory.new(host_dir_query, client)
end
|
.root_field_name ⇒ Object
13
14
15
|
# File 'lib/dagger_ruby/directory.rb', line 13
def self.root_field_name
"directory"
end
|
Instance Method Details
#as_tarball(opts = {}) ⇒ Object
71
72
73
74
75
76
|
# File 'lib/dagger_ruby/directory.rb', line 71
def as_tarball(opts = {})
args = {}
args["forcedCompression"] = opts[:forced_compression] if opts[:forced_compression]
get_object("asTarball", File, args)
end
|
#diff(other) ⇒ Object
54
55
56
|
# File 'lib/dagger_ruby/directory.rb', line 54
def diff(other)
chain_operation("diff", { "other" => other.is_a?(DaggerObject) ? other.id : other })
end
|
#directory(path) ⇒ Object
67
68
69
|
# File 'lib/dagger_ruby/directory.rb', line 67
def directory(path)
get_object("directory", Directory, { "path" => path })
end
|
#docker_build(opts = {}) ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/dagger_ruby/directory.rb', line 99
def docker_build(opts = {})
args = {}
args["dockerfile"] = opts[:dockerfile] if opts[:dockerfile]
args["platform"] = opts[:platform] if opts[:platform]
args["buildArgs"] = opts[:build_args] if opts[:build_args]
args["target"] = opts[:target] if opts[:target]
args["secrets"] = opts[:secrets].map { |s| s.is_a?(DaggerObject) ? s.id : s } if opts[:secrets]
args["noInit"] = opts[:no_init] if opts.key?(:no_init)
require_relative "container" unless defined?(Container)
get_object("dockerBuild", Container, args)
end
|
#entries(path = ".") ⇒ Object
87
88
89
90
91
|
# File 'lib/dagger_ruby/directory.rb', line 87
def entries(path = ".")
query = @query_builder.build_query_with_selection("entries(path: \"#{path}\")")
result = @client.execute(query)
(result, "entries")
end
|
#export(path, opts = {}) ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/dagger_ruby/directory.rb', line 78
def export(path, opts = {})
args = { "path" => path }
args["allowParentDirPath"] = opts[:allow_parent_dir_path] if opts.key?(:allow_parent_dir_path)
query = @query_builder.build_query_with_selection("export(#{format_arguments(args)})")
result = @client.execute(query)
(result, "export")
end
|
#file(path) ⇒ Object
63
64
65
|
# File 'lib/dagger_ruby/directory.rb', line 63
def file(path)
get_object("file", File, { "path" => path })
end
|
#glob(pattern) ⇒ Object
93
94
95
96
97
|
# File 'lib/dagger_ruby/directory.rb', line 93
def glob(pattern)
query = @query_builder.build_query_with_selection("glob(pattern: \"#{pattern}\")")
result = @client.execute(query)
(result, "glob")
end
|
#sync ⇒ Object
58
59
60
61
|
# File 'lib/dagger_ruby/directory.rb', line 58
def sync
get_scalar("id")
self
end
|
#terminal(opts = {}) ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/dagger_ruby/directory.rb', line 112
def terminal(opts = {})
args = {}
if opts[:container]
args["container"] =
opts[:container].is_a?(DaggerObject) ? opts[:container].id : opts[:container]
end
args["cmd"] = opts[:cmd] if opts[:cmd]
if opts.key?(:experimental_privileged_nesting)
args["experimentalPrivilegedNesting"] =
opts[:experimental_privileged_nesting]
end
args["insecureRootCapabilities"] = opts[:insecure_root_capabilities] if opts.key?(:insecure_root_capabilities)
if args.empty?
chain_operation("terminal")
else
chain_operation("terminal", args)
end
end
|
#with_directory(path, directory, opts = {}) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/dagger_ruby/directory.rb', line 31
def with_directory(path, directory, opts = {})
args = { "path" => path, "source" => directory.is_a?(DaggerObject) ? directory.id : directory }
args["exclude"] = opts[:exclude] if opts[:exclude]
args["include"] = opts[:include] if opts[:include]
chain_operation("withDirectory", args)
end
|
#with_file(path, source, opts = {}) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/dagger_ruby/directory.rb', line 17
def with_file(path, source, opts = {})
args = { "path" => path, "source" => source.is_a?(DaggerObject) ? source.id : source }
args["permissions"] = opts[:permissions] if opts[:permissions]
chain_operation("withFile", args)
end
|
#with_new_directory(path, opts = {}) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/dagger_ruby/directory.rb', line 39
def with_new_directory(path, opts = {})
args = { "path" => path }
args["permissions"] = opts[:permissions] if opts[:permissions]
chain_operation("withNewDirectory", args)
end
|
#with_new_file(path, contents, opts = {}) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/dagger_ruby/directory.rb', line 24
def with_new_file(path, contents, opts = {})
args = { "path" => path, "contents" => contents }
args["permissions"] = opts[:permissions] if opts[:permissions]
chain_operation("withNewFile", args)
end
|
#without_directory(path) ⇒ Object
50
51
52
|
# File 'lib/dagger_ruby/directory.rb', line 50
def without_directory(path)
chain_operation("withoutDirectory", { "path" => path })
end
|
#without_file(path) ⇒ Object
46
47
48
|
# File 'lib/dagger_ruby/directory.rb', line 46
def without_file(path)
chain_operation("withoutFile", { "path" => path })
end
|