Rakefile in extlz4-0.3.3 vs Rakefile in extlz4-0.3.4
- old
+ new
@@ -33,10 +33,11 @@
GEMSTUB.executables.sort!
PACKAGENAME = "#{GEMSTUB.name}-#{GEMSTUB.version}"
GEMFILE = "#{PACKAGENAME}.gem"
GEMSPEC = "#{PACKAGENAME}.gemspec"
+BUNDLER_GEMFILE = "Gemfile"
GEMSTUB.files += DOC + EXT + EXTCONF + BIN + LIB + SPEC + TEST + EXAMPLE + RAKEFILE + EXTRA
GEMSTUB.files.sort!
if GEMSTUB.rdoc_options.nil? || GEMSTUB.rdoc_options.empty?
readme = %W(.md .markdown .rd .rdoc .txt #{""}).map { |ext| "README#{ext}" }.find { |m| DOC.find { |n| n == m } }
@@ -192,10 +193,13 @@
desc "print package name"
task "package-name" do
puts PACKAGENAME
end
+desc "generate Gemfile for bundler"
+task "gemfile" => BUNDLER_GEMFILE
+
file GEMFILE => DOC + EXT + EXTCONF + BIN + LIB + SPEC + TEST + EXAMPLE + RAKEFILE + [GEMSPEC] do
sh "gem build #{GEMSPEC}"
end
file GEMFILE_TRYOUT => DOC + EXT + EXTCONF + BIN + LIB + SPEC + TEST + EXAMPLE + RAKEFILE + [GEMSPEC_TRYOUT] do
@@ -207,6 +211,24 @@
File.write(GEMSPEC, GEMSTUB.to_ruby, mode: "wb")
end
file GEMSPEC_TRYOUT => RAKEFILE do
File.write(GEMSPEC_TRYOUT, GEMSTUB_TRYOUT.to_ruby, mode: "wb")
+end
+
+file BUNDLER_GEMFILE => RAKEFILE do
+ File.write(BUNDLER_GEMFILE, <<~GemfileSource, mode: "wb")
+ source "https://rubygems.org/"
+
+ group "default" do
+ #{GEMSTUB.runtime_dependencies.map { |e|
+ %( gem #{e.name.inspect}, #{e.requirements_list.map { |ee| ee.inspect }.join(", ")})
+ }.join("\n")}
+ end
+
+ group "development", "test" do
+ #{GEMSTUB.development_dependencies.map { |e|
+ %( gem #{e.name.inspect}, #{e.requirements_list.map { |ee| ee.inspect }.join(", ")})
+ }.join("\n")}
+ end
+ GemfileSource
end