Rakefile in fedux_org-stdlib-0.0.2 vs Rakefile in fedux_org-stdlib-0.0.3
- old
+ new
@@ -6,16 +6,18 @@
end
require 'yard'
require 'rubygems/package_task'
require 'active_support/core_ext/string/strip'
+ require 'erubis'
end
YARD::Rake::YardocTask.new() do |y|
# y.options << '--verbose'
end
+
desc 'start tmux'
task :terminal do
sh "script/terminal"
end
@@ -28,16 +30,24 @@
desc 'bump version of library to new version'
task :bump do
new_version = ENV['VERSION'] || ENV['version']
- raw_module_name = File.open(version_file, "r").readlines.grep(/module/).first
- module_name = raw_module_name.chomp.match(/module\s+(\S+)/) {$1}
+ raw_module_names = File.open(version_file, "r").readlines.grep(/module/)
+ module_names = raw_module_names.collect { |n| n.chomp.match(/module\s+(\S+)/) {$1} }
- version_string = %Q{#main #{module_name}
-module #{module_name}
-VERSION = '#{new_version}'
-end}
+ template = <<-EOF
+ #main <%= @modules.first %>
+ <% @modules.each do |m| %>
+ module <%= m %>
+ <% end %>
+ VERSION = '<%= @version %>'
+ <% @modules.size.times do |m| %>
+ end
+ <% end %>
+EOF
+
+ version_string = Erubis::Eruby.new(template).evaluate(modules: module_names, version: new_version)
File.open(version_file, "w") do |f|
f.write version_string.strip_heredoc
end