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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30a75f2aab9b4944b78867420ca87bfd5594eb11d804cf2da47e46c7008c546e
4
- data.tar.gz: 8c3844a9bcc54eeeaf4d3675b883edf0c199a0bb8cc0f158e4802d381dc0abed
3
+ metadata.gz: 4f240b3291b5041aaf4856655eea1fae7f867e6cd249ebbb50881834946a9bde
4
+ data.tar.gz: 1261e27317b859fc7041ff258cdc634c7b04549c7d8c98f0a2858d00e537d59d
5
5
  SHA512:
6
- metadata.gz: 3d9aeeb413bbee6b4da3f251a24271fef2cce7cfb0093cd17b68fbf49122c824aa1729ccee33ff6caf42772cc7fef8304252656f5103b69a98f089a6fb785db8
7
- data.tar.gz: 99ceacf39ac810bad892955d4c0249df75d7d263cb424e8c8523237b3722b89510d2a66729e836fab10bb7672cb535072372e15201b2080e732985d237d0e126
6
+ metadata.gz: 483615dcb2db8401e2cc8cb6b4f6f81ea607cd503ed31891ef53be130bd5bb42a190f5a4d551bdbf6e96d94228b9c926395d42e7d3e1bc103bb9d61ef56f2fd9
7
+ data.tar.gz: e6f0b839a0e4a17b6e8995e29ed4aaaddb1ddaa96bf043b77d8bb1f526ee55d7462be78cdc1d583af061cea8761019ee52c38b200c837837b4fc3638849ed495
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.6
3
+ - 2.3.8
4
+ - 2.4.6
5
+ - 2.5.5
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 2.0.2
5
8
  branches:
6
9
  only:
7
10
  - master
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- automatiek (0.2.0)
4
+ automatiek (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  rspec
33
33
 
34
34
  BUNDLED WITH
35
- 1.17.1
35
+ 1.17.3
@@ -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"
@@ -1,5 +1,5 @@
1
1
  module Automatiek
2
- require "automatiek/gem"
3
- require "automatiek/rake_task" if defined?(::Rake)
4
- require "automatiek/version"
2
+ require_relative "automatiek/gem"
3
+ require_relative "automatiek/rake_task" if defined?(::Rake)
4
+ require_relative "automatiek/version"
5
5
  end
@@ -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
- namespace_files
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
- process_files(namespace, "#{prefix}::#{namespace}")
55
- process_files(/require (["'])#{Regexp.escape require_entrypoint}/, "require \\1#{require_target}/#{require_entrypoint}")
56
- process_files(/(autoload\s+[:\w]+,\s+["'])(#{Regexp.escape require_entrypoint}[\w\/]+["'])/, "\\1#{require_target}/\\2")
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 process_files(regex, replacement = "")
77
+ def process(files, regex, replacement = "")
67
78
  files.each do |file|
68
79
  contents = File.read(file)
69
80
  contents.gsub!(regex, replacement)
@@ -1,7 +1,7 @@
1
1
  require 'rake'
2
2
  require 'rake/tasklib'
3
3
 
4
- require 'automatiek/gem'
4
+ require_relative 'gem'
5
5
 
6
6
  module Automatiek
7
7
  class RakeTask < Rake::TaskLib
@@ -1,3 +1,3 @@
1
1
  module Automatiek
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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-06-23 00:00:00.000000000 Z
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: '0'
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
- rubyforge_project:
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.