dply 0.2.19 → 0.3.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 +5 -5
- data/.rspec +4 -0
- data/Rakefile +0 -14
- data/TODO +0 -1
- data/code_dump/old_remote_task.rb +2 -0
- data/{dev_bin → dev_exe}/dplyr +0 -0
- data/{dev_bin → dev_exe}/drake +1 -1
- data/dply.gemspec +2 -2
- data/{bin → exe}/dplyr +0 -0
- data/{bin → exe}/drake +12 -14
- data/lib/dply/TEST_TODO +50 -0
- data/lib/dply/app_config.rb +108 -0
- data/lib/dply/base_config.rb +110 -0
- data/lib/dply/build.rb +17 -11
- data/lib/dply/build_config.rb +28 -96
- data/lib/dply/bundle.rb +7 -30
- data/lib/dply/cli/build.rb +5 -12
- data/lib/dply/cli/ctl.rb +7 -8
- data/lib/dply/cli/deploy.rb +6 -10
- data/lib/dply/cli/devbuild.rb +6 -10
- data/lib/dply/cli/install_pkgs.rb +2 -3
- data/lib/dply/cli/run.rb +27 -0
- data/lib/dply/cli/status.rb +1 -2
- data/lib/dply/cli/task.rb +6 -12
- data/lib/dply/code_archive.rb +123 -0
- data/lib/dply/command.rb +57 -0
- data/lib/dply/config_downloader.rb +3 -2
- data/lib/dply/curl.rb +1 -5
- data/lib/dply/custom_logger.rb +18 -1
- data/lib/dply/deplist.rb +16 -48
- data/lib/dply/deploy_config.rb +34 -0
- data/lib/dply/elf.rb +60 -0
- data/lib/dply/env.rb +9 -0
- data/lib/dply/git.rb +15 -8
- data/lib/dply/helper.rb +21 -33
- data/lib/dply/linker.rb +27 -27
- data/lib/dply/lock.rb +2 -9
- data/lib/dply/logger.rb +1 -1
- data/lib/dply/pkgs.rb +9 -11
- data/lib/dply/release.rb +2 -2
- data/lib/dply/{archive.rb → remote_archive.rb} +1 -1
- data/lib/dply/repo.rb +3 -3
- data/lib/dply/rpm.rb +12 -20
- data/lib/dply/scripts/depcheck.rb +4 -0
- data/lib/dply/shared_dirs.rb +1 -1
- data/lib/dply/strategy/archive.rb +15 -22
- data/lib/dply/strategy/base.rb +82 -0
- data/lib/dply/strategy/git.rb +18 -19
- data/lib/dply/task_dsl.rb +101 -0
- data/lib/dply/util.rb +75 -0
- data/lib/dply/venv.rb +53 -0
- data/lib/dply/version.rb +1 -1
- data/lib/dply/yum.rb +21 -31
- data/lib/dplyr/consul.rb +1 -1
- data/spec/dply/base_config_spec.rb +178 -0
- data/spec/dply/bundle_spec.rb +100 -0
- data/spec/dply/command_spec.rb +190 -0
- data/spec/dply/curl_spec.rb +41 -0
- data/spec/dply/deplist_spec.rb +48 -0
- data/spec/dply/elf_spec.rb +64 -0
- data/spec/dply/env_spec.rb +57 -0
- data/spec/dply/git_spec.rb +136 -0
- data/spec/dply/helper_spec.rb +168 -0
- data/spec/dply/linker_spec.rb +81 -0
- data/spec/dply/lock_spec.rb +24 -0
- data/spec/dply/pkgs_spec.rb +105 -0
- data/spec/dply/repo_spec.rb +58 -0
- data/spec/dply/rpm_spec.rb +32 -0
- data/spec/dply/yum_spec.rb +29 -0
- data/spec/integration/archive_flow_spec.rb +87 -0
- data/spec/integration/git_flow_spec.rb +63 -0
- data/spec/repo.rb +27 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/test_data/build.tar.gz +0 -0
- data/spec/test_data/build.tar.gz.md5 +1 -0
- data/spec/test_data/bundle/gems_installed/Gemfile +1 -0
- data/spec/test_data/bundle/gems_not_installed/Gemfile +2 -0
- data/spec/test_data/bundle/no_gemfile/.gitkeep +0 -0
- data/spec/test_data/command/test.rb +7 -0
- data/spec/test_data/elf/elf +0 -0
- data/spec/test_data/elf/libpgtypes.so.3 +0 -0
- data/spec/test_data/elf/not_elf +1 -0
- data/spec/test_data/sample_repo/.dply.lock +0 -0
- data/spec/test_data/sample_repo/Gemfile +2 -0
- data/spec/test_data/sample_repo/Rakefile +3 -0
- data/spec/test_data/sample_repo/app.rb +1 -0
- data/spec/test_data/sample_repo/dply/app.rb +33 -0
- data/spec/test_data/sample_repo/lib/libacl.so.1 +0 -0
- data/spec/test_data/sample_repo/pkgs.yml +2 -0
- data/spec/webserver.rb +21 -0
- metadata +96 -28
- data/lib/dply/cli/app_task.rb +0 -38
- data/lib/dply/config.rb +0 -120
- data/lib/dply/config_struct.rb +0 -52
- data/lib/dply/rakelib/drake.rake +0 -33
- data/lib/dply/tasks.rb +0 -136
data/lib/dply/config_struct.rb
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
require 'dply/jenkins'
|
|
2
|
-
module Dply
|
|
3
|
-
class ConfigStruct
|
|
4
|
-
|
|
5
|
-
attr_writer :revision, :build_url, :build_url_proc,
|
|
6
|
-
:revision_proc, :latest_revision
|
|
7
|
-
attr_accessor :dir, :name, :repo, :branch, :mirror,
|
|
8
|
-
:strategy, :target, :verify_checksum,
|
|
9
|
-
:config_map, :dir_map, :shared_dirs,
|
|
10
|
-
:config_download_url, :config_skip_download
|
|
11
|
-
|
|
12
|
-
def initialize(dir = nil)
|
|
13
|
-
@dir = dir || Dir.pwd
|
|
14
|
-
@target = nil
|
|
15
|
-
@branch = :master
|
|
16
|
-
@verify_checksum = true
|
|
17
|
-
@shared_dirs = []
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def revision
|
|
21
|
-
if @revision == "latest"
|
|
22
|
-
@revision = instance_eval(&latest_revision)
|
|
23
|
-
else
|
|
24
|
-
@revision
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def build_url
|
|
29
|
-
@build_url ||= instance_eval(&build_url_proc)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def build_url_proc
|
|
33
|
-
@build_url_proc ||= Proc.new do
|
|
34
|
-
"#{repo}/artifacts/#{name}/#{revision}/#{name}-#{revision}-#{branch.to_s.tr("/","_")}.tar.gz"
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def dir_map
|
|
39
|
-
@dir_map ||= {
|
|
40
|
-
"tmp" => "tmp",
|
|
41
|
-
"log" => "log"
|
|
42
|
-
}
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def latest_revision
|
|
46
|
-
@latest_revision ||= Proc.new do
|
|
47
|
-
Jenkins.new(@repo, @name).latest_successful_revision
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
end
|
|
52
|
-
end
|
data/lib/dply/rakelib/drake.rake
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require_relative '../ext/string'
|
|
2
|
-
|
|
3
|
-
def load_app_rakefile
|
|
4
|
-
@app_rakefile_loaded ||= begin
|
|
5
|
-
load './Rakefile'
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
namespace :drake do
|
|
10
|
-
desc "task runner to optionally invoke tasks"
|
|
11
|
-
task :runner do
|
|
12
|
-
runner_tasks = ENV["runner_tasks"] || ""
|
|
13
|
-
optional = ENV["runner_optional"]
|
|
14
|
-
app_task = ENV["runner_app_task"]
|
|
15
|
-
|
|
16
|
-
load_app_rakefile if app_task
|
|
17
|
-
tasks = runner_tasks.split(',')
|
|
18
|
-
task = tasks.find { |i| Rake::Task.task_defined? i}
|
|
19
|
-
|
|
20
|
-
if task
|
|
21
|
-
puts "#{"\u2219".bold.yellow} #{task}"
|
|
22
|
-
Rake::Task[task].invoke
|
|
23
|
-
else
|
|
24
|
-
if optional
|
|
25
|
-
puts "#{"WARN".yellow} any of the tasks not found: #{tasks}"
|
|
26
|
-
else
|
|
27
|
-
abort "#{"ERROR".red} any of the required tasks not defined: #{tasks}"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
Dir.glob('dply/*.rake').each { |r| load r}
|
data/lib/dply/tasks.rb
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
require 'dply/helper'
|
|
3
|
-
require 'dply/bundle'
|
|
4
|
-
require 'dply/linker'
|
|
5
|
-
require 'dply/pkgs'
|
|
6
|
-
require 'etc'
|
|
7
|
-
|
|
8
|
-
module Dply
|
|
9
|
-
class Tasks
|
|
10
|
-
|
|
11
|
-
include Helper
|
|
12
|
-
|
|
13
|
-
def test(target, optional: false)
|
|
14
|
-
bundle.install
|
|
15
|
-
rake_runner "app:test:#{target}", optional: optional
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def build(task)
|
|
19
|
-
fallback_task = "build:default"
|
|
20
|
-
bundle.install
|
|
21
|
-
bundle.clean
|
|
22
|
-
rake_runner task, fallback_task
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def deploy(target)
|
|
26
|
-
fallback_task = "production:deploy"
|
|
27
|
-
task = "app:deploy:#{target}"
|
|
28
|
-
bundle.install
|
|
29
|
-
rake_runner task, fallback_task
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def reload
|
|
33
|
-
fallback_task = "production:reload"
|
|
34
|
-
task = "app:reload"
|
|
35
|
-
bundle.install
|
|
36
|
-
rake_runner task, fallback_task
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def reopen_logs
|
|
40
|
-
fallback_task = "production:reopen_logs"
|
|
41
|
-
task = "app:reopen_logs"
|
|
42
|
-
rake_runner task, fallback_task
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def stop
|
|
46
|
-
bundle.install
|
|
47
|
-
rake_runner "app:stop"
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def app_task(task)
|
|
51
|
-
bundle.install
|
|
52
|
-
rake_runner task, app_task: true
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def task(task)
|
|
56
|
-
bundle.install
|
|
57
|
-
rake_runner task
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def rake(task)
|
|
61
|
-
rake_runner task
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def report_changes(previous_version, current_version)
|
|
65
|
-
info = {}
|
|
66
|
-
info[:current] = current_version
|
|
67
|
-
info[:previous] = previous_version
|
|
68
|
-
logger.remote "#{previous_version} => #{current_version}"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def install_pkgs(build_mode: false, use_yum: false)
|
|
72
|
-
return if not File.exists? "pkgs.yml"
|
|
73
|
-
return if pkgs.installed?(build_mode: build_mode)
|
|
74
|
-
drake_exists = File.exists? (drake_command)
|
|
75
|
-
|
|
76
|
-
if use_yum || !drake_exists
|
|
77
|
-
pkgs.install(build_mode: build_mode, sudo: true)
|
|
78
|
-
else
|
|
79
|
-
command_install build_mode
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def link(source, map)
|
|
84
|
-
return if not map
|
|
85
|
-
logger.bullet "symlinking #{source}"
|
|
86
|
-
dest = Dir.pwd
|
|
87
|
-
linker = Linker.new(source, dest, map: map)
|
|
88
|
-
linker.create_symlinks
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
private
|
|
92
|
-
|
|
93
|
-
def rake_runner(*tasks, optional: false, app_task: false)
|
|
94
|
-
runner_tasks = tasks.map(&:strip).join(",")
|
|
95
|
-
s = "drake:runner runner_tasks=#{runner_tasks}"
|
|
96
|
-
s << " runner_optional=true" if optional
|
|
97
|
-
s << " runner_app_task=true" if app_task
|
|
98
|
-
bundle.rake s
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def bundle
|
|
102
|
-
@bundle ||= Bundle.new
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def pkgs
|
|
106
|
-
@pkgs ||= Pkgs.new
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
def command_install(build_mode)
|
|
110
|
-
command = "#{drake_command} install-pkgs"
|
|
111
|
-
command << " -b" if build_mode
|
|
112
|
-
check_sudo_permission command
|
|
113
|
-
cmd "sudo -n #{command}"
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def drake_command
|
|
117
|
-
@drake_command ||= (ENV["DRAKE_COMMAND"] || "/opt/ruby/bin/drake")
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def check_sudo_permission(command)
|
|
121
|
-
output = `sudo -n -l #{command}`
|
|
122
|
-
if output.chomp.strip == command
|
|
123
|
-
return true
|
|
124
|
-
else
|
|
125
|
-
msg = []
|
|
126
|
-
user = Etc.getpwuid(Process.uid).name
|
|
127
|
-
msg << %{unable to run "#{command}" with sudo permissions}
|
|
128
|
-
msg << %{To resolve add the following line to sudoers: }
|
|
129
|
-
msg << %{#{user} ALL=(ALL) NOPASSWD: /opt/ruby/bin/drake install-pkgs *, /opt/ruby/bin/drake install-pkgs}.yellow
|
|
130
|
-
raise Error, msg.join("\n")
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
end
|
|
136
|
-
end
|