setup 5.0.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Assembly +46 -0
- data/Gemfile +2 -0
- data/{HISTORY → HISTORY.rdoc} +21 -0
- data/LICENSE.txt +28 -0
- data/{COPYING → NOTICE.txt} +11 -4
- data/README.rdoc +28 -40
- data/SetupReceipt +405 -0
- data/bin/setup.rb +1302 -3
- data/lib/setup.rb +4 -3
- data/lib/setup/base.rb +1 -1
- data/lib/setup/command.rb +41 -18
- data/lib/setup/configuration.rb +21 -16
- data/lib/setup/constants.rb +4 -1
- data/lib/setup/documentor.rb +47 -41
- data/lib/setup/installer.rb +2 -2
- data/lib/setup/project.rb +85 -35
- data/lib/setup/session.rb +44 -31
- data/lib/setup/version.rb +4 -0
- data/meta/authors +4 -2
- data/meta/copyrights +4 -0
- data/meta/description +1 -1
- data/meta/organization +1 -0
- data/meta/repositories +2 -0
- data/meta/requirements +4 -0
- data/meta/resources +6 -0
- data/meta/version +1 -1
- data/script/{bstrap → bootstrap} +0 -0
- data/script/bundle +23 -6
- data/script/setup +122 -164
- data/test/features/{make.feature → compile.feature} +5 -6
- data/test/features/config.feature +1 -1
- data/test/features/install.feature +5 -5
- data/test/features/step_definitions/compile_steps.rb +26 -0
- data/test/features/step_definitions/config_steps.rb +2 -2
- data/test/features/step_definitions/install_steps.rb +11 -5
- data/test/features/uninstall.feature +1 -1
- data/test/fixtures/faux-project/.setup/metaconfig.rb +6 -0
- metadata +99 -60
- data/MANIFEST +0 -65
- data/Syckfile +0 -77
- data/meta/collection +0 -1
- data/meta/contact +0 -1
- data/meta/homepage +0 -1
- data/meta/released +0 -1
- data/meta/repository +0 -1
- data/meta/ruby +0 -3
- data/test/features/document.feature +0 -2
- data/test/features/step_definitions/setup_steps.rb +0 -30
data/lib/setup/session.rb
CHANGED
@@ -5,7 +5,7 @@ require 'setup/configuration'
|
|
5
5
|
require 'setup/compiler'
|
6
6
|
require 'setup/installer'
|
7
7
|
require 'setup/tester'
|
8
|
-
require 'setup/documentor'
|
8
|
+
#require 'setup/documentor'
|
9
9
|
require 'setup/uninstaller'
|
10
10
|
|
11
11
|
module Setup
|
@@ -24,6 +24,15 @@ module Setup
|
|
24
24
|
|
25
25
|
# # O P T I O N S # #
|
26
26
|
|
27
|
+
## Reset configuration?
|
28
|
+
#def reset?
|
29
|
+
# @options[:reset]
|
30
|
+
#end
|
31
|
+
|
32
|
+
#def reset=(value)
|
33
|
+
# @options[:reset] = value
|
34
|
+
#end
|
35
|
+
|
27
36
|
#
|
28
37
|
def io
|
29
38
|
@options[:io]
|
@@ -44,11 +53,13 @@ module Setup
|
|
44
53
|
|
45
54
|
#
|
46
55
|
def trial?; @options[:trial]; end
|
56
|
+
alias_method :dryrun?, :trial?
|
47
57
|
|
48
58
|
#
|
49
59
|
def trial=(val)
|
50
60
|
@options[:trial] = val
|
51
61
|
end
|
62
|
+
alias_method :dryrun=, :trial=
|
52
63
|
|
53
64
|
#
|
54
65
|
def quiet?; @options[:quiet]; end
|
@@ -77,54 +88,56 @@ module Setup
|
|
77
88
|
#
|
78
89
|
# * config
|
79
90
|
# * make
|
80
|
-
# * test (
|
91
|
+
# * test (optional)
|
81
92
|
# * install
|
82
|
-
# * document (if selected)
|
83
|
-
#
|
84
|
-
# Note that ri documentation is not easy to uninstall.
|
85
|
-
# So use the --ri option knowledgably. You can alwasy
|
86
|
-
# Use <tt>setup.rb document</tt> at a later time.
|
87
93
|
#
|
88
94
|
def all
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
95
|
+
#if compile?
|
96
|
+
config
|
97
|
+
compile
|
98
|
+
#end
|
93
99
|
if configuration.test?
|
94
100
|
ok = test
|
95
101
|
exit 1 unless ok
|
96
102
|
end
|
97
103
|
install
|
98
|
-
if configuration.ri?
|
99
|
-
|
100
|
-
end
|
104
|
+
#if configuration.ri?
|
105
|
+
# document
|
106
|
+
#end
|
101
107
|
end
|
102
108
|
|
103
109
|
#
|
104
110
|
def config
|
105
|
-
log_header('
|
111
|
+
log_header('Preconfig')
|
112
|
+
#if reset?
|
113
|
+
# @configuration = Configuration.new(:reset=>true)
|
114
|
+
#end
|
106
115
|
if configuration.save_config
|
107
|
-
io.
|
116
|
+
io.print "#{CONFIG_FILE} was saved. " unless quiet?
|
108
117
|
else
|
109
|
-
io.
|
118
|
+
io.print "#{CONFIG_FILE} is current. " unless quiet?
|
110
119
|
end
|
120
|
+
io.puts "Edit to customize configuration." unless quiet?
|
111
121
|
puts configuration if trace? && !quiet?
|
112
|
-
compiler.configure if compile? #compiler.compiles?
|
113
122
|
end
|
114
123
|
|
115
124
|
#
|
116
|
-
def
|
117
|
-
|
118
|
-
|
119
|
-
|
125
|
+
def compile
|
126
|
+
if compile?
|
127
|
+
log_header('Compile')
|
128
|
+
compiler.configure
|
129
|
+
#abort "must run 'setup config' first" unless configuration.exist?
|
130
|
+
compiler.compile
|
131
|
+
end
|
120
132
|
end
|
121
133
|
|
122
134
|
# What #make used to be called.
|
135
|
+
alias_method :make, :compile
|
123
136
|
alias_method :setup, :make
|
124
137
|
|
125
138
|
#
|
126
139
|
def install
|
127
|
-
abort "must run 'setup config' first" unless configuration.exist?
|
140
|
+
#abort "must run 'setup config' first" unless configuration.exist?
|
128
141
|
log_header('Install')
|
129
142
|
installer.install
|
130
143
|
end
|
@@ -137,11 +150,11 @@ module Setup
|
|
137
150
|
end
|
138
151
|
|
139
152
|
#
|
140
|
-
def document
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
153
|
+
#def document
|
154
|
+
# #return unless configuration.doc?
|
155
|
+
# log_header('Document')
|
156
|
+
# documentor.document
|
157
|
+
#end
|
145
158
|
|
146
159
|
#
|
147
160
|
def clean
|
@@ -195,9 +208,9 @@ module Setup
|
|
195
208
|
@tester ||= Tester.new(project, configuration, options)
|
196
209
|
end
|
197
210
|
#
|
198
|
-
def documentor
|
199
|
-
|
200
|
-
end
|
211
|
+
#def documentor
|
212
|
+
# @documentor ||= Documentor.new(project, configuration, options)
|
213
|
+
#end
|
201
214
|
#
|
202
215
|
def uninstaller
|
203
216
|
@uninstaller ||= Uninstaller.new(project, configuration, options)
|
data/meta/authors
CHANGED
data/meta/copyrights
ADDED
data/meta/description
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Every Rubyist is aware of Minero Aoki's ever useful
|
2
2
|
setup.rb script. It's how most of us used to install
|
3
|
-
our ruby programs before RubyGems came along.And it's
|
3
|
+
our ruby programs before RubyGems came along. And it's
|
4
4
|
still mighty useful in certain scenarios, not the least
|
5
5
|
of which is the job of the distribution package managers.
|
6
6
|
Setup converts setup.rb into a stand-alone application.
|
data/meta/organization
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rubyworks
|
data/meta/repositories
ADDED
data/meta/requirements
ADDED
data/meta/resources
ADDED
data/meta/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.0
|
1
|
+
5.1.0
|
data/script/{bstrap → bootstrap}
RENAMED
File without changes
|
data/script/bundle
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'fileutils'
|
4
|
+
|
3
5
|
raise "Not the right place #{Dir.pwd}" unless File.directory?('lib')
|
4
6
|
|
5
7
|
#scripts = (Dir['lib/*.rb'] + Dir['lib/**/*']).uniq
|
@@ -17,23 +19,30 @@ scripts = %w{
|
|
17
19
|
lib/setup/base.rb
|
18
20
|
lib/setup/compiler.rb
|
19
21
|
lib/setup/configuration.rb
|
20
|
-
lib/setup/documentor.rb
|
21
22
|
lib/setup/installer.rb
|
22
23
|
lib/setup/tester.rb
|
23
24
|
lib/setup/uninstaller.rb
|
24
25
|
lib/setup/command.rb
|
25
|
-
bin/setup.rb
|
26
26
|
}
|
27
27
|
|
28
|
+
version = YAML.load_file('.ruby')['version']
|
29
|
+
|
28
30
|
comment = <<-HERE
|
29
|
-
#
|
30
|
-
# Setup.rb, #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}
|
31
|
+
# Setup.rb v#{version}
|
31
32
|
#
|
32
33
|
# This is a stand-alone bundle of the setup.rb application.
|
33
34
|
# You can place it in your projects script/ directory, or
|
34
|
-
#
|
35
|
+
# call it 'setup.rb' and place it in your project's
|
35
36
|
# root directory (just like old times).
|
36
37
|
#
|
38
|
+
# NOTE: As of version 5.1.0 this bundled rendition is also
|
39
|
+
# being used for the bin/setup.rb exe. Rather than the previous:
|
40
|
+
#
|
41
|
+
# require 'setup/command'
|
42
|
+
# Setup::Command.run
|
43
|
+
#
|
44
|
+
# By doing so, +rvm+ should be able to use it across all rubies
|
45
|
+
# without issue and without needing to install it for each.
|
37
46
|
HERE
|
38
47
|
|
39
48
|
#
|
@@ -44,6 +53,7 @@ scripts.each do |script|
|
|
44
53
|
bundle << "\n\n# %-16s #{"#" * 60}\n\n" % File.basename(script)
|
45
54
|
bundle << File.read(script)
|
46
55
|
end
|
56
|
+
bundle << "\nSetup::Command.run"
|
47
57
|
|
48
58
|
# remove setup requires
|
49
59
|
bundle.gsub!(/require\s+["']setup\/(.*?)["']\s*$/, '')
|
@@ -60,5 +70,12 @@ File.open('script/setup', 'w') do |f|
|
|
60
70
|
f << comment
|
61
71
|
f << bundle
|
62
72
|
end
|
63
|
-
|
64
73
|
FileUtils.chmod(0744, 'script/setup')
|
74
|
+
|
75
|
+
File.open('bin/setup.rb', 'w') do |f|
|
76
|
+
f << "#!/usr/bin/env ruby\n"
|
77
|
+
f << comment
|
78
|
+
f << bundle
|
79
|
+
end
|
80
|
+
FileUtils.chmod(0744, 'bin/setup.rb')
|
81
|
+
|
data/script/setup
CHANGED
@@ -1,14 +1,35 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Setup.rb, 2010-02-07 08:33:15
|
2
|
+
# Setup.rb v5.1.0
|
4
3
|
#
|
5
4
|
# This is a stand-alone bundle of the setup.rb application.
|
6
5
|
# You can place it in your projects script/ directory, or
|
7
|
-
#
|
6
|
+
# call it 'setup.rb' and place it in your project's
|
8
7
|
# root directory (just like old times).
|
9
8
|
#
|
9
|
+
# NOTE: As of version 5.1.0 this bundled rendition is also
|
10
|
+
# being used for the bin/setup.rb exe. Rather than the previous:
|
11
|
+
#
|
12
|
+
# require 'setup/command'
|
13
|
+
# Setup::Command.run
|
14
|
+
#
|
15
|
+
# By doing so, +rvm+ should be able to use it across all rubies
|
16
|
+
# without issue and without needing to install it for each.
|
17
|
+
require 'yaml'
|
10
18
|
module Setup
|
11
|
-
|
19
|
+
DIRECTORY = File.dirname(__FILE__) + '/setup'
|
20
|
+
PROFILE = YAML.load(File.new(DIRECTORY + '/profile.yml'))
|
21
|
+
verfile = YAML.load(File.new(DIRECTORY + '/version.yml'))
|
22
|
+
VERSION = verfile.values_at('major','minor','patch','state','build').compact.join('.')
|
23
|
+
def self.const_missing(name)
|
24
|
+
key = name.to_s.downcase
|
25
|
+
if verfile.key?(key)
|
26
|
+
verfile[key]
|
27
|
+
elsif profile.key?(key)
|
28
|
+
PROFILE[key]
|
29
|
+
else
|
30
|
+
super(name)
|
31
|
+
end
|
32
|
+
end
|
12
33
|
end
|
13
34
|
class << File #:nodoc: all
|
14
35
|
unless respond_to?(:read) # Ruby 1.6 and less
|
@@ -29,14 +50,42 @@ end
|
|
29
50
|
module Setup
|
30
51
|
META_EXTENSION_DIR = '.setup'
|
31
52
|
FILETYPES = %w( bin lib ext data etc man doc )
|
32
|
-
INSTALL_RECORD = '
|
53
|
+
INSTALL_RECORD = 'SetupReceipt'
|
54
|
+
CONFIG_FILE = 'SetupConfig'
|
33
55
|
end
|
34
56
|
module Setup
|
35
57
|
class Project
|
36
|
-
ROOT_MARKER = '{setup.rb
|
58
|
+
ROOT_MARKER = '{.ruby,setup.rb,.setup,lib/}'
|
59
|
+
def initialize
|
60
|
+
@dotruby_file = find('.ruby')
|
61
|
+
@dotruby = YAML.load_file(@dotruby_file) if @dotruby_file
|
62
|
+
@name = nil
|
63
|
+
@version = nil
|
64
|
+
@loadpath = ['lib']
|
65
|
+
if @dotruby
|
66
|
+
@name = @dotruby['name']
|
67
|
+
@version = @dotruby['version']
|
68
|
+
@loadpath = @dotruby['load_path']
|
69
|
+
else
|
70
|
+
if file = find('.setup/name')
|
71
|
+
@name = File.read(file).strip
|
72
|
+
end
|
73
|
+
if file = find('.setup/version')
|
74
|
+
@version = File.read(file).strip
|
75
|
+
end
|
76
|
+
if file = find('.setup/loadpath')
|
77
|
+
@loadpath = File.read(file).strip
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
attr :dotruby
|
82
|
+
attr :name
|
83
|
+
attr :version
|
84
|
+
attr :loadpath
|
85
|
+
alias load_path loadpath
|
37
86
|
def rootdir
|
38
87
|
@rootdir ||= (
|
39
|
-
root = Dir
|
88
|
+
root = Dir.glob(File.join(Dir.pwd, ROOT_MARKER), File::FNM_CASEFOLD).first
|
40
89
|
if !root
|
41
90
|
raise Error, "not a project directory"
|
42
91
|
else
|
@@ -44,27 +93,6 @@ module Setup
|
|
44
93
|
end
|
45
94
|
)
|
46
95
|
end
|
47
|
-
def name
|
48
|
-
@name = (
|
49
|
-
if file = Dir["{script/setup,meta,.meta}/name"].first
|
50
|
-
File.read(file).strip
|
51
|
-
else
|
52
|
-
nil
|
53
|
-
end
|
54
|
-
)
|
55
|
-
end
|
56
|
-
def loadpath
|
57
|
-
@loadpath ||= (
|
58
|
-
if file = Dir.glob('{script/setup,meta,.meta}/loadpath').first
|
59
|
-
raw = File.read(file).strip.chomp(']')
|
60
|
-
raw.split(/[\n,]/).map do |e|
|
61
|
-
e.strip.sub(/^[\[-]\s*/,'')
|
62
|
-
end
|
63
|
-
else
|
64
|
-
nil
|
65
|
-
end
|
66
|
-
)
|
67
|
-
end
|
68
96
|
def extconfs
|
69
97
|
@extconfs ||= Dir['ext/**/extconf.rb']
|
70
98
|
end
|
@@ -74,6 +102,21 @@ module Setup
|
|
74
102
|
def compiles?
|
75
103
|
!extensions.empty?
|
76
104
|
end
|
105
|
+
def yardopts
|
106
|
+
Dir.glob(File.join(rootdir, '.yardopts')).first
|
107
|
+
end
|
108
|
+
def document
|
109
|
+
Dir.glob(File.join(rootdir, '.document')).first
|
110
|
+
end
|
111
|
+
def find(glob, flags=0)
|
112
|
+
case flags
|
113
|
+
when :casefold
|
114
|
+
flags = File::FNM_CASEFOLD
|
115
|
+
else
|
116
|
+
flags = flags.to_i
|
117
|
+
end
|
118
|
+
Dir.glob(File.join(rootdir, glob), flags).first
|
119
|
+
end
|
77
120
|
end
|
78
121
|
end
|
79
122
|
module Setup
|
@@ -94,9 +137,11 @@ module Setup
|
|
94
137
|
@options[:trace] = val
|
95
138
|
end
|
96
139
|
def trial?; @options[:trial]; end
|
140
|
+
alias_method :dryrun?, :trial?
|
97
141
|
def trial=(val)
|
98
142
|
@options[:trial] = val
|
99
143
|
end
|
144
|
+
alias_method :dryrun=, :trial=
|
100
145
|
def quiet?; @options[:quiet]; end
|
101
146
|
def quiet=(val)
|
102
147
|
@options[:quiet] = val
|
@@ -109,37 +154,34 @@ module Setup
|
|
109
154
|
configuration.compile? && project.compiles?
|
110
155
|
end
|
111
156
|
def all
|
112
|
-
|
113
|
-
|
114
|
-
make
|
115
|
-
end
|
157
|
+
config
|
158
|
+
compile
|
116
159
|
if configuration.test?
|
117
160
|
ok = test
|
118
161
|
exit 1 unless ok
|
119
162
|
end
|
120
163
|
install
|
121
|
-
if configuration.ri?
|
122
|
-
document
|
123
|
-
end
|
124
164
|
end
|
125
165
|
def config
|
126
|
-
log_header('
|
166
|
+
log_header('Preconfig')
|
127
167
|
if configuration.save_config
|
128
|
-
io.
|
168
|
+
io.print "#{CONFIG_FILE} was saved. " unless quiet?
|
129
169
|
else
|
130
|
-
io.
|
170
|
+
io.print "#{CONFIG_FILE} is current. " unless quiet?
|
131
171
|
end
|
172
|
+
io.puts "Edit to customize configuration." unless quiet?
|
132
173
|
puts configuration if trace? && !quiet?
|
133
|
-
compiler.configure if compile? #compiler.compiles?
|
134
174
|
end
|
135
|
-
def
|
136
|
-
|
137
|
-
|
138
|
-
|
175
|
+
def compile
|
176
|
+
if compile?
|
177
|
+
log_header('Compile')
|
178
|
+
compiler.configure
|
179
|
+
compiler.compile
|
180
|
+
end
|
139
181
|
end
|
182
|
+
alias_method :make, :compile
|
140
183
|
alias_method :setup, :make
|
141
184
|
def install
|
142
|
-
abort "must run 'setup config' first" unless configuration.exist?
|
143
185
|
log_header('Install')
|
144
186
|
installer.install
|
145
187
|
end
|
@@ -148,10 +190,6 @@ module Setup
|
|
148
190
|
log_header('Test')
|
149
191
|
tester.test
|
150
192
|
end
|
151
|
-
def document
|
152
|
-
log_header('Document')
|
153
|
-
documentor.document
|
154
|
-
end
|
155
193
|
def clean
|
156
194
|
log_header('Clean')
|
157
195
|
compiler.clean
|
@@ -187,9 +225,6 @@ module Setup
|
|
187
225
|
def tester
|
188
226
|
@tester ||= Tester.new(project, configuration, options)
|
189
227
|
end
|
190
|
-
def documentor
|
191
|
-
@documentor ||= Documentor.new(project, configuration, options)
|
192
|
-
end
|
193
228
|
def uninstaller
|
194
229
|
@uninstaller ||= Uninstaller.new(project, configuration, options)
|
195
230
|
end
|
@@ -331,8 +366,7 @@ require 'shellwords'
|
|
331
366
|
module Setup
|
332
367
|
class Configuration
|
333
368
|
RBCONFIG = ::Config::CONFIG
|
334
|
-
|
335
|
-
META_CONFIG_FILE = META_EXTENSION_DIR + '/configuration.rb'
|
369
|
+
META_CONFIG_FILE = META_EXTENSION_DIR + '/metaconfig.rb'
|
336
370
|
def self.options
|
337
371
|
@@options ||= []
|
338
372
|
end
|
@@ -362,7 +396,6 @@ module Setup
|
|
362
396
|
option :extconfopt , :opts, 'options to pass-thru to extconf.rb'
|
363
397
|
option :shebang , :pick, 'shebang line (#!) editing mode (all,ruby,never)'
|
364
398
|
option :no_test, :t , :bool, 'run pre-installation tests'
|
365
|
-
option :no_ri, :d , :bool, 'generate ri documentation'
|
366
399
|
option :no_doc , :bool, 'install doc/ directory'
|
367
400
|
option :no_ext , :bool, 'compile/install ruby extentions'
|
368
401
|
option :install_prefix , :path, 'install to alternate root location'
|
@@ -393,9 +426,9 @@ module Setup
|
|
393
426
|
initialize_metaconfig
|
394
427
|
initialize_defaults
|
395
428
|
initialize_environment
|
396
|
-
initialize_configfile
|
429
|
+
initialize_configfile unless values[:reset]
|
397
430
|
values.each{ |k,v| __send__("#{k}=", v) }
|
398
|
-
|
431
|
+
yield(self) if block_given?
|
399
432
|
end
|
400
433
|
def initialize_metaconfig
|
401
434
|
if File.exist?(META_CONFIG_FILE)
|
@@ -407,7 +440,7 @@ module Setup
|
|
407
440
|
self.type = 'site'
|
408
441
|
self.no_ri = true
|
409
442
|
self.no_test = true
|
410
|
-
self.no_doc =
|
443
|
+
self.no_doc = true
|
411
444
|
self.no_ext = false
|
412
445
|
end
|
413
446
|
def initialize_environment
|
@@ -418,7 +451,7 @@ module Setup
|
|
418
451
|
end
|
419
452
|
end
|
420
453
|
def initialize_configfile
|
421
|
-
if
|
454
|
+
if exist?
|
422
455
|
erb = ERB.new(File.read(CONFIG_FILE))
|
423
456
|
txt = erb.result(binding)
|
424
457
|
dat = YAML.load(txt)
|
@@ -436,6 +469,7 @@ module Setup
|
|
436
469
|
end
|
437
470
|
end
|
438
471
|
end
|
472
|
+
attr_accessor :reset
|
439
473
|
def base_bindir
|
440
474
|
@base_bindir ||= subprefix('bindir')
|
441
475
|
end
|
@@ -653,9 +687,6 @@ module Setup
|
|
653
687
|
def test?
|
654
688
|
!no_test
|
655
689
|
end
|
656
|
-
def ri?
|
657
|
-
!no_ri
|
658
|
-
end
|
659
690
|
def doc?
|
660
691
|
!no_doc
|
661
692
|
end
|
@@ -772,96 +803,6 @@ end #module Setup
|
|
772
803
|
end
|
773
804
|
end
|
774
805
|
=end
|
775
|
-
module Setup
|
776
|
-
class Documentor < Base
|
777
|
-
def document
|
778
|
-
return if config.no_doc
|
779
|
-
exec_ri
|
780
|
-
end
|
781
|
-
def exec_ri
|
782
|
-
case config.type #installdirs
|
783
|
-
when 'std', 'ruby'
|
784
|
-
output = "--ri-site"
|
785
|
-
when 'site'
|
786
|
-
output = "--ri-site"
|
787
|
-
when 'home'
|
788
|
-
output = "--ri"
|
789
|
-
else
|
790
|
-
abort "bad config: should not be possible -- type=#{config.type}"
|
791
|
-
end
|
792
|
-
if File.exist?('.document')
|
793
|
-
files = File.read('.document').split("\n")
|
794
|
-
files.reject!{ |l| l =~ /^\s*[#]/ || l !~ /\S/ }
|
795
|
-
files.collect!{ |f| f.strip }
|
796
|
-
else
|
797
|
-
files = []
|
798
|
-
files << 'lib' if File.directory?('lib')
|
799
|
-
files << 'ext' if File.directory?('ext')
|
800
|
-
end
|
801
|
-
opt = []
|
802
|
-
opt << "-U"
|
803
|
-
opt << "-q" #if quiet?
|
804
|
-
opt << output
|
805
|
-
opt << files
|
806
|
-
opt = opt.flatten
|
807
|
-
cmd = "rdoc " + opt.join(' ')
|
808
|
-
if trial?
|
809
|
-
puts cmd
|
810
|
-
else
|
811
|
-
begin
|
812
|
-
success = system(cmd)
|
813
|
-
raise unless success
|
814
|
-
io.puts "Ok ri." #unless quiet?
|
815
|
-
rescue Exception
|
816
|
-
$stderr.puts "ri generation failed"
|
817
|
-
$stderr.puts "command was: '#{cmd}'"
|
818
|
-
end
|
819
|
-
end
|
820
|
-
end
|
821
|
-
def exec_rdoc
|
822
|
-
main = Dir.glob("README{,.*}", File::FNM_CASEFOLD).first
|
823
|
-
if File.exist?('.document')
|
824
|
-
files = File.read('.document').split("\n")
|
825
|
-
files.reject!{ |l| l =~ /^\s*[#]/ || l !~ /\S/ }
|
826
|
-
files.collect!{ |f| f.strip }
|
827
|
-
else
|
828
|
-
files = []
|
829
|
-
files << main if main
|
830
|
-
files << 'lib' if File.directory?('lib')
|
831
|
-
files << 'ext' if File.directory?('ext')
|
832
|
-
end
|
833
|
-
checkfiles = (files + files.map{ |f| Dir[File.join(f,'*','**')] }).flatten.uniq
|
834
|
-
if FileUtils.uptodate?('doc/rdoc', checkfiles)
|
835
|
-
puts "RDocs look current."
|
836
|
-
return
|
837
|
-
end
|
838
|
-
output = 'doc/rdoc'
|
839
|
-
title = (PACKAGE.capitalize + " API").strip if PACKAGE
|
840
|
-
template = config.doctemplate || 'html'
|
841
|
-
opt = []
|
842
|
-
opt << "-U"
|
843
|
-
opt << "-q" #if quiet?
|
844
|
-
opt << "--op=#{output}"
|
845
|
-
opt << "--title=#{title}"
|
846
|
-
opt << "--main=#{main}" if main
|
847
|
-
opt << files
|
848
|
-
opt = opt.flatten
|
849
|
-
cmd = "rdoc " + opt.join(' ')
|
850
|
-
if trial?
|
851
|
-
puts cmd
|
852
|
-
else
|
853
|
-
begin
|
854
|
-
system(cmd)
|
855
|
-
puts "Ok rdoc." unless quiet?
|
856
|
-
rescue Exception
|
857
|
-
puts "Fail rdoc."
|
858
|
-
puts "Command was: '#{cmd}'"
|
859
|
-
puts "Proceeding with install anyway."
|
860
|
-
end
|
861
|
-
end
|
862
|
-
end
|
863
|
-
end
|
864
|
-
end
|
865
806
|
module Setup
|
866
807
|
class Installer < Base
|
867
808
|
def install_prefix
|
@@ -924,7 +865,7 @@ module Setup
|
|
924
865
|
return unless config.doc?
|
925
866
|
return unless directory?('doc')
|
926
867
|
return unless project.name
|
927
|
-
dir = File.join(config.docdir, "ruby
|
868
|
+
dir = File.join(config.docdir, "ruby-#{project.name}")
|
928
869
|
report_transfer('doc', dir)
|
929
870
|
files = files('doc')
|
930
871
|
install_files('doc', files, dir, 0644)
|
@@ -1201,16 +1142,15 @@ module Setup
|
|
1201
1142
|
tasks[name] = description
|
1202
1143
|
order << name
|
1203
1144
|
end
|
1204
|
-
task 'all' , "config, setup, test, install"
|
1205
|
-
task 'config' , "saves your configuration"
|
1206
1145
|
task 'show' , "show current configuration"
|
1207
|
-
task '
|
1146
|
+
task 'all' , "config, compile and install"
|
1147
|
+
task 'config' , "save/customize configuration settings"
|
1148
|
+
task 'compile' , "compile ruby extentions"
|
1208
1149
|
task 'test' , "run test suite"
|
1209
|
-
task 'doc' , "generate ri documentation"
|
1210
1150
|
task 'install' , "install project files"
|
1211
|
-
task 'uninstall', "uninstall previously installed files"
|
1212
1151
|
task 'clean' , "does `make clean' for each extention"
|
1213
1152
|
task 'distclean', "does `make distclean' for each extention"
|
1153
|
+
task 'uninstall', "uninstall previously installed files"
|
1214
1154
|
def run(*argv)
|
1215
1155
|
ARGV.replace(argv) unless argv.empty?
|
1216
1156
|
task = ARGV.find{ |a| a !~ /^[-]/ }
|
@@ -1224,12 +1164,14 @@ module Setup
|
|
1224
1164
|
parser.banner = "Usage: #{File.basename($0)} [TASK] [OPTIONS]"
|
1225
1165
|
optparse_header(parser, options)
|
1226
1166
|
case task
|
1227
|
-
when 'all'
|
1228
|
-
optparse_all(parser, options)
|
1229
1167
|
when 'config'
|
1230
1168
|
optparse_config(parser, options)
|
1169
|
+
when 'compile'
|
1170
|
+
optparse_compile(parser, options)
|
1231
1171
|
when 'install'
|
1232
1172
|
optparse_install(parser, options)
|
1173
|
+
when 'all'
|
1174
|
+
optparse_all(parser, options)
|
1233
1175
|
end
|
1234
1176
|
optparse_common(parser, options)
|
1235
1177
|
begin
|
@@ -1240,6 +1182,11 @@ module Setup
|
|
1240
1182
|
end
|
1241
1183
|
rootdir = session.project.rootdir
|
1242
1184
|
print_header
|
1185
|
+
begin
|
1186
|
+
$stderr.puts "(#{RUBY_ENGINE} #{RUBY_VERSION} #{RUBY_PLATFORM})"
|
1187
|
+
rescue
|
1188
|
+
$stderr.puts "(#{RUBY_VERSION} #{RUBY_PLATFORM})"
|
1189
|
+
end
|
1243
1190
|
begin
|
1244
1191
|
session.__send__(task)
|
1245
1192
|
rescue Error => err
|
@@ -1261,6 +1208,8 @@ module Setup
|
|
1261
1208
|
end
|
1262
1209
|
def optparse_all(parser, options)
|
1263
1210
|
optparse_config(parser, options)
|
1211
|
+
optparse_compile(parser, options)
|
1212
|
+
optparse_install(parser, options) # TODO: why was this remarked out ?
|
1264
1213
|
end
|
1265
1214
|
def optparse_config(parser, options)
|
1266
1215
|
parser.separator ""
|
@@ -1287,19 +1236,28 @@ module Setup
|
|
1287
1236
|
end
|
1288
1237
|
end
|
1289
1238
|
else
|
1290
|
-
opts = shortcut ? ["-#{shortcut}", "--#{optname} #{type.to_s.upcase}", desc] :
|
1239
|
+
opts = shortcut ? ["-#{shortcut}", "--#{optname} #{type.to_s.upcase}", desc] :
|
1240
|
+
["--#{optname} #{type.to_s.upcase}", desc]
|
1291
1241
|
parser.on(*opts) do |val|
|
1292
1242
|
configuration.__send__("#{name}=", val)
|
1293
1243
|
end
|
1294
1244
|
end
|
1295
1245
|
end
|
1296
1246
|
end
|
1247
|
+
def optparse_compile(parser, options)
|
1248
|
+
end
|
1297
1249
|
def optparse_install(parser, options)
|
1298
|
-
parser.separator
|
1299
|
-
parser.separator
|
1300
|
-
parser.on(
|
1250
|
+
parser.separator ''
|
1251
|
+
parser.separator 'Install options:'
|
1252
|
+
parser.on('--prefix PATH', 'install to alternate root location') do |val|
|
1301
1253
|
configuration.install_prefix = val
|
1302
1254
|
end
|
1255
|
+
parser.on('--type TYPE', "install location mode (site,std,home)") do |val|
|
1256
|
+
configuration.type = val
|
1257
|
+
end
|
1258
|
+
parser.on('-t', '--[no-]test', "run pre-installation tests") do |bool|
|
1259
|
+
configuration.test = bool
|
1260
|
+
end
|
1303
1261
|
end
|
1304
1262
|
def optparse_common(parser, options)
|
1305
1263
|
parser.separator ""
|
@@ -1341,4 +1299,4 @@ module Setup
|
|
1341
1299
|
end
|
1342
1300
|
end
|
1343
1301
|
end
|
1344
|
-
Setup::Command.run
|
1302
|
+
Setup::Command.run
|