automatiek 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +2 -2
- data/automatiek.gemspec +2 -0
- data/lib/automatiek.rb +3 -3
- data/lib/automatiek/gem.rb +23 -12
- data/lib/automatiek/rake_task.rb +1 -1
- data/lib/automatiek/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f240b3291b5041aaf4856655eea1fae7f867e6cd249ebbb50881834946a9bde
|
4
|
+
data.tar.gz: 1261e27317b859fc7041ff258cdc634c7b04549c7d8c98f0a2858d00e537d59d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 483615dcb2db8401e2cc8cb6b4f6f81ea607cd503ed31891ef53be130bd5bb42a190f5a4d551bdbf6e96d94228b9c926395d42e7d3e1bc103bb9d61ef56f2fd9
|
7
|
+
data.tar.gz: e6f0b839a0e4a17b6e8995e29ed4aaaddb1ddaa96bf043b77d8bb1f526ee55d7462be78cdc1d583af061cea8761019ee52c38b200c837837b4fc3638849ed495
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.3.0 (2019-09-03)
|
2
|
+
|
3
|
+
##### Breaking Changes
|
4
|
+
|
5
|
+
* Require Ruby 2.3+
|
6
|
+
|
7
|
+
##### Enhancements
|
8
|
+
|
9
|
+
* Add support for sub-dependency vendoring.
|
10
|
+
[David Rodriguez](https://github.com/deivid-rodriguez)
|
11
|
+
|
12
|
+
|
1
13
|
## 0.2.0 (2019-06-22)
|
2
14
|
|
3
15
|
##### Enhancements
|
data/Gemfile.lock
CHANGED
data/automatiek.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = ">= 2.3.0"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
22
24
|
spec.add_development_dependency "rake", ">= 10.0", "< 12.0"
|
23
25
|
spec.add_development_dependency "rspec"
|
data/lib/automatiek.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Automatiek
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
require_relative "automatiek/gem"
|
3
|
+
require_relative "automatiek/rake_task" if defined?(::Rake)
|
4
|
+
require_relative "automatiek/version"
|
5
5
|
end
|
data/lib/automatiek/gem.rb
CHANGED
@@ -4,12 +4,20 @@ module Automatiek
|
|
4
4
|
class Gem
|
5
5
|
def initialize(gem_name, &block)
|
6
6
|
@gem_name = gem_name
|
7
|
+
@dependencies = []
|
7
8
|
block.call(self) if block
|
8
9
|
end
|
9
10
|
|
10
|
-
def vendor!(version)
|
11
|
-
update(version)
|
12
|
-
|
11
|
+
def vendor!(version = nil)
|
12
|
+
update(version || self.version)
|
13
|
+
|
14
|
+
@dependencies.each do |dependency|
|
15
|
+
dependency.vendor!
|
16
|
+
dependency.namespace_files(vendor_lib)
|
17
|
+
end
|
18
|
+
|
19
|
+
namespace_files(vendor_lib)
|
20
|
+
|
13
21
|
clean
|
14
22
|
end
|
15
23
|
|
@@ -29,31 +37,34 @@ module Automatiek
|
|
29
37
|
end
|
30
38
|
end
|
31
39
|
|
40
|
+
def dependency(name, &block)
|
41
|
+
dep = self.class.new(name, &block)
|
42
|
+
@dependencies << dep
|
43
|
+
end
|
44
|
+
|
32
45
|
attr_accessor :gem_name
|
33
46
|
attr_accessor :namespace
|
34
47
|
attr_accessor :prefix
|
35
48
|
attr_accessor :vendor_lib
|
49
|
+
attr_accessor :version
|
36
50
|
|
37
51
|
def update(version)
|
38
52
|
FileUtils.rm_rf vendor_lib
|
39
53
|
@download.call(version)
|
40
54
|
end
|
41
55
|
|
42
|
-
def files
|
43
|
-
Dir.glob("#{vendor_lib}/**/*.rb")
|
44
|
-
end
|
45
|
-
|
46
56
|
def require_entrypoint
|
47
57
|
@require_entrypoint ||= gem_name.tr("-", "/")
|
48
58
|
end
|
49
59
|
|
50
60
|
attr_writer :require_entrypoint
|
51
61
|
|
52
|
-
def namespace_files
|
62
|
+
def namespace_files(folder)
|
63
|
+
files = Dir.glob("#{folder}/**/*.rb")
|
53
64
|
require_target = vendor_lib.sub(%r{^(.+?/)?lib/}, "") << "/lib"
|
54
|
-
|
55
|
-
|
56
|
-
|
65
|
+
process(files, namespace, "#{prefix}::#{namespace}")
|
66
|
+
process(files, /require (["'])#{Regexp.escape require_entrypoint}/, "require \\1#{require_target}/#{require_entrypoint}")
|
67
|
+
process(files, /(autoload\s+[:\w]+,\s+["'])(#{Regexp.escape require_entrypoint}[\w\/]+["'])/, "\\1#{require_target}/\\2")
|
57
68
|
end
|
58
69
|
|
59
70
|
def clean
|
@@ -63,7 +74,7 @@ module Automatiek
|
|
63
74
|
|
64
75
|
private
|
65
76
|
|
66
|
-
def
|
77
|
+
def process(files, regex, replacement = "")
|
67
78
|
files.each do |file|
|
68
79
|
contents = File.read(file)
|
69
80
|
contents.gsub!(regex, replacement)
|
data/lib/automatiek/rake_task.rb
CHANGED
data/lib/automatiek/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automatiek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel E. Giddins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,15 +96,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
96
|
requirements:
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: 2.3.0
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 2.7.6
|
106
|
+
rubygems_version: 3.0.6
|
108
107
|
signing_key:
|
109
108
|
specification_version: 4
|
110
109
|
summary: Vendor your gem's dependencies in retro style.
|