dply 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/drake +7 -3
- data/dply.gemspec +1 -1
- data/lib/dply/bundle.rb +6 -7
- data/lib/dply/cli/{reload.rb → app_task.rb} +10 -7
- data/lib/dply/cli/ctl.rb +40 -0
- data/lib/dply/helper.rb +11 -5
- data/lib/dply/rakelib/drake.rake +33 -0
- data/lib/dply/rpm.rb +2 -2
- data/lib/dply/strategy/archive.rb +2 -11
- data/lib/dply/strategy/git.rb +2 -2
- data/lib/dply/tasks.rb +35 -10
- data/lib/dply/version.rb +1 -1
- metadata +8 -7
- data/lib/dply/cli/reopen_logs.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c60a81b81642343a48a22ff3931e504c51dd3ec1
|
4
|
+
data.tar.gz: f679ecc74ae8843de5fb1e6f6fd17a4dd3abef71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e61c97e9aac65f8f97e392bd145205f1e922b0b6cd7e21f8b74854ea154e02557b542c55b6949d54cb22133f2d115f3884455fb1dfae43a295481f30b65b0cc3
|
7
|
+
data.tar.gz: 58dd1abb7a93aa5cbb948d0a2599f215481a4cf03690da4448f3b21d2b67bfffa0bdce9a95a95db4ddebb85936e7ac0fdcb4d794407b24a0d9806b7f0a50e485
|
data/bin/drake
CHANGED
@@ -73,13 +73,17 @@ begin
|
|
73
73
|
|
74
74
|
command = (ARGV.shift || "").to_sym
|
75
75
|
case command
|
76
|
-
when :deploy, :
|
77
|
-
:build, :depcheck, :"install-pkgs",
|
76
|
+
when :deploy, :task, :app_task,
|
77
|
+
:build, :depcheck, :"install-pkgs",
|
78
78
|
:status, :devbuild, :setup
|
79
79
|
run_cli command, ARGV
|
80
|
+
when :reload, :stop, :start, :reopen_logs
|
81
|
+
require 'dply/cli/ctl'
|
82
|
+
ctl = Dply::Cli::Ctl.new
|
83
|
+
ctl.run command
|
80
84
|
when /\A[a-zA-Z_\-0-9]+[:][a-zA-Z_\-0-9]+\z/
|
81
85
|
require 'dply/tasks'
|
82
|
-
::Dply::Tasks.new.rake command
|
86
|
+
::Dply::Tasks.new.rake command.to_s
|
83
87
|
when :''
|
84
88
|
puts opts_parser
|
85
89
|
else
|
data/dply.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
spec.add_dependency "ruby-elf", "~> 1.0"
|
20
|
-
spec.add_dependency "ruby-filemagic", "~> 0.
|
20
|
+
spec.add_dependency "ruby-filemagic", "~> 0.7"
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.6"
|
23
23
|
spec.add_development_dependency "rake"
|
data/lib/dply/bundle.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'dply/helper'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'yaml'
|
4
|
+
require 'shellwords'
|
4
5
|
|
5
6
|
module Dply
|
6
7
|
class Bundle
|
@@ -13,12 +14,11 @@ module Dply
|
|
13
14
|
cmd "bundle install -j5 --deployment"
|
14
15
|
end
|
15
16
|
|
16
|
-
def rake(task
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
17
|
+
def rake(task)
|
18
|
+
rakelib = Shellwords.shellescape "#{__dir__}/rakelib"
|
19
|
+
rake_cmd = %(rake -R #{rakelib} -Nf dply/Rakefile #{task})
|
20
|
+
command = gemfile_exists? ? "bundle exec #{rake_cmd}" : rake_cmd
|
21
|
+
cmd command, env: env, display: false
|
22
22
|
end
|
23
23
|
|
24
24
|
def clean
|
@@ -39,7 +39,6 @@ module Dply
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
42
|
def check
|
44
43
|
system "bundle check > /dev/null"
|
45
44
|
end
|
@@ -1,25 +1,28 @@
|
|
1
|
-
require 'dply/
|
1
|
+
require 'dply/helper'
|
2
2
|
require 'dply/lock'
|
3
|
-
require 'dply/
|
3
|
+
require 'dply/tasks'
|
4
4
|
require 'dply/config'
|
5
5
|
|
6
6
|
module Dply
|
7
7
|
module Cli
|
8
|
-
class
|
8
|
+
class AppTask
|
9
9
|
|
10
|
-
include
|
10
|
+
include Helper
|
11
11
|
|
12
12
|
def initialize(argv)
|
13
13
|
@argv = argv
|
14
14
|
end
|
15
15
|
|
16
16
|
def run
|
17
|
+
task_name = @argv.shift
|
18
|
+
error "task name not specified" if not task_name
|
19
|
+
config
|
17
20
|
lock.acquire
|
18
|
-
|
21
|
+
Dir.chdir("current") { tasks.app_task task_name }
|
19
22
|
end
|
20
23
|
|
21
|
-
def
|
22
|
-
@
|
24
|
+
def tasks
|
25
|
+
@tasks ||= ::Dply::Tasks.new
|
23
26
|
end
|
24
27
|
|
25
28
|
def config
|
data/lib/dply/cli/ctl.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'dply/lock'
|
2
|
+
require 'dply/strategy'
|
3
|
+
require 'dply/config'
|
4
|
+
require 'dply/tasks'
|
5
|
+
|
6
|
+
module Dply
|
7
|
+
module Cli
|
8
|
+
class Ctl
|
9
|
+
|
10
|
+
def run(command)
|
11
|
+
case command
|
12
|
+
when :start, :stop, :reopen_logs
|
13
|
+
config
|
14
|
+
lock.acquire
|
15
|
+
Dir.chdir("current") { tasks.send command.to_sym }
|
16
|
+
when :reload
|
17
|
+
lock.acquire
|
18
|
+
strategy.reload
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def strategy
|
23
|
+
@strategy ||= Strategy.load(config, {})
|
24
|
+
end
|
25
|
+
|
26
|
+
def config
|
27
|
+
@config ||= Config.new.to_struct
|
28
|
+
end
|
29
|
+
|
30
|
+
def lock
|
31
|
+
@lock ||= Lock.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def tasks
|
35
|
+
@tasks ||= ::Dply::Tasks.new
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/dply/helper.rb
CHANGED
@@ -7,22 +7,28 @@ module Dply
|
|
7
7
|
module Helper
|
8
8
|
|
9
9
|
def cmd(command, display: true, error_msg: nil, return_output: false, env:{}, shell: false)
|
10
|
+
if command.is_a? Array
|
11
|
+
command_arr = command
|
12
|
+
command_str = command.join(" ")
|
13
|
+
else
|
14
|
+
command_arr = %W(#{command})
|
15
|
+
command_str = command
|
16
|
+
end
|
10
17
|
stringify_values!(env)
|
11
18
|
if display
|
12
|
-
logger.bullet
|
19
|
+
logger.bullet command_str
|
13
20
|
else
|
14
|
-
logger.debug
|
21
|
+
logger.debug command_str
|
15
22
|
end
|
16
|
-
command_arr = command.split
|
17
|
-
run_command = shell ? command : command_arr
|
18
23
|
|
24
|
+
run_command = shell ? command_str : command_arr
|
19
25
|
output = if return_output
|
20
26
|
IO.popen(env, run_command) { |f| f.read }
|
21
27
|
else
|
22
28
|
system(env, *run_command, 2 => 1)
|
23
29
|
end
|
24
30
|
return_value = $?.exitstatus
|
25
|
-
error_msg ||= "non zero exit for \"#{
|
31
|
+
error_msg ||= "non zero exit for \"#{command_str}\""
|
26
32
|
error error_msg if return_value != 0
|
27
33
|
return output
|
28
34
|
end
|
@@ -0,0 +1,33 @@
|
|
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/rpm.rb
CHANGED
@@ -22,8 +22,8 @@ module Dply
|
|
22
22
|
|
23
23
|
def whatprovides(lib)
|
24
24
|
lib = "#{lib}()(64bit)"
|
25
|
-
command =
|
26
|
-
output = cmd command, return_output: true,
|
25
|
+
command = ["rpm", "--queryformat", "%{NAME} ", "-q", "--whatprovides", lib]
|
26
|
+
output = cmd command, return_output: true, display: false
|
27
27
|
list = output.strip.split.select {|pkg| not filtered? pkg }
|
28
28
|
end
|
29
29
|
|
@@ -40,7 +40,7 @@ module Dply
|
|
40
40
|
previous_version = get_release
|
41
41
|
release.make_current
|
42
42
|
Dir.chdir current_dir do
|
43
|
-
tasks.deploy
|
43
|
+
tasks.deploy :archive
|
44
44
|
end
|
45
45
|
release.record_deployment
|
46
46
|
current_version = get_release
|
@@ -52,7 +52,7 @@ module Dply
|
|
52
52
|
download_configs if config_download_url
|
53
53
|
Dir.chdir current_dir do
|
54
54
|
link_all
|
55
|
-
tasks.reload
|
55
|
+
tasks.reload
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -100,15 +100,6 @@ module Dply
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
def git_step
|
104
|
-
return if options[:skip_git]
|
105
|
-
if options[:no_pull]
|
106
|
-
git.checkout branch
|
107
|
-
else
|
108
|
-
git.pull branch
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
103
|
def link_all
|
113
104
|
tasks.link "#{config.dir}/shared", dir_map
|
114
105
|
tasks.link "#{config.dir}/config", config_map
|
data/lib/dply/strategy/git.rb
CHANGED
@@ -32,7 +32,7 @@ module Dply
|
|
32
32
|
current_version = git.commit_id
|
33
33
|
link_all
|
34
34
|
install_pkgs
|
35
|
-
tasks.deploy
|
35
|
+
tasks.deploy :git
|
36
36
|
tasks.report_changes(previous_version, current_version)
|
37
37
|
end
|
38
38
|
end
|
@@ -41,7 +41,7 @@ module Dply
|
|
41
41
|
download_configs if config_download_url
|
42
42
|
Dir.chdir current_dir do
|
43
43
|
link_all
|
44
|
-
tasks.reload
|
44
|
+
tasks.reload
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
data/lib/dply/tasks.rb
CHANGED
@@ -10,29 +10,46 @@ module Dply
|
|
10
10
|
|
11
11
|
include Helper
|
12
12
|
|
13
|
-
def
|
13
|
+
def test(target, optional: false)
|
14
14
|
bundle.install
|
15
|
-
|
15
|
+
rake_runner "app:test:#{target}", optional: optional
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def build(target)
|
19
|
+
task = target ? "app:build:#{target}" : "app:build"
|
19
20
|
bundle.install
|
20
|
-
|
21
|
+
bundle.clean
|
22
|
+
rake_runner task
|
21
23
|
end
|
22
24
|
|
23
|
-
def
|
25
|
+
def deploy(strategy, target: nil)
|
26
|
+
task = target ? "app:deploy:#{target}" : "app:deploy:#{strategy}"
|
24
27
|
bundle.install
|
25
|
-
|
28
|
+
rake_runner task
|
26
29
|
end
|
27
30
|
|
28
|
-
def
|
31
|
+
def reload
|
29
32
|
bundle.install
|
30
|
-
|
31
|
-
|
33
|
+
rake_runner "app:reload"
|
34
|
+
end
|
35
|
+
|
36
|
+
def stop
|
37
|
+
bundle.install
|
38
|
+
rake_runner "app:stop"
|
39
|
+
end
|
40
|
+
|
41
|
+
def app_task(task)
|
42
|
+
bundle.install
|
43
|
+
rake_runner task, app_task: true
|
44
|
+
end
|
45
|
+
|
46
|
+
def task(task)
|
47
|
+
bundle.install
|
48
|
+
rake_runner task
|
32
49
|
end
|
33
50
|
|
34
51
|
def rake(task)
|
35
|
-
|
52
|
+
rake_runner task
|
36
53
|
end
|
37
54
|
|
38
55
|
def report_changes(previous_version, current_version)
|
@@ -64,6 +81,14 @@ module Dply
|
|
64
81
|
|
65
82
|
private
|
66
83
|
|
84
|
+
def rake_runner(*tasks, optional: false, app_task: false)
|
85
|
+
runner_tasks = tasks.map(&:strip).join(",")
|
86
|
+
s = "drake:runner runner_tasks=#{runner_tasks}"
|
87
|
+
s << " runner_optional=true" if optional
|
88
|
+
s << " runner_app_task=true" if app_task
|
89
|
+
bundle.rake s
|
90
|
+
end
|
91
|
+
|
67
92
|
def bundle
|
68
93
|
@bundle ||= Bundle.new
|
69
94
|
end
|
data/lib/dply/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neeraj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-elf
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.7'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,13 +95,13 @@ files:
|
|
95
95
|
- lib/dply/build.rb
|
96
96
|
- lib/dply/build_config.rb
|
97
97
|
- lib/dply/bundle.rb
|
98
|
+
- lib/dply/cli/app_task.rb
|
98
99
|
- lib/dply/cli/build.rb
|
100
|
+
- lib/dply/cli/ctl.rb
|
99
101
|
- lib/dply/cli/depcheck.rb
|
100
102
|
- lib/dply/cli/deploy.rb
|
101
103
|
- lib/dply/cli/devbuild.rb
|
102
104
|
- lib/dply/cli/install_pkgs.rb
|
103
|
-
- lib/dply/cli/reload.rb
|
104
|
-
- lib/dply/cli/reopen_logs.rb
|
105
105
|
- lib/dply/cli/setup.rb
|
106
106
|
- lib/dply/cli/status.rb
|
107
107
|
- lib/dply/cli/task.rb
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/dply/lock.rb
|
121
121
|
- lib/dply/logger.rb
|
122
122
|
- lib/dply/pkgs.rb
|
123
|
+
- lib/dply/rakelib/drake.rake
|
123
124
|
- lib/dply/release.rb
|
124
125
|
- lib/dply/release_helper.rb
|
125
126
|
- lib/dply/repo.rb
|
@@ -170,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
171
|
version: '0'
|
171
172
|
requirements: []
|
172
173
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
174
|
+
rubygems_version: 2.5.1
|
174
175
|
signing_key:
|
175
176
|
specification_version: 4
|
176
177
|
summary: rake based deploy tool
|
data/lib/dply/cli/reopen_logs.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'dply/logger'
|
2
|
-
require 'dply/lock'
|
3
|
-
require 'dply/strategy'
|
4
|
-
require 'dply/config'
|
5
|
-
|
6
|
-
module Dply
|
7
|
-
module Cli
|
8
|
-
class ReopenLogs
|
9
|
-
|
10
|
-
include Logger
|
11
|
-
|
12
|
-
def initialize(argv)
|
13
|
-
@argv = argv
|
14
|
-
end
|
15
|
-
|
16
|
-
def run
|
17
|
-
lock.acquire
|
18
|
-
strategy.reopen_logs
|
19
|
-
end
|
20
|
-
|
21
|
-
def strategy
|
22
|
-
@strategy ||= Strategy.load(config, {})
|
23
|
-
end
|
24
|
-
|
25
|
-
def config
|
26
|
-
@config ||= Config.new.to_struct
|
27
|
-
end
|
28
|
-
|
29
|
-
def lock
|
30
|
-
@lock ||= Lock.new
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|