Class: Dply::TaskDsl
- Inherits:
-
Object
show all
- Includes:
- Helper
- Defined in:
- lib/dply/task_dsl.rb
Instance Method Summary
collapse
Methods included from Helper
#cmd, #error, #git, #logger, #symlink
Constructor Details
#initialize(app_config) ⇒ TaskDsl
Returns a new instance of TaskDsl.
8
9
10
|
# File 'lib/dply/task_dsl.rb', line 8
def initialize(app_config)
@app_config = app_config
end
|
Instance Method Details
#archive(name, **opts, &block) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/dply/task_dsl.rb', line 35
def archive(name, **opts, &block)
require_relative 'code_archive'
revision = ENV["BUILD_NUMBER"] || "unknown"
archive = CodeArchive.new(name, revision: revision)
archive.build(**opts, &block)
archive.depcheck!
archive.compress!
return archive
end
|
#rake(task, *args) ⇒ Object
30
31
32
33
|
# File 'lib/dply/task_dsl.rb', line 30
def rake(task, *args)
logger.arrow "rake #{task}"
rake_app[task].invoke(*args)
end
|
#render_config ⇒ Object
21
22
23
|
# File 'lib/dply/task_dsl.rb', line 21
def render_config
@app_config.render_config
end
|
#role(*roles, &block) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/dply/task_dsl.rb', line 45
def role(*roles, &block)
roles << :all
if r = roles.find { |r| dply_roles.include? r }
yield r
end
end
|
#role?(*roles) ⇒ Boolean
52
53
54
55
|
# File 'lib/dply/task_dsl.rb', line 52
def role?(*roles)
roles << :all
roles.find { |r| dply_roles.include? r }
end
|
#run(name) ⇒ Object
12
13
14
|
# File 'lib/dply/task_dsl.rb', line 12
def run(name)
@app_config.run_task name
end
|
#set_env(key, value) ⇒ Object
25
26
27
28
|
# File 'lib/dply/task_dsl.rb', line 25
def set_env(key, value)
ENV[key.to_s] = value.to_s
base_env[key.to_s] = value.to_s
end
|
#sh(command, env: {}, bundled_env: false) ⇒ Object
16
17
18
19
|
# File 'lib/dply/task_dsl.rb', line 16
def sh(command, env: {}, bundled_env: false)
= base_env.merge env
super(command, env: , bundled_env: bundled_env, display: :arrow)
end
|
#venv ⇒ Object
57
58
59
60
61
62
|
# File 'lib/dply/task_dsl.rb', line 57
def venv
@venv ||= begin
require_relative 'venv'
Venv.new
end
end
|