11#!/usr/bin/env rake
2- require File . expand_path ( "../lib/git_tracker/version" , __FILE__ )
2+
3+ require Pathname ( "." ) . join ( "lib/git_tracker/version" ) . expand_path
34
45# Skip these tasks when being installed by Homebrew
56unless ENV [ "HOMEBREW_BREW_FILE" ]
@@ -19,22 +20,26 @@ unless ENV["HOMEBREW_BREW_FILE"]
1920end
2021
2122# standalone and Homebrew
22- file "git-tracker" => FileList . new ( "lib/git_tracker.rb" , "lib/git_tracker/*.rb" ) do |task |
23- $LOAD_PATH. unshift File . expand_path ( "../lib" , __FILE__ )
23+ directory "pkg"
24+
25+ file "pkg/git-tracker" => Rake ::FileList . new ( "pkg" , "lib/git_tracker.rb" , "lib/git_tracker/*.rb" ) do |task |
26+ $LOAD_PATH. unshift ( Pathname ( __dir__ ) . join ( "lib" ) . expand_path )
2427 require "git_tracker/standalone"
25- GitTracker ::Standalone . save ( task . name )
28+
29+ path , filename = task . name . split ( "/" )
30+ GitTracker ::Standalone . save ( filename , path : path )
2631end
2732
2833namespace :standalone do
2934 desc "Build standalone script"
30- task build : "git-tracker"
35+ task build : "pkg/ git-tracker"
3136
3237 desc "Build and install standalone script"
3338 task install : "standalone:build" do
3439 prefix = ENV [ "PREFIX" ] || ENV [ "prefix" ] || "/usr/local"
3540
36- FileUtils . mkdir_p "#{ prefix } /bin"
37- FileUtils . cp " git-tracker", "#{ prefix } /bin" , preserve : true
41+ FileUtils . mkdir_p ( "#{ prefix } /bin" )
42+ FileUtils . cp ( "pkg/ git-tracker", "#{ prefix } /bin" , preserve : true )
3843 end
3944
4045 task :homebrew do
0 commit comments