Rakefile in git-multi-1.0.4 vs Rakefile in git-multi-1.0.5
- old
+ new
@@ -1,5 +1,7 @@
+# rubocop:disable Style/HashSyntax
+
require 'bundler/gem_tasks'
def gemspec
@gemspec ||= begin
# rubocop:disable Security/Eval
@@ -19,31 +21,33 @@
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['test/**/*_test.rb']
end
-# rubocop:disable Style/HashSyntax
-
task :default => :test
-task :documentation => 'man/git-multi.txt'
-
require 'git/multi'
-def query_args
+git_workarea = File.join(Git::Multi::WORKAREA, 'git', 'git')
+documentation = File.join(git_workarea, 'Documentation')
+git_asciidoc = File.join(documentation, 'git-multi.txt')
- client = Git::Hub.send(:client) # Octokit GitHub API client
- repo = client.repo('git/git') # random GitHub repository
+require 'erb'
- # instead of maintaining a list of valid query args in the help-
- # file, we determine it at runtime... less is more, and all that
- repo.fields.sort.each_slice(3).map { |foo, bar, qux|
- format('%-20s %-20s %-20s', foo, bar, qux).rstrip
- }.join("\n ")
-end
+file 'man/git-multi.erb' => 'lib/git/multi/version.rb' # version changes
-file 'man/git-multi.txt' => 'man/git-multi.erb' do |task|
- require 'erb'
+file git_asciidoc => 'man/git-multi.erb' do |task|
File.write(task.name, ERB.new(File.read(task.source)).result)
end
+
+task :documentation => git_asciidoc do
+ Dir.chdir(documentation) do
+ # use git's documentation approach and build system
+ %x{ make git-multi.1 git-multi.html }
+ FileUtils.cp 'git-multi.1', Git::Multi::MAN_PAGE
+ FileUtils.cp 'git-multi.html', Git::Multi::HTML_PAGE
+ end
+end
+
+Rake::Task['build'].enhance([:documentation])
# rubocop:enable Style/HashSyntax