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.
Files changed (96) hide show
  1. checksums.yaml +5 -5
  2. data/.rspec +4 -0
  3. data/Rakefile +0 -14
  4. data/TODO +0 -1
  5. data/code_dump/old_remote_task.rb +2 -0
  6. data/{dev_bin → dev_exe}/dplyr +0 -0
  7. data/{dev_bin → dev_exe}/drake +1 -1
  8. data/dply.gemspec +2 -2
  9. data/{bin → exe}/dplyr +0 -0
  10. data/{bin → exe}/drake +12 -14
  11. data/lib/dply/TEST_TODO +50 -0
  12. data/lib/dply/app_config.rb +108 -0
  13. data/lib/dply/base_config.rb +110 -0
  14. data/lib/dply/build.rb +17 -11
  15. data/lib/dply/build_config.rb +28 -96
  16. data/lib/dply/bundle.rb +7 -30
  17. data/lib/dply/cli/build.rb +5 -12
  18. data/lib/dply/cli/ctl.rb +7 -8
  19. data/lib/dply/cli/deploy.rb +6 -10
  20. data/lib/dply/cli/devbuild.rb +6 -10
  21. data/lib/dply/cli/install_pkgs.rb +2 -3
  22. data/lib/dply/cli/run.rb +27 -0
  23. data/lib/dply/cli/status.rb +1 -2
  24. data/lib/dply/cli/task.rb +6 -12
  25. data/lib/dply/code_archive.rb +123 -0
  26. data/lib/dply/command.rb +57 -0
  27. data/lib/dply/config_downloader.rb +3 -2
  28. data/lib/dply/curl.rb +1 -5
  29. data/lib/dply/custom_logger.rb +18 -1
  30. data/lib/dply/deplist.rb +16 -48
  31. data/lib/dply/deploy_config.rb +34 -0
  32. data/lib/dply/elf.rb +60 -0
  33. data/lib/dply/env.rb +9 -0
  34. data/lib/dply/git.rb +15 -8
  35. data/lib/dply/helper.rb +21 -33
  36. data/lib/dply/linker.rb +27 -27
  37. data/lib/dply/lock.rb +2 -9
  38. data/lib/dply/logger.rb +1 -1
  39. data/lib/dply/pkgs.rb +9 -11
  40. data/lib/dply/release.rb +2 -2
  41. data/lib/dply/{archive.rb → remote_archive.rb} +1 -1
  42. data/lib/dply/repo.rb +3 -3
  43. data/lib/dply/rpm.rb +12 -20
  44. data/lib/dply/scripts/depcheck.rb +4 -0
  45. data/lib/dply/shared_dirs.rb +1 -1
  46. data/lib/dply/strategy/archive.rb +15 -22
  47. data/lib/dply/strategy/base.rb +82 -0
  48. data/lib/dply/strategy/git.rb +18 -19
  49. data/lib/dply/task_dsl.rb +101 -0
  50. data/lib/dply/util.rb +75 -0
  51. data/lib/dply/venv.rb +53 -0
  52. data/lib/dply/version.rb +1 -1
  53. data/lib/dply/yum.rb +21 -31
  54. data/lib/dplyr/consul.rb +1 -1
  55. data/spec/dply/base_config_spec.rb +178 -0
  56. data/spec/dply/bundle_spec.rb +100 -0
  57. data/spec/dply/command_spec.rb +190 -0
  58. data/spec/dply/curl_spec.rb +41 -0
  59. data/spec/dply/deplist_spec.rb +48 -0
  60. data/spec/dply/elf_spec.rb +64 -0
  61. data/spec/dply/env_spec.rb +57 -0
  62. data/spec/dply/git_spec.rb +136 -0
  63. data/spec/dply/helper_spec.rb +168 -0
  64. data/spec/dply/linker_spec.rb +81 -0
  65. data/spec/dply/lock_spec.rb +24 -0
  66. data/spec/dply/pkgs_spec.rb +105 -0
  67. data/spec/dply/repo_spec.rb +58 -0
  68. data/spec/dply/rpm_spec.rb +32 -0
  69. data/spec/dply/yum_spec.rb +29 -0
  70. data/spec/integration/archive_flow_spec.rb +87 -0
  71. data/spec/integration/git_flow_spec.rb +63 -0
  72. data/spec/repo.rb +27 -0
  73. data/spec/spec_helper.rb +44 -0
  74. data/spec/test_data/build.tar.gz +0 -0
  75. data/spec/test_data/build.tar.gz.md5 +1 -0
  76. data/spec/test_data/bundle/gems_installed/Gemfile +1 -0
  77. data/spec/test_data/bundle/gems_not_installed/Gemfile +2 -0
  78. data/spec/test_data/bundle/no_gemfile/.gitkeep +0 -0
  79. data/spec/test_data/command/test.rb +7 -0
  80. data/spec/test_data/elf/elf +0 -0
  81. data/spec/test_data/elf/libpgtypes.so.3 +0 -0
  82. data/spec/test_data/elf/not_elf +1 -0
  83. data/spec/test_data/sample_repo/.dply.lock +0 -0
  84. data/spec/test_data/sample_repo/Gemfile +2 -0
  85. data/spec/test_data/sample_repo/Rakefile +3 -0
  86. data/spec/test_data/sample_repo/app.rb +1 -0
  87. data/spec/test_data/sample_repo/dply/app.rb +33 -0
  88. data/spec/test_data/sample_repo/lib/libacl.so.1 +0 -0
  89. data/spec/test_data/sample_repo/pkgs.yml +2 -0
  90. data/spec/webserver.rb +21 -0
  91. metadata +96 -28
  92. data/lib/dply/cli/app_task.rb +0 -38
  93. data/lib/dply/config.rb +0 -120
  94. data/lib/dply/config_struct.rb +0 -52
  95. data/lib/dply/rakelib/drake.rake +0 -33
  96. data/lib/dply/tasks.rb +0 -136
@@ -0,0 +1,27 @@
1
+ module RepoHelper
2
+ def self.system!(command)
3
+ status = system command
4
+ raise "error in '#{command}'" if not status
5
+ end
6
+
7
+ def self.setup_source_repo(repo_dir)
8
+ FileUtils.rm_rf repo_dir
9
+ FileUtils.cp_r "spec/test_data/sample_repo", repo_dir
10
+ Dir.chdir repo_dir do
11
+ script = <<~SCRIPT
12
+ git init
13
+ touch testfile
14
+ git add .
15
+ git commit -m 'initial commit'
16
+ git checkout -b some_branch
17
+ touch some_file
18
+ git add some_file
19
+ git commit -m "add some_file"
20
+ git checkout master
21
+ SCRIPT
22
+ script.each_line { |l| system! "#{l.chomp} > /dev/null 2>&1" }
23
+ end
24
+ end
25
+ end
26
+
27
+ RepoHelper.setup_source_repo "tmp/repo.git"
@@ -0,0 +1,44 @@
1
+ if ENV["ALL_TESTS"]
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ track_files "lib/dply/**/*.rb"
5
+ end
6
+ end
7
+
8
+ RSpec.configure do |config|
9
+ config.exclude_pattern = "**/integration/*_spec.rb" if not ENV["ALL_TESTS"]
10
+ end
11
+
12
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
13
+
14
+ def silence_warnings(&block)
15
+ warn_level = $VERBOSE
16
+ $VERBOSE = nil
17
+ yield
18
+ ensure
19
+ $VERBOSE = warn_level
20
+ end
21
+
22
+ def suppress_output(&block)
23
+ orig_stdout = $stdout.clone
24
+ orig_stderr = $stderr.clone
25
+ $stdout.reopen("/dev/null", "a+")
26
+ $stderr.reopen("/dev/null", "a+")
27
+ yield
28
+ ensure
29
+ $stdout.reopen orig_stdout
30
+ $stderr.reopen orig_stderr
31
+ end
32
+
33
+ def system!(command, quiet: true)
34
+ if quiet
35
+ retval = system command, [:out, :err] => "/dev/null"
36
+ else
37
+ retval = system command
38
+ end
39
+ raise "error in #{command}" if not retval
40
+ end
41
+
42
+ silence_warnings do
43
+ require_relative 'webserver'
44
+ end
@@ -0,0 +1 @@
1
+ 642071a065e730cdb86fa3b6892ff619
@@ -0,0 +1 @@
1
+ source "https://rubygems.org"
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gem "rake"
@@ -0,0 +1,7 @@
1
+ pid = ARGV.shift.to_i
2
+ shell = Process.ppid != pid
3
+ IO.write "env", Marshal.dump(ENV.to_h)
4
+ IO.write "shell", shell
5
+ IO.write "extra_args", Marshal.dump(ARGV)
6
+ STDOUT.print "out"
7
+ STDERR.print "out"
Binary file
@@ -0,0 +1 @@
1
+ text file
File without changes
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gem "rake"
@@ -0,0 +1,3 @@
1
+ task :a do
2
+ puts "rake task"
3
+ end
@@ -0,0 +1 @@
1
+ puts "app"
@@ -0,0 +1,33 @@
1
+ test do
2
+
3
+ end
4
+
5
+ build do
6
+ rake :a
7
+ sh "ls"
8
+ FileUtils.mkdir_p "vendor"
9
+ FileUtils.cp "lib/libacl.so.1", "vendor/"
10
+ archive "test" do
11
+ add_bundle
12
+ add "vendor"
13
+ end
14
+ end
15
+
16
+ deploy :git do
17
+ set_env "MIX_ENV", "prod"
18
+ sh "ls"
19
+ puts " git deployed"
20
+ end
21
+
22
+ deploy :archive do
23
+ rake :a
24
+ puts " archive deployed"
25
+ end
26
+
27
+ reload do
28
+ puts "reloaded"
29
+ end
30
+
31
+ stop do
32
+ puts "stopped"
33
+ end
@@ -0,0 +1,2 @@
1
+ pkgs:
2
+ - libattr
@@ -0,0 +1,21 @@
1
+ require 'webrick'
2
+ class ::WEBrick::BasicLog
3
+ def log(level, data)
4
+ end
5
+ end
6
+ port = 8000
7
+ webserver = Thread.new do
8
+ server = WEBrick::HTTPServer.new(
9
+ :Port => port,
10
+ :DocumentRoot => "#{Dir.pwd}/test/sample_data",
11
+ Logger: WEBrick::Log.new("/dev/null"),
12
+ AccessLog: []
13
+ )
14
+ server.mount "/tmp/", WEBrick::HTTPServlet::FileHandler, "#{Dir.pwd}/tmp/"
15
+ server.start
16
+ end
17
+ puts "staring webserver on port #{port}"
18
+ webserver.run
19
+ #webserver.join
20
+
21
+ at_exit { Thread.kill webserver }
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.19
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neeraj
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-02 00:00:00.000000000 Z
11
+ date: 2018-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-elf
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: ruby-filemagic
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.7'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.7'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,42 +61,48 @@ extensions: []
75
61
  extra_rdoc_files: []
76
62
  files:
77
63
  - ".gitignore"
64
+ - ".rspec"
78
65
  - Gemfile
79
66
  - LICENSE.txt
80
67
  - README.md
81
68
  - Rakefile
82
69
  - TODO
83
- - bin/dplyr
84
- - bin/drake
85
70
  - code_dump/alt_remote_task.rb
86
71
  - code_dump/old_remote_task.rb
87
- - dev_bin/dplyr
88
- - dev_bin/drake
72
+ - dev_exe/dplyr
73
+ - dev_exe/drake
89
74
  - docs/README
90
75
  - docs/dply.rb
91
76
  - docs/stages.rb
92
77
  - dply.gemspec
78
+ - exe/dplyr
79
+ - exe/drake
93
80
  - lib/dply.rb
94
- - lib/dply/archive.rb
81
+ - lib/dply/TEST_TODO
82
+ - lib/dply/app_config.rb
83
+ - lib/dply/base_config.rb
95
84
  - lib/dply/build.rb
96
85
  - lib/dply/build_config.rb
97
86
  - lib/dply/bundle.rb
98
- - lib/dply/cli/app_task.rb
99
87
  - lib/dply/cli/build.rb
100
88
  - lib/dply/cli/ctl.rb
101
89
  - lib/dply/cli/depcheck.rb
102
90
  - lib/dply/cli/deploy.rb
103
91
  - lib/dply/cli/devbuild.rb
104
92
  - lib/dply/cli/install_pkgs.rb
93
+ - lib/dply/cli/run.rb
105
94
  - lib/dply/cli/setup.rb
106
95
  - lib/dply/cli/status.rb
107
96
  - lib/dply/cli/task.rb
108
- - lib/dply/config.rb
97
+ - lib/dply/code_archive.rb
98
+ - lib/dply/command.rb
109
99
  - lib/dply/config_downloader.rb
110
- - lib/dply/config_struct.rb
111
100
  - lib/dply/curl.rb
112
101
  - lib/dply/custom_logger.rb
113
102
  - lib/dply/deplist.rb
103
+ - lib/dply/deploy_config.rb
104
+ - lib/dply/elf.rb
105
+ - lib/dply/env.rb
114
106
  - lib/dply/error.rb
115
107
  - lib/dply/ext/string.rb
116
108
  - lib/dply/git.rb
@@ -120,21 +112,25 @@ files:
120
112
  - lib/dply/lock.rb
121
113
  - lib/dply/logger.rb
122
114
  - lib/dply/pkgs.rb
123
- - lib/dply/rakelib/drake.rake
124
115
  - lib/dply/release.rb
125
116
  - lib/dply/release_helper.rb
117
+ - lib/dply/remote_archive.rb
126
118
  - lib/dply/repo.rb
127
119
  - lib/dply/rpm.rb
120
+ - lib/dply/scripts/depcheck.rb
128
121
  - lib/dply/setup.rb
129
122
  - lib/dply/shared_dirs.rb
130
123
  - lib/dply/strategy.rb
131
124
  - lib/dply/strategy/archive.rb
125
+ - lib/dply/strategy/base.rb
132
126
  - lib/dply/strategy/git.rb
133
- - lib/dply/tasks.rb
127
+ - lib/dply/task_dsl.rb
134
128
  - lib/dply/templates/build.erb
135
129
  - lib/dply/templates/deploy.erb
136
130
  - lib/dply/templates/pkgs.erb
137
131
  - lib/dply/todo
132
+ - lib/dply/util.rb
133
+ - lib/dply/venv.rb
138
134
  - lib/dply/version.rb
139
135
  - lib/dply/yum.rb
140
136
  - lib/dplyr/cli.rb
@@ -145,6 +141,42 @@ files:
145
141
  - lib/dplyr/stages_config.rb
146
142
  - lib/dplyr/task_runner.rb
147
143
  - lib/dplyr/tasks_config.rb
144
+ - spec/dply/base_config_spec.rb
145
+ - spec/dply/bundle_spec.rb
146
+ - spec/dply/command_spec.rb
147
+ - spec/dply/curl_spec.rb
148
+ - spec/dply/deplist_spec.rb
149
+ - spec/dply/elf_spec.rb
150
+ - spec/dply/env_spec.rb
151
+ - spec/dply/git_spec.rb
152
+ - spec/dply/helper_spec.rb
153
+ - spec/dply/linker_spec.rb
154
+ - spec/dply/lock_spec.rb
155
+ - spec/dply/pkgs_spec.rb
156
+ - spec/dply/repo_spec.rb
157
+ - spec/dply/rpm_spec.rb
158
+ - spec/dply/yum_spec.rb
159
+ - spec/integration/archive_flow_spec.rb
160
+ - spec/integration/git_flow_spec.rb
161
+ - spec/repo.rb
162
+ - spec/spec_helper.rb
163
+ - spec/test_data/build.tar.gz
164
+ - spec/test_data/build.tar.gz.md5
165
+ - spec/test_data/bundle/gems_installed/Gemfile
166
+ - spec/test_data/bundle/gems_not_installed/Gemfile
167
+ - spec/test_data/bundle/no_gemfile/.gitkeep
168
+ - spec/test_data/command/test.rb
169
+ - spec/test_data/elf/elf
170
+ - spec/test_data/elf/libpgtypes.so.3
171
+ - spec/test_data/elf/not_elf
172
+ - spec/test_data/sample_repo/.dply.lock
173
+ - spec/test_data/sample_repo/Gemfile
174
+ - spec/test_data/sample_repo/Rakefile
175
+ - spec/test_data/sample_repo/app.rb
176
+ - spec/test_data/sample_repo/dply/app.rb
177
+ - spec/test_data/sample_repo/lib/libacl.so.1
178
+ - spec/test_data/sample_repo/pkgs.yml
179
+ - spec/webserver.rb
148
180
  - test/sample_data/build.tar.gz
149
181
  - test/sample_data/build.tar.gz.md5
150
182
  - test/test_helper.rb
@@ -171,11 +203,47 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
203
  version: '0'
172
204
  requirements: []
173
205
  rubyforge_project:
174
- rubygems_version: 2.5.1
206
+ rubygems_version: 2.7.4
175
207
  signing_key:
176
208
  specification_version: 4
177
209
  summary: rake based deploy tool
178
210
  test_files:
211
+ - spec/dply/base_config_spec.rb
212
+ - spec/dply/bundle_spec.rb
213
+ - spec/dply/command_spec.rb
214
+ - spec/dply/curl_spec.rb
215
+ - spec/dply/deplist_spec.rb
216
+ - spec/dply/elf_spec.rb
217
+ - spec/dply/env_spec.rb
218
+ - spec/dply/git_spec.rb
219
+ - spec/dply/helper_spec.rb
220
+ - spec/dply/linker_spec.rb
221
+ - spec/dply/lock_spec.rb
222
+ - spec/dply/pkgs_spec.rb
223
+ - spec/dply/repo_spec.rb
224
+ - spec/dply/rpm_spec.rb
225
+ - spec/dply/yum_spec.rb
226
+ - spec/integration/archive_flow_spec.rb
227
+ - spec/integration/git_flow_spec.rb
228
+ - spec/repo.rb
229
+ - spec/spec_helper.rb
230
+ - spec/test_data/build.tar.gz
231
+ - spec/test_data/build.tar.gz.md5
232
+ - spec/test_data/bundle/gems_installed/Gemfile
233
+ - spec/test_data/bundle/gems_not_installed/Gemfile
234
+ - spec/test_data/bundle/no_gemfile/.gitkeep
235
+ - spec/test_data/command/test.rb
236
+ - spec/test_data/elf/elf
237
+ - spec/test_data/elf/libpgtypes.so.3
238
+ - spec/test_data/elf/not_elf
239
+ - spec/test_data/sample_repo/.dply.lock
240
+ - spec/test_data/sample_repo/Gemfile
241
+ - spec/test_data/sample_repo/Rakefile
242
+ - spec/test_data/sample_repo/app.rb
243
+ - spec/test_data/sample_repo/dply/app.rb
244
+ - spec/test_data/sample_repo/lib/libacl.so.1
245
+ - spec/test_data/sample_repo/pkgs.yml
246
+ - spec/webserver.rb
179
247
  - test/sample_data/build.tar.gz
180
248
  - test/sample_data/build.tar.gz.md5
181
249
  - test/test_helper.rb
@@ -1,38 +0,0 @@
1
- require 'dply/helper'
2
- require 'dply/lock'
3
- require 'dply/tasks'
4
- require 'dply/config'
5
-
6
- module Dply
7
- module Cli
8
- class AppTask
9
-
10
- include Helper
11
-
12
- def initialize(argv)
13
- @argv = argv
14
- end
15
-
16
- def run
17
- task_name = @argv.shift
18
- error "task name not specified" if not task_name
19
- config
20
- lock.acquire
21
- Dir.chdir("current") { tasks.app_task task_name }
22
- end
23
-
24
- def tasks
25
- @tasks ||= ::Dply::Tasks.new
26
- end
27
-
28
- def config
29
- @config ||= Config.new.to_struct
30
- end
31
-
32
- def lock
33
- @lock ||= Lock.new
34
- end
35
-
36
- end
37
- end
38
- end
@@ -1,120 +0,0 @@
1
- require 'dply/helper'
2
- require 'dply/config_struct'
3
-
4
- module Dply
5
- class Config
6
-
7
- include Helper
8
- attr_reader :read_config
9
-
10
- def initialize(dir = nil, read_config: true)
11
- @dir = dir || Dir.pwd
12
- @read_config = read_config
13
- end
14
-
15
- def to_struct
16
- config
17
- end
18
-
19
- private
20
-
21
- def config
22
- return @config if @config
23
- @config = ConfigStruct.new(@dir)
24
- read_from_file if read_config
25
- return @config
26
- end
27
-
28
- def name(name)
29
- set :name, name
30
- end
31
-
32
- def repo(repo)
33
- set :repo, repo
34
- end
35
-
36
- def mirror(repo)
37
- set :mirror, repo
38
- end
39
-
40
- def branch(branch)
41
- set :branch, branch
42
- end
43
-
44
- def strategy(strategy)
45
- set :strategy, strategy.to_sym
46
- end
47
-
48
- def target(target)
49
- set :target, target
50
- end
51
-
52
- def shared_dirs(dirs)
53
- raise if not dirs.is_a? Array
54
- set :shared_dirs, dirs
55
- end
56
-
57
- def config_map(map)
58
- set :config_map, map
59
- end
60
-
61
- def dir_map(map)
62
- set :dir_map, map
63
- end
64
-
65
- def config_download_url(url)
66
- set :config_download_url, url
67
- end
68
-
69
- def config_skip_download(list)
70
- set :config_skip_download, list
71
- end
72
-
73
- def verify_checksum(verify_checksum)
74
- set :verify_checksum, verify_checksum
75
- end
76
-
77
-
78
- def set(key, value)
79
- method = "#{key}=".to_sym
80
- @config.send method, value
81
- end
82
-
83
- def env(h)
84
- raise if not h.is_a? Hash
85
- h.each do |k,v|
86
- ENV[k.to_s] = v.to_s
87
- end
88
- end
89
-
90
- def config_file
91
- @config_file ||= begin
92
- found = ["#{@dir}/deploy.rb", "#{@dir}/dply.rb"].find { |f| File.readable? f }
93
- found || "#{@dir}/deploy.rb"
94
- end
95
- end
96
-
97
- def revision(revision)
98
- set :revision, revision
99
- end
100
-
101
- def latest_revision(&block)
102
- set :latest_revision, block
103
- end
104
-
105
- def build_url(&block)
106
- set :build_url_proc, block
107
- end
108
-
109
- def read_from_file
110
- if not File.readable? config_file
111
- error "deploy.rb not found in #{@dir}"
112
- return
113
- end
114
- instance_eval(File.read(config_file))
115
- rescue NoMethodError => e
116
- error "invalid option used in config: #{e.name}"
117
- end
118
-
119
- end
120
- end