Top Level Namespace
Defined Under Namespace
Modules: Local
Classes: Array, ConfigBlockHandler, LocalEntity, LocalFile, RemoteFile, TaskResult, UndefinedOnLocal
Instance Method Summary
collapse
-
#apt_install(names) ⇒ Object
-
#apt_remove(names) ⇒ Object
-
#apt_update ⇒ Object
-
#as(user, group: nil) ⇒ Object
-
#authorize_ssh_key(user:, key:) ⇒ Object
-
#block ⇒ Object
-
#chmod(mode, path) ⇒ Object
-
#command(cmd, expect_status: 0) ⇒ Object
-
#cp(src, dst, mode: nil) ⇒ Object
-
#create_config(path, text) ⇒ Object
-
#create_user(name, create_home:, shell:) ⇒ Object
-
#edit_config(path) {|h| ... } ⇒ Object
-
#ln_s(src, dst) ⇒ Object
-
#local(x) ⇒ Object
-
#local_file(path) ⇒ Object
-
#mkdir_p(x) ⇒ Object
-
#perform! ⇒ Object
-
#remote_file(path) ⇒ Object
-
#service_reload(name) ⇒ Object
-
#service_restart(name) ⇒ Object
-
#target(host:, user: nil, port: nil) ⇒ Object
Instance Method Details
#apt_install(names) ⇒ Object
#apt_remove(names) ⇒ Object
#apt_update ⇒ Object
95
96
|
# File 'lib/local_dsl.rb', line 95
def apt_update
end
|
#as(user, group: nil) ⇒ Object
#authorize_ssh_key(user:, key:) ⇒ Object
#block ⇒ Object
150
151
152
|
# File 'lib/local_dsl.rb', line 150
def block
yield
end
|
#chmod(mode, path) ⇒ Object
#command(cmd, expect_status: 0) ⇒ Object
108
109
110
111
112
|
# File 'lib/local_dsl.rb', line 108
def command(cmd, expect_status: 0)
Local.type_check(nil, cmd, String, Symbol, Array)
Local.type_check(:expect_status, expect_status, Integer, Array, Range)
TaskResult.new
end
|
#cp(src, dst, mode: nil) ⇒ Object
125
126
127
128
129
130
131
132
133
|
# File 'lib/local_dsl.rb', line 125
def cp(src, dst, mode: nil)
Local.type_check(1, src, String, LocalFile)
Local.type_check(1, dst, String)
if mode
Local.type_check(:mode, mode, String, Integer)
Local.check_mode mode
end
TaskResult.new
end
|
#create_config(path, text) ⇒ Object
#create_user(name, create_home:, shell:) ⇒ Object
82
83
84
85
86
87
|
# File 'lib/local_dsl.rb', line 82
def create_user(name, create_home:, shell:)
Local.type_check(nil, name, String, Symbol)
Local.type_check(:create_home, create_home, TrueClass, FalseClass)
Local.type_check(:shell, shell, String)
TaskResult.new
end
|
#edit_config(path) {|h| ... } ⇒ Object
#local(x) ⇒ Object
36
37
38
|
# File 'lib/local_dsl.rb', line 36
def local(x)
LocalEntity.new(x)
end
|
#local_file(path) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/local_dsl.rb', line 19
def local_file(path)
path = File.expand_path(path, File.dirname(ENV["_"]))
Local.die "#{path} doesn't exists" unless File.exist? path
Local.local_files = Local.local_files | [path]
return LocalFile.new(path)
end
|
190
191
192
|
# File 'lib/local_dsl.rb', line 190
def perform!
Local.perform!
end
|
#remote_file(path) ⇒ Object
#service_reload(name) ⇒ Object
74
75
76
|
# File 'lib/local_dsl.rb', line 74
def service_reload(name)
Local.type_check(nil, name, String, Symbol)
end
|
#service_restart(name) ⇒ Object
78
79
80
|
# File 'lib/local_dsl.rb', line 78
def service_restart(name)
Local.type_check(nil, name, String, Symbol)
end
|
#target(host:, user: nil, port: nil) ⇒ Object