task/gemgem.rb in dm-is-reflective-1.1.0 vs task/gemgem.rb in dm-is-reflective-1.2.0
- old
+ new
@@ -12,10 +12,11 @@
s.authors = ['Lin Jen-Shin (godfat)']
s.email = ['godfat (XD) godfat.org']
s.description = description.join
s.summary = description.first
+ s.license = readme['LICENSE'].sub(/.+\n\n/, '').lines.first.strip
s.rubygems_version = Gem::VERSION
s.date = Time.now.strftime('%Y-%m-%d')
s.files = gem_files
s.test_files = gem_files.grep(%r{^test/(.+?/)*test_.+?\.rb$})
@@ -31,22 +32,22 @@
File.exist?("#{Gemgem.dir}/#{name}")
}
@readme ||=
if path
ps = "##{File.read(path)}".
- scan(/((#+)[^\n]+\n\n.+?(?=\n\n\2[^#\n]+\n))/m).map(&:first)
- ps.inject({'HEADER' => ps.first}){ |r, s, i|
+ scan(/((#+)[^\n]+\n\n.+?(?=(\n\n\2[^#\n]+\n)|\Z))/m).map(&:first)
+ ps.inject('HEADER' => ps.first){ |r, s, i|
r[s[/\w+/]] = s
r
}
else
{}
end
end
def description
- @description ||= (readme['DESCRIPTION']||'').sub(/.+\n\n/, '').lines.to_a
+ @description ||= (readme['DESCRIPTION']||'').sub(/.+\n\n/, '').lines
end
def changes
path = %w[CHANGES.md CHANGES].find{ |name|
File.exist?("#{Gemgem.dir}/#{name}")
@@ -102,13 +103,13 @@
File.open("#{dir}/#{spec.name}.gemspec", 'w'){ |f|
f << split_lines(spec.to_ruby) }
end
def split_lines ruby
- ruby.gsub(/(.+?)\[(.+?)\]/){ |s|
+ ruby.gsub(/(.+?)\s*=\s*\[(.+?)\]/){ |s|
if $2.index(',')
- "#{$1}[\n #{$2.split(',').map(&:strip).join(",\n ")}]"
+ "#{$1} = [\n #{$2.split(',').map(&:strip).join(",\n ")}]"
else
s
end
}
end
@@ -177,10 +178,10 @@
namespace :gem do
desc 'Install gem'
task :install => [:build] do
- sh("#{Gem.ruby} -S gem install pkg/#{Gemgem.gem_tag}")
+ sh("#{Gem.ruby} -S gem install pkg/#{Gemgem.gem_tag}.gem")
end
desc 'Build gem'
task :build => [:spec] do
sh("#{Gem.ruby} -S gem build #{Gemgem.spec.name}.gemspec")