setup 4.2.0 → 5.0.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.
Files changed (55) hide show
  1. data/HISTORY +47 -3
  2. data/MANIFEST +49 -16
  3. data/README.rdoc +148 -0
  4. data/bin/setup.rb +1 -5
  5. data/lib/setup.rb +2 -2
  6. data/lib/setup/base.rb +143 -0
  7. data/lib/setup/command.rb +218 -114
  8. data/lib/setup/compiler.rb +69 -0
  9. data/lib/setup/configuration.rb +822 -0
  10. data/lib/setup/constants.rb +12 -0
  11. data/lib/setup/{rubyver.rb → core_ext.rb} +0 -0
  12. data/lib/setup/documentor.rb +149 -0
  13. data/lib/setup/installer.rb +363 -0
  14. data/lib/setup/project.rb +68 -0
  15. data/lib/setup/rake.rb +44 -45
  16. data/lib/setup/session.rb +233 -0
  17. data/lib/setup/tester.rb +92 -0
  18. data/lib/setup/uninstaller.rb +76 -0
  19. data/meta/active +1 -0
  20. data/meta/collection +1 -0
  21. data/meta/{abstract → description} +0 -0
  22. data/meta/{package → name} +0 -0
  23. data/meta/repository +1 -0
  24. data/meta/ruby +3 -0
  25. data/meta/version +1 -1
  26. data/script/bstrap +5 -0
  27. data/script/bundle +64 -0
  28. data/script/setup +1338 -0
  29. data/script/test +3 -0
  30. data/test/cases/installer.rb +28 -0
  31. data/test/features/config.feature +16 -0
  32. data/test/features/document.feature +2 -0
  33. data/test/features/install.feature +72 -0
  34. data/test/features/make.feature +18 -0
  35. data/test/features/step_definitions/common_steps.rb +34 -0
  36. data/test/features/step_definitions/config_steps.rb +24 -0
  37. data/test/features/step_definitions/env.rb +37 -0
  38. data/test/features/step_definitions/install_steps.rb +75 -0
  39. data/test/features/step_definitions/setup_steps.rb +30 -0
  40. data/test/features/step_definitions/uninstall_steps.rb +8 -0
  41. data/test/features/test.feature +2 -0
  42. data/test/features/uninstall.feature +13 -0
  43. data/test/fixtures/faux-project/bin/faux +3 -0
  44. data/test/fixtures/faux-project/ext/faux/extconf.rb +12 -0
  45. data/test/fixtures/faux-project/ext/faux/faux.c +24 -0
  46. data/test/fixtures/faux-project/lib/faux.rb +1 -0
  47. metadata +58 -29
  48. data/README +0 -106
  49. data/RELEASE +0 -41
  50. data/lib/setup/build.rb +0 -2
  51. data/lib/setup/config.rb +0 -452
  52. data/lib/setup/error.rb +0 -4
  53. data/lib/setup/install.rb +0 -1007
  54. data/meta/setup/metaconfig.rb +0 -3
  55. data/test/test_installer.rb +0 -139
data/HISTORY CHANGED
@@ -1,5 +1,46 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 5.0.0 / 2010-01-12
4
+
5
+ Version 5 represents a major milestone in Setup.rb's development.
6
+ While the 4.x series focused on improving on aspects of the
7
+ orginal 3.4.1 code base by Minero Aoki, this version takes the next step
8
+ and reworks the entire script into an truly object-oriented design.
9
+ In so doing, the system no longer traverses project directories
10
+ one-by-one installing or compiling files as they are come across,
11
+ but instead collects a list of files to handle up front, then iterates
12
+ through them performing the required action.
13
+
14
+ Changes:
15
+
16
+ * 5 Major Changes
17
+
18
+ * Split script into distinct classes, one for each setup phase.
19
+ * Testing is handled by optional script/test or .setup/testrc.rb file.
20
+ * Renamed 'setup' phase to 'make' phase.
21
+ * Deprecated MetaConfig API; support singleton extensions instead.
22
+ * Deprecated support for Ruby versions older than v1.6.2.
23
+
24
+ * 3 Minor Changes
25
+
26
+ * Returned to using InstalledFiles for record installation and improved.
27
+ * Use SetupConfig instead of .cache/setup/config to store system configuration.
28
+ * Improved configuration options (eg. can use --type instead of --installdirs)
29
+
30
+
31
+ == 4.2.1 / 2009-08-26
32
+
33
+ This release add support for multiple loadpaths. Add a list of them
34
+ to meta/loadpath, and they will be installed. For example, the is used
35
+ in Facets to install both lib/more and lib/core.
36
+
37
+ Changes:
38
+
39
+ * 1 Major Enhancement
40
+
41
+ * meta/loadpath is now supported if you have multiple paths to install.
42
+
43
+
3
44
  == 4.2.0 / 2009-08-26
4
45
 
5
46
  This release finally gets rdoc generation and doc installation working.
@@ -68,10 +109,13 @@ Changes:
68
109
  == 4.0.0 / 2008-08-15
69
110
 
70
111
  This is the first whack at making setup.rb a stand-alone application.
112
+ Basically I have reverse engineered Aoki's 3.4.1 version of setup.rb,
113
+ and then reworked some of the code to make it more modern, including
114
+ retro-fitting it to use OptionParser. Some features of the original
115
+ are no longer supported, such a metaconfig and multi-package installs.
71
116
 
72
117
  Changes:
73
118
 
74
- * 3 Other Enhancements
75
-
76
- * Initial checkin.
119
+ * Same basic code as 3.4.1, but many parts have been refit.
120
+ * Initial checkin to git repostitory.
77
121
 
data/MANIFEST CHANGED
@@ -1,31 +1,64 @@
1
1
  COPYING
2
2
  HISTORY
3
3
  MANIFEST
4
- README
5
- RELEASE
6
- bin
4
+ README.rdoc
7
5
  bin/setup.rb
8
- lib
9
6
  lib/setup
10
7
  lib/setup.rb
11
- lib/setup/build.rb
8
+ lib/setup/base.rb
12
9
  lib/setup/command.rb
13
- lib/setup/config.rb
14
- lib/setup/error.rb
15
- lib/setup/install.rb
10
+ lib/setup/compiler.rb
11
+ lib/setup/configuration.rb
12
+ lib/setup/constants.rb
13
+ lib/setup/core_ext.rb
14
+ lib/setup/documentor.rb
15
+ lib/setup/installer.rb
16
+ lib/setup/project.rb
16
17
  lib/setup/rake.rb
17
- lib/setup/rubyver.rb
18
- meta
19
- meta/abstract
18
+ lib/setup/session.rb
19
+ lib/setup/tester.rb
20
+ lib/setup/uninstaller.rb
21
+ meta/active
20
22
  meta/authors
23
+ meta/collection
21
24
  meta/contact
22
25
  meta/created
26
+ meta/description
23
27
  meta/homepage
24
- meta/package
28
+ meta/name
25
29
  meta/released
26
- meta/setup
27
- meta/setup/metaconfig.rb
30
+ meta/repository
31
+ meta/ruby
28
32
  meta/summary
29
33
  meta/version
30
- test
31
- test/test_installer.rb
34
+ script/bstrap
35
+ script/bundle
36
+ script/setup
37
+ script/test
38
+ test/cases
39
+ test/cases/installer.rb
40
+ test/features
41
+ test/features/config.feature
42
+ test/features/document.feature
43
+ test/features/install.feature
44
+ test/features/make.feature
45
+ test/features/step_definitions
46
+ test/features/step_definitions/common_steps.rb
47
+ test/features/step_definitions/config_steps.rb
48
+ test/features/step_definitions/env.rb
49
+ test/features/step_definitions/install_steps.rb
50
+ test/features/step_definitions/setup_steps.rb
51
+ test/features/step_definitions/uninstall_steps.rb
52
+ test/features/test.feature
53
+ test/features/uninstall.feature
54
+ test/fixtures
55
+ test/fixtures/faux-project
56
+ test/fixtures/faux-project/bin
57
+ test/fixtures/faux-project/bin/faux
58
+ test/fixtures/faux-project/ext
59
+ test/fixtures/faux-project/ext/faux
60
+ test/fixtures/faux-project/ext/faux/extconf.rb
61
+ test/fixtures/faux-project/ext/faux/faux.c
62
+ test/fixtures/faux-project/lib
63
+ test/fixtures/faux-project/lib/faux.rb
64
+ test/fixtures/faux-project/script
@@ -0,0 +1,148 @@
1
+ = Ruby Setup
2
+
3
+ * http://protuils.github.com/setup
4
+ * http://github.com/protuils/setup
5
+
6
+
7
+ == INTRODUCTION
8
+
9
+ Every well practiced Rubyist is aware of Minero Aoki's ever +setup.rb+
10
+ script. It's how most of us used to install our Ruby programs before RubyGems
11
+ came along. And it's still mighty useful in certain scenarios, not the
12
+ least of which is the job of the distro package maintainer.
13
+
14
+ Ruby Setup converts setup.rb into a stand-alone application. No longer
15
+ requiring the distribution of the setup.rb script with every Ruby package.
16
+ Just instruct one's users to install Ruby Setup (gem install setup) and go
17
+ from there. As long as a project is setup.rb compliant, as most are,
18
+ then there is little to nothing it's developer must do.
19
+
20
+
21
+ === IMPORTANT
22
+
23
+ There a couple very important difference between the old 3.4.1 verison
24
+ of the setup.rb and Ruby Setup.
25
+
26
+ * The directory convention 'conf' has been change to 'etc'.
27
+ * Multi-package project layouts are no longer supported.
28
+ * Metaconfig and Hooks are handled via singleton extensions.
29
+ * No longer supports versions of Ruby older than v1.6.3.
30
+ * The +setup+ phase has been renamed to the +make+ phase.
31
+
32
+ === STATUS
33
+
34
+ Version 5 is a major re-engineering of setup.rb. Although it is fairly well
35
+ tested, as such, it should be considered betaware until it accumulates
36
+ enough use in the field. I will update this message when I feel a new status
37
+ has been achieved (likely accompanied by an updated release).
38
+
39
+
40
+ == INSTALLATION
41
+
42
+ The easy way to install is via RubyGems.
43
+
44
+ $ sudo gem install setup
45
+
46
+ To install Setup manually you need to "boot-strap" it. Download the tarball,
47
+ and from the decompressed package directory run:
48
+
49
+ $ ruby script/setup
50
+
51
+
52
+ == HOW TO USE
53
+
54
+ To use setup.rb, a project must conform to the setup.rb standard layout.
55
+ Please see the documentation on the website if you need to know more about
56
+ what this entails. Most project already follow the standard since it was
57
+ setup.rb that originally popularized most of the current layout conventions.
58
+ (Note that the on-line documentation is slightly out of sync with the latest
59
+ release.)
60
+
61
+ Usage is as simple as:
62
+
63
+ $ setup.rb
64
+
65
+ This is the same as using the <tt>all</tt> subcommand.
66
+
67
+ $ setup.rb all
68
+
69
+ And is equivalent to running the three main phases in sequence.
70
+
71
+ $ setup.rb config
72
+ $ setup.rb make
73
+ $ setup.rb install
74
+
75
+ Where +config+ determines the configuration of your Ruby distribution,
76
+ +make+ compiles any extensions and +install+ copies project files to
77
+ the appropriate places on your system.
78
+
79
+ Setup.rb also supports two optional phases, +test+ and +document+.
80
+
81
+ $ setup.rb test
82
+
83
+ This will run tests if a test script is provided. If should be run after
84
+ +make+, but before +install+. Because there are now a deverse selection
85
+ of testing tools available for Ruby, testing only happens if the developer
86
+ has provided a test run command script (eg. <tt>.setup/testrc.rb</tt>).
87
+ Keep in mind that testing may require support libraries such as RSpec,
88
+ Lemon, Bacon, QED or Cucumber. When using the +all+ command, you can
89
+ activate testing via the <tt>--test</tt> or <tt>-t</tt> option if desired.
90
+
91
+ The +document+ phase is used to generate ri documentation for a package.
92
+
93
+ $ setup.rb document
94
+
95
+ This generates *ri* documents for the program and automatically
96
+ places the documentation in the appropriate system location. Documenting
97
+ is not part of the default sequence due to the way ri documentation is
98
+ handled by the +rdoc+ tool. It is not possible to uninstall it. So this
99
+ phase must be run seperate from the others. Please only use the +document+
100
+ command when you are ceratin that you want the documentation in your ri
101
+ system. (Hopefully this can be fixed in the near future.)
102
+
103
+ If you later decide you want to remove a program from your system, use
104
+ +uninstall+.
105
+
106
+ $ setup.rb uninstall
107
+
108
+ This will remove all files previously installed via the setup.rb command.
109
+ Uninstalling is made possible by the 'InstalledFiles' file that is
110
+ generated by the install process. If that file is deleted than you
111
+ will not be able to uninstall. (You can get around this be reinstalling
112
+ first though).
113
+
114
+ During the make phase, by-product files are generally created.
115
+ You can clean up any of these by-products with:
116
+
117
+ $ setup.rb clean
118
+
119
+ And restore them to their absolute pristine state with:
120
+
121
+ $ setup.rb distclean
122
+
123
+ For further details on using +setup.rb+, or developing a project that can
124
+ take advantage of setup.rb's special features, please see the website.
125
+
126
+
127
+ == COPYRIGHTS
128
+
129
+ Copyright (c) 2008,2009 Thomas Sawyer
130
+
131
+ Copyright (c) 2002,2005 Minero Aoki
132
+
133
+ GNU LGPL, Lesser General Public License version 2.1.
134
+
135
+ For details of LGPL, see the COPYING file.
136
+
137
+
138
+
139
+ 7trans
140
+ transfire@gmail.com
141
+ http://proutils.github.com
142
+
143
+
144
+ Minero Aoki
145
+ aamine@loveruby.net
146
+ http://i.loveruby.net
147
+
148
+
@@ -1,7 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
1
+ #! /usr/bin/ruby1.8
3
2
  require 'setup/command'
4
-
5
3
  Setup::Command.run
6
-
7
-
@@ -1,3 +1,3 @@
1
1
  module Setup
2
- VERSION = '4.1.1'
3
- end
2
+ VERSION = '5.0.0'
3
+ end
@@ -0,0 +1,143 @@
1
+ require 'setup/core_ext'
2
+ require 'setup/constants'
3
+
4
+ module Setup
5
+
6
+ # Common base class for all Setup build classes.
7
+ #
8
+ class Base
9
+
10
+ #
11
+ attr :project
12
+
13
+ #
14
+ attr :config
15
+
16
+ #
17
+ attr_accessor :trial
18
+
19
+ #
20
+ attr_accessor :trace
21
+
22
+ #
23
+ attr_accessor :quiet
24
+
25
+ #
26
+ attr_accessor :force
27
+
28
+ #
29
+ attr_accessor :io
30
+
31
+ #
32
+ def initialize(project, configuration, options={})
33
+ @project = project
34
+ @config = configuration
35
+
36
+ initialize_hooks
37
+
38
+ options.each do |k,v|
39
+ __send__("#{k}=", v) if respond_to?("#{k}=")
40
+ end
41
+ end
42
+
43
+ # Hooking into the setup process, use extension scripts
44
+ # according to the name of the class. For instance to
45
+ # augment the behavior of the Installer, use:
46
+ #
47
+ # script/.setup/installer.rb
48
+ #
49
+ def initialize_hooks
50
+ file = META_EXTENSION_DIR + "/#{self.class.name.downcase}.rb"
51
+ if File.exist?(file)
52
+ script = File.read(file)
53
+ (class << self; self; end).class_eval(script)
54
+ end
55
+ end
56
+
57
+ #
58
+ def trial? ; @trial ; end
59
+
60
+ #
61
+ def trace? ; @trace ; end
62
+
63
+ #
64
+ def quiet? ; @quiet ; end
65
+
66
+ #
67
+ def force? ; @force ; end
68
+
69
+ #
70
+ def rootdir
71
+ project.rootdir
72
+ end
73
+
74
+ # Shellout executation.
75
+ def bash(*args)
76
+ $stderr.puts args.join(' ') if trace?
77
+ system(*args) or raise RuntimeError, "system(#{args.map{|a| a.inspect }.join(' ')}) failed"
78
+ end
79
+
80
+ # DEPRECATE
81
+ alias_method :command, :bash
82
+
83
+ # Shellout a ruby command.
84
+ def ruby(*args)
85
+ bash(config.rubyprog, *args)
86
+ end
87
+
88
+ # Ask a question of the user.
89
+ #def ask(question, answers=nil)
90
+ # $stdout.puts "#{question}"
91
+ # $stdout.puts " [#{answers}] " if answers
92
+ # until inp = $stdin.gets ; sleep 1 ; end
93
+ # inp.strip
94
+ #end
95
+
96
+ #
97
+ def trace_off #:yield:
98
+ begin
99
+ save, @trace = trace?, false
100
+ yield
101
+ ensure
102
+ @trace = save
103
+ end
104
+ end
105
+
106
+ # F I L E U T I L I T I E S
107
+
108
+ #
109
+ def rm_f(path)
110
+ io.puts "rm -f #{path}" if trace? or trial?
111
+ return if trial?
112
+ force_remove_file(path)
113
+ end
114
+
115
+ #
116
+ def force_remove_file(path)
117
+ begin
118
+ remove_file(path)
119
+ rescue
120
+ end
121
+ end
122
+
123
+ #
124
+ def remove_file(path)
125
+ File.chmod 0777, path
126
+ File.unlink(path)
127
+ end
128
+
129
+ #
130
+ def rmdir(path)
131
+ io.puts "rmdir #{path}" if trace? or trial?
132
+ return if trial?
133
+ Dir.rmdir(path)
134
+ end
135
+
136
+ end
137
+
138
+ #
139
+ class Error < StandardError
140
+ end
141
+
142
+ end
143
+