setup 4.2.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ system "cucumber --format progress test/features"
3
+
@@ -0,0 +1,28 @@
1
+ require 'setup/installer'
2
+
3
+ Test Setup::Installer do
4
+
5
+ Unit :files => "finds all files to be installed" do
6
+ prefix = File.join(Dir.tmpdir, 'setup', 'fauxroot')
7
+ installer = Setup::Installer.new(nil, nil, :install_prefix=>prefix)
8
+ Setup::TYPES.each do |type|
9
+ installer.pry.files(type).each do |f|
10
+ pending
11
+ end
12
+ end
13
+ end
14
+
15
+ Unit :destination => "applies install_prefix" do
16
+ prefix = File.join(Dir.tmpdir, 'setup', 'fauxroot')
17
+ installer = Setup::Installer.new(nil, nil, :install_prefix=>prefix)
18
+ Setup::TYPES.each do |type|
19
+ installer.pry.files(type).each do |file|
20
+ dest = File.join(Dir.tmpdir, 'setup', 'faux', type)
21
+ dir = installer.pry.destination(dest, file)
22
+ dir.assert.start_with?(prefix)
23
+ end
24
+ end
25
+ end
26
+
27
+ end
28
+
@@ -0,0 +1,16 @@
1
+ Feature: Configuration
2
+ In order to install a Ruby project
3
+ As a Ruby Developer
4
+ I may first use 'setup.rb config' to generate a configuration file
5
+
6
+ Scenario: Configure a new project
7
+ Given a setup.rb compliant Ruby project
8
+ When I issue the command 'setup.rb config'
9
+ Then a config file should be generated
10
+
11
+ Scenario: Configure a previously configured project
12
+ Given a setup.rb compliant Ruby project
13
+ And 'setup.rb config' has been run
14
+ When I issue the command 'setup.rb config'
15
+ Then the config file should be updated
16
+
@@ -0,0 +1,2 @@
1
+ Feature: Document
2
+
@@ -0,0 +1,72 @@
1
+ Feature: Install
2
+ In order to install a Ruby project
3
+ As a Ruby Developer
4
+ I want to use the setup.rb install command
5
+
6
+
7
+ Scenario: Install project to Ruby's site locations
8
+ Given a setup.rb compliant Ruby project
9
+ And 'setup.rb config --type=site' has been run
10
+ And 'setup.rb make' has been run
11
+ When I issue the command 'setup.rb install'
12
+ Then the project's exectuables should be installed to the site_ruby bin location
13
+ And the project's libraries should be installed to the site_ruby lib location
14
+ And the project's extensions should be installed to the site_ruby arch location
15
+
16
+ Scenario: Install project to standard ruby locations
17
+ Given a setup.rb compliant Ruby project
18
+ And 'setup.rb config --type=std' has been run
19
+ And 'setup.rb make' has been run
20
+ When I issue the command 'setup.rb install'
21
+ Then the project's exectuables should be installed to the ruby bin location
22
+ And the project's libraries should be installed to the ruby lib location
23
+ And the project's extensions should be installed to the ruby arch location
24
+
25
+ Scenario: Install project to XDG home locations
26
+ Given a setup.rb compliant Ruby project
27
+ And 'setup.rb config --type=home' has been run
28
+ And 'setup.rb make' has been run
29
+ When I issue the command 'setup.rb install'
30
+ Then the project's exectuables should be installed to the home bin location
31
+ And the project's libraries should be installed to the home lib location
32
+ And the project's extensions should be installed to the home arch location
33
+
34
+
35
+ Scenario: Install extensionless project to Ruby's site locations
36
+ Given a setup.rb compliant Ruby project
37
+ And the project does NOT have extensions
38
+ And 'setup.rb config --type=site' has been run
39
+ When I issue the command 'setup.rb install'
40
+ Then the project's exectuables should be installed to the site_ruby bin location
41
+ And the project's libraries should be installed to the site_ruby lib location
42
+
43
+ Scenario: Install extensionless project to standard ruby locations
44
+ Given a setup.rb compliant Ruby project
45
+ And the project does NOT have extensions
46
+ And 'setup.rb config --type=std' has been run
47
+ When I issue the command 'setup.rb install'
48
+ Then the project's exectuables should be installed to the ruby bin location
49
+ And the project's libraries should be installed to the ruby lib location
50
+
51
+ Scenario: Install extensionless project to XDG home locations
52
+ Given a setup.rb compliant Ruby project
53
+ And the project does NOT have extensions
54
+ And 'setup.rb config --type=home' has been run
55
+ When I issue the command 'setup.rb install'
56
+ Then the project's exectuables should be installed to the home bin location
57
+ And the project's libraries should be installed to the home lib location
58
+
59
+
60
+ Scenario: Fail to install project without first running config
61
+ Given a setup.rb compliant Ruby project
62
+ And 'setup.rb config' has NOT been run
63
+ When I issue the command 'setup.rb install' unprepared
64
+ Then I will be told that I must first run 'setup.rb config'
65
+
66
+ Scenario: Fail to install project with extensions without first running setup
67
+ Given a setup.rb compliant Ruby project
68
+ And 'setup.rb config' has been run
69
+ But 'setup.rb make' has NOT been run
70
+ When I issue the command 'setup.rb install' unprepared
71
+ Then I will be told that I must first run 'setup.rb make'
72
+
@@ -0,0 +1,18 @@
1
+ Feature: Setup/Compile Extensions
2
+ In order to install a Ruby project with extensions
3
+ As a Ruby Developer
4
+ I must first use 'setup.rb make' to buld the extensions
5
+
6
+ Scenario: Compile a new project
7
+ Given a setup.rb compliant Ruby project
8
+ And 'setup.rb config' has been run
9
+ When I issue the command 'setup.rb make'
10
+ Then the extensions should be compiled
11
+
12
+ Scenario: Fail to compile project without first running config
13
+ Given a setup.rb compliant Ruby project
14
+ And 'setup.rb config' has NOT been run
15
+ When I issue the command 'setup.rb make' unprepared
16
+ Then I will be told that I must first run 'setup.rb config'
17
+ And the extensions will not be compiled
18
+
@@ -0,0 +1,34 @@
1
+ Given /a setup\.rb compliant Ruby project$/ do
2
+ FileUtils.rm_r(FAUXDIR) if FAUXDIR.exist?
3
+ FileUtils.mkdir_p(FAUXDIR)
4
+ FileUtils.cp_r(FIXTURE, FAUXDIR)
5
+ dir = FAUXDIR + FIXTURE.basename
6
+ Dir.chdir(dir)
7
+ end
8
+
9
+ Given /the project does NOT have extensions$/ do
10
+ dir = FAUXDIR + FIXTURE.basename
11
+ dir = File.join(dir, 'ext')
12
+ FileUtils.rm_r(dir)
13
+ $setup_no_extensions = true
14
+ end
15
+
16
+ #Given /^'setup\.rb (.*?)' has been run$/ do |cmd|
17
+ # argv = cmd.split(/\s+/)
18
+ # Setup::Command.run(*argv)
19
+ #end
20
+
21
+ #When /^I issue the command 'setup.rb (.*?)'$/ do |cmd|
22
+ # argv = cmd.split(/\s+/)
23
+ # Setup::Command.run(*argv)
24
+ #end
25
+
26
+ #When /^I issue the command 'setup.rb (.*?)' unprepared$/ do |cmd|
27
+ # begin
28
+ # argv = cmd.split(/\s+/)
29
+ # Setup::Command.run(*argv)
30
+ # rescue SystemExit => error
31
+ # $setup_feature_error = error
32
+ # end
33
+ #end
34
+
@@ -0,0 +1,24 @@
1
+ Given /^'setup\.rb config' has NOT been run$/ do
2
+ #pending
3
+ end
4
+
5
+ Given /^'setup.rb config' has been run$/ do
6
+ Setup::Command.run("config", "--quiet") #, "--trace")
7
+ end
8
+
9
+ Given /^'setup\.rb config \-\-type=(.*?)' has been run$/ do |type|
10
+ Setup::Command.run("config", "--type", type, "--quiet")
11
+ end
12
+
13
+ When /^I issue the command 'setup.rb config'$/ do
14
+ Setup::Command.run("config", "--quiet") #, "--trace")
15
+ end
16
+
17
+ Then /^a config file should be generated$/ do
18
+ File.assert.exists?(Setup::Configuration::CONFIG_FILE)
19
+ end
20
+
21
+ Then /^the config file should be updated$/ do
22
+ File.assert.exists?(Setup::Configuration::CONFIG_FILE)
23
+ end
24
+
@@ -0,0 +1,37 @@
1
+ $LOAD_PATH.unshift(File.expand_path("lib"))
2
+
3
+ require 'ae'
4
+ require 'tmpdir'
5
+ require 'pathname'
6
+ require 'setup/command'
7
+
8
+ TEMPDIR = Pathname.new(Dir.tmpdir)
9
+
10
+ FIXTURE = Pathname.new('test/fixtures/faux-project').expand_path
11
+ FAUXDIR = TEMPDIR + 'cucumber/setup'
12
+ FAUXROOT = TEMPDIR + 'cucumber/setup/faux-root'
13
+
14
+ def installed_files
15
+ entries = Dir.glob("#{FAUXROOT}/**/*", File::FNM_DOTMATCH)
16
+ entries = entries.reject{ |f| /^\.+$/ =~ File.basename(f) }
17
+ entries = entries.map{ |f| f.sub("#{FAUXROOT}", '') }
18
+ entries = entries.sort
19
+ end
20
+
21
+ def homedir
22
+ if loc = ENV['XDG_LOCAL_HOME'] # TODO: name of this is step up in the air
23
+ File.expand_path(ENV['XDG_LOCAL_HOME'])
24
+ else
25
+ File.expand_path("~") + '/.local'
26
+ end
27
+ end
28
+
29
+ def rbdir
30
+ Config::CONFIG['rubylibdir'].sub(Config::CONFIG['prefix']+'/', '')
31
+ end
32
+
33
+ def sodir
34
+ Config::CONFIG['archdir'].sub(Config::CONFIG['prefix']+'/', '')
35
+ end
36
+
37
+
@@ -0,0 +1,75 @@
1
+ Given /^'setup\.rb make' has NOT been run$/ do
2
+ # TODO: assert there are no compiled extensions
3
+ end
4
+
5
+ Given /'setup.rb install' has been run$/ do
6
+ Setup::Command.run("install", "--prefix=#{FAUXROOT}", "--quiet") #, "--trace")
7
+ end
8
+
9
+ When /I issue the command 'setup\.rb install'$/ do
10
+ Setup::Command.run("install", "--prefix=#{FAUXROOT}", "--quiet") #, "--trace")
11
+ end
12
+
13
+ When /I issue the command 'setup.rb install' unprepared$/ do
14
+ begin
15
+ Setup::Command.run("install", "--prefix=#{FAUXROOT}", "--quiet") #, "--trace")
16
+ rescue SystemExit => error
17
+ $setup_feature_error = error
18
+ end
19
+ end
20
+
21
+ Then /^I will be told that I must first run 'setup\.rb make'$/ do
22
+ $setup_feature_error.message.assert =~ /setup\.rb make first/
23
+ end
24
+
25
+ # Site Ruby Locations
26
+
27
+ Then /the project's exectuables should be installed to the site_ruby bin location$/ do
28
+ entries = installed_files
29
+ entries.assert.include?('/usr/bin/faux')
30
+ end
31
+
32
+ Then /the project's libraries should be installed to the site_ruby lib location$/ do
33
+ entries = installed_files
34
+ entries.assert.include?("#{Config::CONFIG['sitelibdir']}/faux.rb")
35
+ end
36
+
37
+ Then /the project's extensions should be installed to the site_ruby arch location$/ do
38
+ entries = installed_files
39
+ entries.assert.include?("#{Config::CONFIG['sitearchdir']}/faux.so")
40
+ end
41
+
42
+ # Ruby Locations
43
+
44
+ Then /the project's exectuables should be installed to the ruby bin location$/ do
45
+ entries = installed_files
46
+ entries.assert.include?('/usr/bin/faux')
47
+ end
48
+
49
+ Then /the project's libraries should be installed to the ruby lib location$/ do
50
+ entries = installed_files
51
+ entries.assert.include?("#{Config::CONFIG['rubylibdir']}/faux.rb")
52
+ end
53
+
54
+ Then /the project's extensions should be installed to the ruby arch location$/ do
55
+ entries = installed_files
56
+ entries.assert.include?("#{Config::CONFIG['archdir']}/faux.so")
57
+ end
58
+
59
+ # Home Locations
60
+
61
+ Then /the project's exectuables should be installed to the home bin location$/ do
62
+ entries = installed_files
63
+ entries.assert.include?("#{homedir}/bin/faux")
64
+ end
65
+
66
+ Then /the project's libraries should be installed to the home lib location$/ do
67
+ entries = installed_files
68
+ entries.assert.include?("#{homedir}/#{rbdir}/faux.rb")
69
+ end
70
+
71
+ Then /the project's extensions should be installed to the home arch location$/ do
72
+ entries = installed_files
73
+ entries.assert.include?("#{homedir}/#{sodir}/faux.so")
74
+ end
75
+
@@ -0,0 +1,30 @@
1
+ Given /'setup.rb make' has been run$/ do
2
+ Setup::Command.run("make", "--quiet") #, "--trace")
3
+ end
4
+
5
+ When /^I issue the command 'setup\.rb make'$/ do
6
+ Setup::Command.run("make", "--quiet")
7
+ end
8
+
9
+ When /^I issue the command 'setup\.rb make' unprepared$/ do
10
+ begin
11
+ Setup::Command.run("make", "--quiet")
12
+ rescue SystemExit => error
13
+ $setup_feature_error = error
14
+ end
15
+ end
16
+
17
+ Then /^the extensions should be compiled$/ do
18
+ exts = Dir['ext/faux/faux.so']
19
+ exts.assert!.empty?
20
+ end
21
+
22
+ Then /^I will be told that I must first run 'setup\.rb config'$/ do
23
+ $setup_feature_error.message.assert == "must setup config first"
24
+ end
25
+
26
+ Then /^the extensions will not be compiled$/ do
27
+ exts = Dir['ext/faux/faux.so']
28
+ exts.assert.empty?
29
+ end
30
+
@@ -0,0 +1,8 @@
1
+ When /^I issue the command 'setup.rb uninstall'$/ do
2
+ Setup::Command.run("uninstall", "--force", "--quiet")
3
+ end
4
+
5
+ Then /^the package files should be removed$/ do
6
+ installed_files.assert.empty?
7
+ end
8
+
@@ -0,0 +1,2 @@
1
+ Feature: Test
2
+
@@ -0,0 +1,13 @@
1
+ Feature: Uninstall
2
+ In order to uninstall a Ruby project
3
+ That was installed with setup.rb
4
+ I use 'setup.rb uninstall'
5
+
6
+ Scenario: Uninstall a package
7
+ Given a setup.rb compliant Ruby project
8
+ And 'setup.rb config' has been run
9
+ And 'setup.rb make' has been run
10
+ And 'setup.rb install' has been run
11
+ When I issue the command 'setup.rb uninstall'
12
+ Then the package files should be removed
13
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'foo'
3
+
@@ -0,0 +1,12 @@
1
+ # Loads mkmf which is used to make makefiles for Ruby extensions
2
+ require 'mkmf'
3
+
4
+ # Give it a name
5
+ extension_name = 'faux'
6
+
7
+ # The destination
8
+ dir_config(extension_name)
9
+
10
+ # Do the work
11
+ create_makefile(extension_name)
12
+
@@ -0,0 +1,24 @@
1
+ // Include the Ruby headers and goodies
2
+ #include "ruby.h"
3
+
4
+ // Defining a space for information and references about the module to be stored internally
5
+ VALUE Faux = Qnil;
6
+
7
+ // Prototype for the initialization method - Ruby calls this, not you
8
+ void Init_faux();
9
+
10
+ // Prototype for our method 'test1' - methods are prefixed by 'method_' here
11
+ VALUE method_test1(VALUE self);
12
+
13
+ // The initialization method for this module
14
+ void Init_faux() {
15
+ Faux = rb_define_module("Faux");
16
+ rb_define_method(Faux, "test1", method_test1, 0);
17
+ }
18
+
19
+ // Our 'test1' method.. it simply returns a value of '10' for now.
20
+ VALUE method_test1(VALUE self) {
21
+ int x = 10;
22
+ return INT2NUM(x);
23
+ }
24
+
@@ -0,0 +1 @@
1
+ puts "foo.rb"
metadata CHANGED
@@ -1,69 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setup
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Tiger Ops <tigerops-community@rubyforge.org>
8
- - Minero Aoki <aamine@loveruby.net>
9
- - 7rans <transfire@gmail.com>
7
+ - |-
8
+ Minero Aoki <aamine@loveruby.net>
9
+ 7rans <transfire@gmail.com>
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-08-26 00:00:00 -04:00
14
+ date: 2010-01-13 00:00:00 -05:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
18
- description: Every Rubyist is aware of Minero Aoki's ever useful setup.rb script. It's how most of us used to install our ruby programs before RubyGems came along.And it's still mighty useful in certain scenarios, not the least of which is the job of the distribution package managers. Setup converts setup.rb into a stand-alone application. No longer will you need distribute setup.rb with you Ruby packages. Just instruct your users to use Setup.
18
+ description: |-
19
+ Every Rubyist is aware of Minero Aoki's ever useful
20
+ setup.rb script. It's how most of us used to install
21
+ our ruby programs before RubyGems came along.And it's
22
+ still mighty useful in certain scenarios, not the least
23
+ of which is the job of the distribution package managers.
24
+ Setup converts setup.rb into a stand-alone application.
25
+ No longer will you need distribute setup.rb with you
26
+ Ruby packages. Just instruct your users to use Setup.
19
27
  email: Tiger Ops <tigerops-community@rubyforge.org>
20
28
  executables:
21
29
  - setup.rb
22
30
  extensions: []
23
31
 
24
- extra_rdoc_files:
25
- - README
26
- - MANIFEST
27
- - RELEASE
28
- - HISTORY
29
- - COPYING
32
+ extra_rdoc_files: []
33
+
30
34
  files:
31
35
  - COPYING
32
36
  - HISTORY
33
37
  - MANIFEST
34
- - README
35
- - RELEASE
38
+ - README.rdoc
36
39
  - bin/setup.rb
37
40
  - lib/setup.rb
38
- - lib/setup/build.rb
41
+ - lib/setup/base.rb
39
42
  - lib/setup/command.rb
40
- - lib/setup/config.rb
41
- - lib/setup/error.rb
42
- - lib/setup/install.rb
43
+ - lib/setup/compiler.rb
44
+ - lib/setup/configuration.rb
45
+ - lib/setup/constants.rb
46
+ - lib/setup/core_ext.rb
47
+ - lib/setup/documentor.rb
48
+ - lib/setup/installer.rb
49
+ - lib/setup/project.rb
43
50
  - lib/setup/rake.rb
44
- - lib/setup/rubyver.rb
45
- - meta/abstract
51
+ - lib/setup/session.rb
52
+ - lib/setup/tester.rb
53
+ - lib/setup/uninstaller.rb
54
+ - meta/active
46
55
  - meta/authors
56
+ - meta/collection
47
57
  - meta/contact
48
58
  - meta/created
59
+ - meta/description
49
60
  - meta/homepage
50
- - meta/package
61
+ - meta/name
51
62
  - meta/released
52
- - meta/setup/metaconfig.rb
63
+ - meta/repository
64
+ - meta/ruby
53
65
  - meta/summary
54
66
  - meta/version
55
- - test/test_installer.rb
67
+ - script/bstrap
68
+ - script/bundle
69
+ - script/setup
70
+ - script/test
71
+ - test/cases/installer.rb
72
+ - test/features/config.feature
73
+ - test/features/document.feature
74
+ - test/features/install.feature
75
+ - test/features/make.feature
76
+ - test/features/step_definitions/common_steps.rb
77
+ - test/features/step_definitions/config_steps.rb
78
+ - test/features/step_definitions/env.rb
79
+ - test/features/step_definitions/install_steps.rb
80
+ - test/features/step_definitions/setup_steps.rb
81
+ - test/features/step_definitions/uninstall_steps.rb
82
+ - test/features/test.feature
83
+ - test/features/uninstall.feature
84
+ - test/fixtures/faux-project/bin/faux
85
+ - test/fixtures/faux-project/ext/faux/extconf.rb
86
+ - test/fixtures/faux-project/ext/faux/faux.c
87
+ - test/fixtures/faux-project/lib/faux.rb
56
88
  has_rdoc: true
57
89
  homepage: http://setup.rubyforge.org
58
90
  licenses: []
59
91
 
60
92
  post_install_message:
61
93
  rdoc_options:
62
- - --inline-source
63
94
  - --title
64
- - setup api
65
- - --main
66
- - README
95
+ - Setup API
67
96
  require_paths:
68
97
  - lib
69
98
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -84,6 +113,6 @@ rubyforge_project: setup
84
113
  rubygems_version: 1.3.5
85
114
  signing_key:
86
115
  specification_version: 3
87
- summary: Setup.rb as a stand-alone application.
116
+ summary: Every Rubyist is aware of Minero Aoki's ever useful
88
117
  test_files:
89
- - test/test_installer.rb
118
+ - lib/setup/tester.rb