hoe-bundler 1.4.0 → 1.5.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
- SHA1:
3
- metadata.gz: '0093e4cb1a127c8a4d151317f3e926268e0d931a'
4
- data.tar.gz: 8366b6057d76601d1e276736a3c4346a654ab4e5
2
+ SHA256:
3
+ metadata.gz: ad7f33d9a715e7cd7cdd3ee4394c74c3b36d43204fa80551cd802d65d8b1808b
4
+ data.tar.gz: b1f26c8bd13434c9f9d32d421fcb2288c348f8b7d5481a5f636ab6d540e11b9f
5
5
  SHA512:
6
- metadata.gz: 1cdf2091038c60cb73c8a0eff6d5afe7206bb8e7a14dcce8d33655a2be0efa46c575b07b7b800686b070028ff1d244e2dd10e33d5a715ed00eb510f7aac26faf
7
- data.tar.gz: 1c904d7f0a87c2ff17db67bcae7938cd29a1b58878951e808eeff2c6765083c0c793fdea74c9746a48b9dc7a007aa8a1f6e4849898c9e2b553ee29517dd885cb
6
+ metadata.gz: 3a6ca9420fef5a70b5b4cab026fe8dd89bd3efad21b115d81054edee1ab22a9404ff2306c99b914c02ee8916f9d87190cba4092719b2102fbd98aca3e72361de
7
+ data.tar.gz: '058c4d7c6d8dd01c877748fd766e0e51dd24aaa5240aa8bbae32ed71c905d58943b8119dd0c68e0ccd31262377e9580854685ef68c1c15dbed61a5ee8604cbe0'
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0 / 2018-11-17
4
+
5
+ Enhancements:
6
+
7
+ * The `bundler:gemfile` rake task accepts optional arguments to specify the gem source, and whether to invoke `gemspec`. (Thanks, @adangel!)
8
+
9
+
3
10
  ## 1.4.0 / 2018-03-28
4
11
 
5
12
  Enhancements:
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  http://github.com/flavorjones/hoe-bundler
4
4
 
5
- [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/hoe-bundler/jobs/ruby-2.5/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/hoe-bundler)
5
+ [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/hoe-bundler/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/hoe-bundler)
6
6
 
7
7
 
8
8
  ## Description
@@ -14,7 +14,7 @@ Generate a Gemfile based on a Hoe spec's declared dependencies.
14
14
 
15
15
  Creates a rake task to generate a bundler Gemfile based on your declared hoe dependencies.
16
16
 
17
- * `bundler:gemfile`
17
+ * `rake bundler:gemfile`
18
18
 
19
19
  Why would you want to do this? I mean, why would anyone want to use bundler to test their gem?
20
20
 
@@ -33,6 +33,25 @@ And then run the following command to generate a Gemfile:
33
33
  rake bundler:gemfile
34
34
 
35
35
 
36
+ ### Reference a gemspec file
37
+
38
+ To generate a Gemfile which uses `gemspec` and the default source:
39
+
40
+ rake bundler:gemfile[,true]
41
+
42
+ ### Use a custom gem source
43
+
44
+ To generate a Gemfile which uses a custom source:
45
+
46
+ rake bundler:gemfile[https://gems.github.com]
47
+
48
+ ### Reference a gemspec file and use a custom gem source
49
+
50
+ Or the combination of custom source and gemspec:
51
+
52
+ rake bundler:gemfile[https://gems.github.com,true]
53
+
54
+
36
55
  ## Requirements
37
56
 
38
57
  * hoe >= 2.2.0
@@ -3,30 +3,42 @@ class Hoe #:nodoc:
3
3
  # Rake task to generate a bundler Gemfile based on your declared hoe dependencies.
4
4
  #
5
5
  # * <tt>bundler:gemfile</tt>
6
+ # * <tt>bundler:gemfile[https://rubygems.org/,false]</tt>
6
7
  #
7
8
  module Bundler
8
- VERSION = "1.4.0" #:nodoc:
9
+ VERSION = "1.5.0" #:nodoc:
10
+
11
+ DEFAULT_SOURCE = 'https://rubygems.org/'
12
+ DEFAULT_USE_GEMSPEC = false
9
13
 
10
14
  def define_bundler_tasks
11
15
  desc "generate a bundler Gemfile from your Hoe.spec dependencies"
12
- task "bundler:gemfile" do
16
+ task "bundler:gemfile", :source, :use_gemspec do |t,args|
17
+ args.with_defaults(:source => DEFAULT_SOURCE, :use_gemspec => DEFAULT_USE_GEMSPEC)
13
18
  File.open("Gemfile","w") do |gemfile|
14
- gemfile.print hoe_bundler_contents
19
+ gemfile.print hoe_bundler_contents(args)
15
20
  end
16
21
  end
17
22
  end
18
23
 
19
- def hoe_bundler_contents
24
+ def hoe_bundler_contents(args = {})
25
+ args[:source] = DEFAULT_SOURCE unless args.has_key?(:source)
26
+ args[:use_gemspec] = DEFAULT_USE_GEMSPEC unless args.has_key?(:use_gemspec)
27
+
20
28
  gemfile = StringIO.new
21
29
  gemfile.puts "# -*- ruby -*-"
22
30
  gemfile.puts
23
31
  gemfile.puts "# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`."
24
32
  gemfile.puts
25
- gemfile.puts "source \"https://rubygems.org/\""
33
+ gemfile.puts "source "<< ((args[:source] =~ /^https?:\/\//) ? "\"#{args[:source]}\"" : ":#{args[:source]}")
34
+ gemfile.puts "gemspec" if args[:use_gemspec]
26
35
  gemfile.puts
27
36
 
28
- hoe_bundler_add_dependencies(self.extra_deps, gemfile)
29
- hoe_bundler_add_dependencies(self.extra_dev_deps, gemfile, ", :group => [:development, :test]")
37
+ unless args[:use_gemspec]
38
+ hoe_bundler_add_dependencies(self.extra_deps, gemfile)
39
+ hoe_bundler_add_dependencies(self.extra_dev_deps, gemfile, ", :group => [:development, :test]")
40
+ end
41
+
30
42
  gemfile.puts "# vim: syntax=ruby"
31
43
 
32
44
  gemfile.rewind
@@ -5,6 +5,10 @@ require "hoe"
5
5
  Hoe.plugin :bundler
6
6
 
7
7
  class TestHoeBundler < Minitest::Test
8
+ def teardown
9
+ system "git checkout -f test/fixture_project/Gemfile"
10
+ end
11
+
8
12
  def test_output
9
13
  gemfile = nil
10
14
  Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
@@ -61,4 +65,93 @@ class TestHoeBundler < Minitest::Test
61
65
  assert_equal %Q{gem "bar", ">=1.8", "<3.0", :group => [:development, :test]}, lines.grep(/bar/).first
62
66
  end
63
67
  end
68
+
69
+ def test_source_symbol_option
70
+ gemfile = nil
71
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
72
+ FileUtils.rm_f "Gemfile"
73
+ begin
74
+ system "rake bundler:gemfile[gemcutter]"
75
+ gemfile = File.read "Gemfile"
76
+ end
77
+ end
78
+ assert_match %r{^source \:gemcutter$}, gemfile
79
+ end
80
+
81
+ def test_source_http_option
82
+ gemfile = nil
83
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
84
+ FileUtils.rm_f "Gemfile"
85
+ begin
86
+ system "rake bundler:gemfile[http://gems.github.com]"
87
+ gemfile = File.read "Gemfile"
88
+ end
89
+ end
90
+ assert_match %r{^source "http:\/\/gems\.github\.com"$}, gemfile
91
+ end
92
+
93
+ def test_source_https_option
94
+ gemfile = nil
95
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
96
+ FileUtils.rm_f "Gemfile"
97
+ begin
98
+ system "rake bundler:gemfile[https://gems.github.com]"
99
+ gemfile = File.read "Gemfile"
100
+ end
101
+ end
102
+ assert_match %r{^source "https:\/\/gems\.github\.com"$}, gemfile
103
+ end
104
+
105
+ def test_gemspec_option
106
+ gemfile = nil
107
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
108
+ FileUtils.rm_f "Gemfile"
109
+ begin
110
+ system "rake bundler:gemfile[rubygems,true]"
111
+ gemfile = File.read "Gemfile"
112
+ end
113
+ end
114
+ assert_match %r{^# -\*- ruby -\*-$}, gemfile
115
+ assert_match %r{^# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.}, gemfile
116
+ assert_match %r{^source \:rubygems$}, gemfile
117
+ assert_match %r{^gemspec$}, gemfile
118
+ assert_match %r{^# vim: syntax=ruby$}, gemfile
119
+
120
+ lines = gemfile.split("\n")
121
+ # normal gem declarations should not be there if gemspec is used
122
+ assert_equal 0, lines.grep(/gem \"/).length
123
+ end
124
+
125
+ def test_just_gemspec_option
126
+ gemfile = nil
127
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
128
+ FileUtils.rm_f "Gemfile"
129
+ begin
130
+ system "rake bundler:gemfile[,true]"
131
+ gemfile = File.read "Gemfile"
132
+ end
133
+ end
134
+ assert_match %r{^# -\*- ruby -\*-$}, gemfile
135
+ assert_match %r{^# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.}, gemfile
136
+ assert_match %r{^source "https:\/\/rubygems.org\/"$}, gemfile
137
+ assert_match %r{^gemspec$}, gemfile
138
+ assert_match %r{^# vim: syntax=ruby$}, gemfile
139
+
140
+ lines = gemfile.split("\n")
141
+ # normal gem declarations should not be there if gemspec is used
142
+ assert_equal 0, lines.grep(/gem \"/).length
143
+ end
144
+
145
+ def test_source_http_and_gemspec_option
146
+ gemfile = nil
147
+ Dir.chdir(File.join(File.dirname(__FILE__), "fixture_project")) do
148
+ FileUtils.rm_f "Gemfile"
149
+ begin
150
+ system "rake bundler:gemfile[http://gems.github.com,true]"
151
+ gemfile = File.read "Gemfile"
152
+ end
153
+ end
154
+ assert_match %r{^source "http:\/\/gems\.github\.com"$}, gemfile
155
+ assert_match %r{^gemspec$}, gemfile
156
+ end
64
157
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoe-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.6.12
150
+ rubygems_version: 2.7.7
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Generate a Gemfile based on a Hoe spec's declared dependencies.