4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/spade/installer.rb', line 4
def app_script_text(bin_file_name)
<<-TEXT
#{shebang bin_file_name}
#
# This file was generated by Spade.
#
# The application '#{@spec.name}' is installed as part of an spd, and
# this file is here to facilitate running it.
#
require 'spade'
# Configures RubyGems properly
env = Spade::Environment.new
version = "#{Gem::Requirement.default}"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem '#{@spec.name}', version
path = Gem.bin_path('#{@spec.name}', '#{bin_file_name}', version)
shebang = File.open(path){|f| f.readline }
if shebang =~ /^\#\!.*ruby/
load path
else
exec path, *ARGV
end
TEXT
end
|