Skip to content

Commit 6b694ef

Browse files
committed
Generate standalone file in the pkg dir
Which is where Gem archives are already being built, so why dirty up our root dir?
1 parent b9af74e commit 6b694ef

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Rakefile

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
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
56
unless ENV["HOMEBREW_BREW_FILE"]
@@ -19,22 +20,26 @@ unless ENV["HOMEBREW_BREW_FILE"]
1920
end
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)
2631
end
2732

2833
namespace :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

Comments
 (0)