isolate 1.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.
- data/.autotest +5 -0
- data/CHANGELOG.rdoc +3 -0
- data/Manifest.txt +10 -0
- data/README.rdoc +162 -0
- data/Rakefile +13 -0
- data/lib/isolate.rb +190 -0
- data/test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec +58 -0
- data/test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec +32 -0
- data/test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec +44 -0
- data/test/test_isolate.rb +197 -0
- metadata +95 -0
data/.autotest
ADDED
data/CHANGELOG.rdoc
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
.autotest
|
2
|
+
CHANGELOG.rdoc
|
3
|
+
Manifest.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
lib/isolate.rb
|
7
|
+
test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
|
8
|
+
test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
|
9
|
+
test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
|
10
|
+
test/test_isolate.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
= Isolate
|
2
|
+
|
3
|
+
* http://github.com/jbarnette/isolate
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Isolate is a very simple RubyGems sandbox. It restricts GEM_PATH and
|
8
|
+
GEM_HOME, and provides a DSL for expressing your code's runtime Gem
|
9
|
+
dependencies.
|
10
|
+
|
11
|
+
While Isolate doesn't make any assumptions about what sort of code
|
12
|
+
you're writing, it was extracted from a few Rails apps, so it's
|
13
|
+
naturally going to be most useful with stuff like Rails, Merb, or
|
14
|
+
Sinatra.
|
15
|
+
|
16
|
+
Isolate is very, very, very stupid simple. For a much more
|
17
|
+
full-featured Gem bundler, check out Yehuda Katz and Carl Lerche's
|
18
|
+
Bundler[http://github.com/wycats/bundler]: It does a lot of fancy AOT
|
19
|
+
dependency resolution, supports non-gem resources, and is probably a
|
20
|
+
better fit for you. For a widely used Gem manager and installer, check
|
21
|
+
out Chad Wooley's GemInstaller[http://geminstaller.rubyforge.org].
|
22
|
+
|
23
|
+
YMMV, but I haven't tried Isolate with anything older than RubyGems
|
24
|
+
1.3.5.
|
25
|
+
|
26
|
+
== Examples
|
27
|
+
|
28
|
+
=== Defining Your Isolated Environment
|
29
|
+
|
30
|
+
The DSL's pretty easy: <tt>gem</tt> is similar to RubyGems'
|
31
|
+
identically-named method. Version specifiers are optional, and any
|
32
|
+
hash args tacked on to the end are passed through to
|
33
|
+
Gem::DependencyInstaller as flags.
|
34
|
+
|
35
|
+
require "isolate"
|
36
|
+
|
37
|
+
Isolate.gems "vendor/isolated" do
|
38
|
+
gem "johnson", "~> 1.1" # or maybe...
|
39
|
+
gem "jbarnette-johnson", :source => "http://gems.github.com"
|
40
|
+
end
|
41
|
+
|
42
|
+
At the end of the <tt>Isolate.gems</tt> block, you're completely
|
43
|
+
isolated. <tt>GEM_PATH</tt> and <tt>GEM_HOME</tt> are set, and all
|
44
|
+
your specified gems have been activated.
|
45
|
+
|
46
|
+
=== Conditionals
|
47
|
+
|
48
|
+
Sometimes different sets of gems are appropriate at different
|
49
|
+
times. Isolate allows you to restrict gems by 'environment' (which is
|
50
|
+
really just a string passed in when things are activated).
|
51
|
+
|
52
|
+
Isolate.gems "vendor/isolated" do
|
53
|
+
gem "intercession"
|
54
|
+
|
55
|
+
environment :test, :cucumber do
|
56
|
+
gem "mocha"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
Unsurprisingly, the <tt>mocha</tt> gem will only be activated in the
|
61
|
+
<tt>test</tt> and <tt>cucumber</tt> environments. See the Rails
|
62
|
+
example below for an example of how to use <tt>RAILS_ENV</tt> to set
|
63
|
+
your environment.
|
64
|
+
|
65
|
+
=== Installing Isolated Gems
|
66
|
+
|
67
|
+
Isolate.gems "vendor/isolated", :install => true, :verbose => true do
|
68
|
+
gem "intercession"
|
69
|
+
end
|
70
|
+
|
71
|
+
Isolate can install your gems automatically. Just pass an
|
72
|
+
<tt>:install</tt> option to <tt>Isolate.gems</tt>. Pass
|
73
|
+
<tt>:verbose</tt> if you want to see what's going on.
|
74
|
+
|
75
|
+
=== A Rails Example
|
76
|
+
|
77
|
+
Here's a quick example (extracted from a real project) of how to use
|
78
|
+
Isolate with Rails. This project doesn't use vendored Rails, and
|
79
|
+
doesn't want to depend on any system gems (except isolate, of course).
|
80
|
+
|
81
|
+
Gem dependencies are defined in <tt>config/preinitializer.rb</tt>. If
|
82
|
+
you want, you could just as easily put them in
|
83
|
+
<tt>config/{gems,deps,whatever}.rb</tt>, just make sure it's loaded in
|
84
|
+
the preinitializer:
|
85
|
+
|
86
|
+
require "isolate"
|
87
|
+
|
88
|
+
Isolate.gems "vendor/isolated", :install => true, :verbose => true do
|
89
|
+
gem "rails", "= 2.2.2"
|
90
|
+
|
91
|
+
# async emails!
|
92
|
+
gem "ar_mailer", "~> 1.3", '>= 1.3.3'
|
93
|
+
|
94
|
+
# Facebook integration
|
95
|
+
gem "facebooker", ">= 1.0.31"
|
96
|
+
|
97
|
+
# Google contacts integration
|
98
|
+
gem "gmail_contacts", "~> 1.7"
|
99
|
+
|
100
|
+
# View templates
|
101
|
+
gem "haml", "~> 2.0"
|
102
|
+
|
103
|
+
# Session as model
|
104
|
+
gem "intercession", "~> 1.0"
|
105
|
+
|
106
|
+
# XML/HTML parsing in Facebooker and tests
|
107
|
+
gem "nokogiri", ">= 1.2.3"
|
108
|
+
|
109
|
+
# Twitter authentication
|
110
|
+
gem "oauth", "~> 0.3"
|
111
|
+
|
112
|
+
environment :development, :test do
|
113
|
+
gem "modelizer" # easy model factories
|
114
|
+
gem "sqlite3-ruby" # database support
|
115
|
+
gem "vlad" # deployment
|
116
|
+
gem "webrat" # integration tests
|
117
|
+
end
|
118
|
+
|
119
|
+
environment :cucumber do
|
120
|
+
gem "cucumber" # stories!
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
Since this is in the preinitializer, Isolate will install and activate
|
125
|
+
the fundamental gems before Rails loads.
|
126
|
+
|
127
|
+
This is early enough in Rails' lifecycle that <tt>RAILS_ENV</tt> isn't
|
128
|
+
set, so we need a way to activate gems for the current
|
129
|
+
environment. Let's add one line to <tt>config/environment.rb</tt>,
|
130
|
+
right below where <tt>boot.rb</tt> is required:
|
131
|
+
|
132
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
133
|
+
Isolate.activate RAILS_ENV
|
134
|
+
|
135
|
+
Pow. Isolated!
|
136
|
+
|
137
|
+
== Installation
|
138
|
+
|
139
|
+
$ gem install isolate
|
140
|
+
|
141
|
+
== License
|
142
|
+
|
143
|
+
Copyright 2009 John Barnette (jbarnette@rubyforge.org)
|
144
|
+
|
145
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
146
|
+
a copy of this software and associated documentation files (the
|
147
|
+
'Software'), to deal in the Software without restriction, including
|
148
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
149
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
150
|
+
permit persons to whom the Software is furnished to do so, subject to
|
151
|
+
the following conditions:
|
152
|
+
|
153
|
+
The above copyright notice and this permission notice shall be
|
154
|
+
included in all copies or substantial portions of the Software.
|
155
|
+
|
156
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
157
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
158
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
159
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
160
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
161
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
162
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "hoe"
|
3
|
+
|
4
|
+
Hoe.plugin :doofus, :git
|
5
|
+
|
6
|
+
Hoe.spec "isolate" do
|
7
|
+
developer "John Barnette", "jbarnette@rubyforge.org"
|
8
|
+
|
9
|
+
self.extra_rdoc_files = Dir["*.rdoc"]
|
10
|
+
self.history_file = "CHANGELOG.rdoc"
|
11
|
+
self.readme_file = "README.rdoc"
|
12
|
+
self.testlib = :minitest
|
13
|
+
end
|
data/lib/isolate.rb
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
require "rubygems/dependency_installer"
|
2
|
+
require "rubygems/requirement"
|
3
|
+
|
4
|
+
# Restricts +GEM_PATH+ and +GEM_HOME+ and provides a DSL for
|
5
|
+
# expressing your code's runtime Gem dependencies. See README.rdoc for
|
6
|
+
# rationale, limitations, and examples.
|
7
|
+
|
8
|
+
class Isolate
|
9
|
+
Entry = Struct.new :name, :requirement, :environments, :options # :nodoc:
|
10
|
+
VERSION = "1.0.0" # :nodoc:
|
11
|
+
|
12
|
+
attr_reader :entries # :nodoc:
|
13
|
+
|
14
|
+
attr_reader :path # :nodoc:
|
15
|
+
|
16
|
+
# Activate (and possibly install) gems for a specific
|
17
|
+
# +environment+. This allows two-stage isolation, which is necessary
|
18
|
+
# for stuff like Rails. See README.rdoc for a detailed example.
|
19
|
+
|
20
|
+
def self.activate environment
|
21
|
+
instance.activate environment
|
22
|
+
end
|
23
|
+
|
24
|
+
# Declare an isolated RubyGems environment, installed in +path+. The
|
25
|
+
# block given will be <tt>instance_eval</tt>ed, see Isolate#gem and
|
26
|
+
# Isolate#environment for the sort of stuff you can do.
|
27
|
+
#
|
28
|
+
# Option defaults:
|
29
|
+
#
|
30
|
+
# { :install => false, :verbose => false }
|
31
|
+
|
32
|
+
def self.gems path, options = {}, &block
|
33
|
+
@@instance = new path, options, &block
|
34
|
+
@@instance.activate
|
35
|
+
end
|
36
|
+
|
37
|
+
@@instance = nil
|
38
|
+
|
39
|
+
def self.instance # :nodoc:
|
40
|
+
@@instance
|
41
|
+
end
|
42
|
+
|
43
|
+
# Poke RubyGems, we've probably monkeyed with a bunch of paths and
|
44
|
+
# suchlike. Clears paths, loaded specs, and source indexes.
|
45
|
+
|
46
|
+
def self.refresh # :nodoc:
|
47
|
+
Gem.loaded_specs.clear
|
48
|
+
Gem.clear_paths
|
49
|
+
Gem.source_index.refresh!
|
50
|
+
end
|
51
|
+
|
52
|
+
# Create a new Isolate instance. See Isolate.gems for the public
|
53
|
+
# API. Don't use this constructor directly.
|
54
|
+
|
55
|
+
def initialize path, options = {}, &block
|
56
|
+
@enabled = false
|
57
|
+
@entries = []
|
58
|
+
@environments = []
|
59
|
+
@install = options[:install]
|
60
|
+
@path = path
|
61
|
+
@verbose = options[:verbose]
|
62
|
+
|
63
|
+
instance_eval(&block) if block_given?
|
64
|
+
end
|
65
|
+
|
66
|
+
def activate environment = nil # :nodoc:
|
67
|
+
enable unless enabled?
|
68
|
+
|
69
|
+
env = environment.to_s if environment
|
70
|
+
install environment if install?
|
71
|
+
|
72
|
+
entries.each do |e|
|
73
|
+
if e.environments.empty? || e.environments.include?(env)
|
74
|
+
Gem.activate e.name, *e.requirement.as_list
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
self
|
79
|
+
end
|
80
|
+
|
81
|
+
def disable # :nodoc:
|
82
|
+
return self unless enabled?
|
83
|
+
|
84
|
+
ENV["GEM_PATH"] = @old_gem_path
|
85
|
+
ENV["GEM_HOME"] = @old_gem_home
|
86
|
+
ENV["RUBYOPT"] = @old_ruby_opt
|
87
|
+
|
88
|
+
$LOAD_PATH.replace @old_load_path
|
89
|
+
|
90
|
+
@enabled = false
|
91
|
+
|
92
|
+
self.class.refresh
|
93
|
+
self
|
94
|
+
end
|
95
|
+
|
96
|
+
def enable &block # :nodoc:
|
97
|
+
return self if enabled?
|
98
|
+
|
99
|
+
@old_gem_path = ENV["GEM_PATH"]
|
100
|
+
@old_gem_home = ENV["GEM_HOME"]
|
101
|
+
@old_ruby_opt = ENV["RUBYOPT"]
|
102
|
+
@old_load_path = $LOAD_PATH.dup
|
103
|
+
|
104
|
+
$LOAD_PATH.reject! { |p| Gem.path.any? { |gp| p.include?(gp) } }
|
105
|
+
|
106
|
+
# HACK: Gotta keep isolate explicitly in the LOAD_PATH in
|
107
|
+
# subshells, and the only way I can think of to do that is by
|
108
|
+
# abusing RUBYOPT.
|
109
|
+
|
110
|
+
ENV["RUBYOPT"] = "#{ENV['RUBYOPT']} -I#{File.dirname(__FILE__)}"
|
111
|
+
ENV["GEM_PATH"] = ENV["GEM_HOME"] = path
|
112
|
+
|
113
|
+
self.class.refresh
|
114
|
+
|
115
|
+
@enabled = true
|
116
|
+
begin; yield; ensure disable end if block_given?
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
def enabled? # :nodoc:
|
121
|
+
@enabled
|
122
|
+
end
|
123
|
+
|
124
|
+
# Restricts +gem+ calls inside +block+ to a set of +environments+.
|
125
|
+
|
126
|
+
def environment *environments, &block
|
127
|
+
old = @environments.dup
|
128
|
+
@environments.concat environments.map { |e| e.to_s }
|
129
|
+
|
130
|
+
begin
|
131
|
+
yield
|
132
|
+
ensure
|
133
|
+
@environments = old
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Express a gem dependency. Works pretty much like RubyGems' +gem+
|
138
|
+
# method, but respects +environment+ and doesn't activate 'til
|
139
|
+
# later.
|
140
|
+
|
141
|
+
def gem name, *requirements
|
142
|
+
options = Hash === requirements.last ? requirements.pop : {}
|
143
|
+
|
144
|
+
requirement = requirements.empty? ?
|
145
|
+
Gem::Requirement.default :
|
146
|
+
Gem::Requirement.new(requirements)
|
147
|
+
|
148
|
+
entry = Entry.new name, requirement, @environments.dup, options
|
149
|
+
|
150
|
+
@entries << entry
|
151
|
+
entry
|
152
|
+
end
|
153
|
+
|
154
|
+
def install environment = nil # :nodoc:
|
155
|
+
env = environment.to_s if environment
|
156
|
+
|
157
|
+
installable = entries.select do |e|
|
158
|
+
!Gem.available?(e.name, *e.requirement.as_list) &&
|
159
|
+
(env.nil? || e.environments.include?(env))
|
160
|
+
end
|
161
|
+
|
162
|
+
installable.each_with_index do |e, i|
|
163
|
+
if verbose?
|
164
|
+
padding = installable.size.to_s.size
|
165
|
+
progress = "[%0#{padding}d/%s]" % [i + 1, installable.size]
|
166
|
+
warn "#{progress} Isolating #{e.name} (#{e.requirement})."
|
167
|
+
end
|
168
|
+
|
169
|
+
old = Gem.sources.dup
|
170
|
+
source = e.options.delete :source
|
171
|
+
Gem.sources = Array(source) if source
|
172
|
+
options = e.options.merge :install_dir => path
|
173
|
+
installer = Gem::DependencyInstaller.new options
|
174
|
+
|
175
|
+
installer.install e.name, e.requirement
|
176
|
+
Gem.sources = old
|
177
|
+
end
|
178
|
+
|
179
|
+
Gem.source_index.refresh!
|
180
|
+
self
|
181
|
+
end
|
182
|
+
|
183
|
+
def install? # :nodoc:
|
184
|
+
@install
|
185
|
+
end
|
186
|
+
|
187
|
+
def verbose? # :nodoc:
|
188
|
+
@verbose
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{hoe}
|
5
|
+
s.version = "2.3.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.1") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Ryan Davis"]
|
9
|
+
s.date = %q{2009-08-07}
|
10
|
+
s.default_executable = %q{sow}
|
11
|
+
s.description = %q{Hoe is a rake/rubygems helper for project Rakefiles. It helps generate
|
12
|
+
rubygems and includes a dynamic plug-in system allowing for easy
|
13
|
+
extensibility. Hoe ships with plug-ins for all your usual project
|
14
|
+
tasks including rdoc generation, testing, packaging, and deployment.
|
15
|
+
|
16
|
+
Plug-ins Provided:
|
17
|
+
|
18
|
+
* Hoe::Clean
|
19
|
+
* Hoe::Debug
|
20
|
+
* Hoe::Deps
|
21
|
+
* Hoe::Flay
|
22
|
+
* Hoe::Flog
|
23
|
+
* Hoe::Inline
|
24
|
+
* Hoe::Package
|
25
|
+
* Hoe::Publish
|
26
|
+
* Hoe::RCov
|
27
|
+
* Hoe::Signing
|
28
|
+
* Hoe::Test
|
29
|
+
|
30
|
+
See class rdoc for help. Hint: ri Hoe}
|
31
|
+
s.email = ["ryand-ruby@zenspider.com"]
|
32
|
+
s.executables = ["sow"]
|
33
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
34
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/sow", "lib/hoe.rb", "lib/hoe/clean.rb", "lib/hoe/debug.rb", "lib/hoe/deps.rb", "lib/hoe/flay.rb", "lib/hoe/flog.rb", "lib/hoe/inline.rb", "lib/hoe/package.rb", "lib/hoe/publish.rb", "lib/hoe/rake.rb", "lib/hoe/rcov.rb", "lib/hoe/signing.rb", "lib/hoe/test.rb", "template/.autotest.erb", "template/History.txt.erb", "template/Manifest.txt.erb", "template/README.txt.erb", "template/Rakefile.erb", "template/bin/file_name.erb", "template/lib/file_name.rb.erb", "template/test/test_file_name.rb.erb", "test/test_hoe.rb"]
|
35
|
+
s.homepage = %q{http://rubyforge.org/projects/seattlerb/}
|
36
|
+
s.rdoc_options = ["--main", "README.txt"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubyforge_project = %q{seattlerb}
|
39
|
+
s.rubygems_version = %q{1.3.5}
|
40
|
+
s.summary = %q{Hoe is a rake/rubygems helper for project Rakefiles}
|
41
|
+
s.test_files = ["test/test_hoe.rb"]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<rubyforge>, [">= 1.0.4"])
|
49
|
+
s.add_runtime_dependency(%q<rake>, [">= 0.8.7"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<rubyforge>, [">= 1.0.4"])
|
52
|
+
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
53
|
+
end
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<rubyforge>, [">= 1.0.4"])
|
56
|
+
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{rake}
|
5
|
+
s.version = "0.8.7"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jim Weirich"]
|
9
|
+
s.date = %q{2009-05-14}
|
10
|
+
s.default_executable = %q{rake}
|
11
|
+
s.description = %q{Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.}
|
12
|
+
s.email = %q{jim@weirichhouse.org}
|
13
|
+
s.executables = ["rake"]
|
14
|
+
s.extra_rdoc_files = ["README", "MIT-LICENSE", "TODO", "CHANGES", "doc/command_line_usage.rdoc", "doc/glossary.rdoc", "doc/proto_rake.rdoc", "doc/rakefile.rdoc", "doc/rational.rdoc", "doc/release_notes/rake-0.4.14.rdoc", "doc/release_notes/rake-0.4.15.rdoc", "doc/release_notes/rake-0.5.0.rdoc", "doc/release_notes/rake-0.5.3.rdoc", "doc/release_notes/rake-0.5.4.rdoc", "doc/release_notes/rake-0.6.0.rdoc", "doc/release_notes/rake-0.7.0.rdoc", "doc/release_notes/rake-0.7.1.rdoc", "doc/release_notes/rake-0.7.2.rdoc", "doc/release_notes/rake-0.7.3.rdoc", "doc/release_notes/rake-0.8.0.rdoc", "doc/release_notes/rake-0.8.2.rdoc", "doc/release_notes/rake-0.8.3.rdoc", "doc/release_notes/rake-0.8.4.rdoc", "doc/release_notes/rake-0.8.5.rdoc", "doc/release_notes/rake-0.8.6.rdoc", "doc/release_notes/rake-0.8.7.rdoc"]
|
15
|
+
s.files = ["install.rb", "CHANGES", "MIT-LICENSE", "Rakefile", "README", "TODO", "bin/rake", "lib/rake/alt_system.rb", "lib/rake/classic_namespace.rb", "lib/rake/clean.rb", "lib/rake/contrib/compositepublisher.rb", "lib/rake/contrib/ftptools.rb", "lib/rake/contrib/publisher.rb", "lib/rake/contrib/rubyforgepublisher.rb", "lib/rake/contrib/sshpublisher.rb", "lib/rake/contrib/sys.rb", "lib/rake/gempackagetask.rb", "lib/rake/loaders/makefile.rb", "lib/rake/packagetask.rb", "lib/rake/rake_test_loader.rb", "lib/rake/rdoctask.rb", "lib/rake/ruby182_test_unit_fix.rb", "lib/rake/runtest.rb", "lib/rake/tasklib.rb", "lib/rake/testtask.rb", "lib/rake/win32.rb", "lib/rake.rb", "test/capture_stdout.rb", "test/check_expansion.rb", "test/check_no_expansion.rb", "test/contrib/test_sys.rb", "test/data/rakelib/test1.rb", "test/data/rbext/rakefile.rb", "test/filecreation.rb", "test/functional.rb", "test/in_environment.rb", "test/rake_test_setup.rb", "test/reqfile.rb", "test/reqfile2.rb", "test/session_functional.rb", "test/shellcommand.rb", "test/test_application.rb", "test/test_clean.rb", "test/test_definitions.rb", "test/test_earlytime.rb", "test/test_extension.rb", "test/test_file_creation_task.rb", "test/test_file_task.rb", "test/test_filelist.rb", "test/test_fileutils.rb", "test/test_ftp.rb", "test/test_invocation_chain.rb", "test/test_makefile_loader.rb", "test/test_multitask.rb", "test/test_namespace.rb", "test/test_package_task.rb", "test/test_pathmap.rb", "test/test_pseudo_status.rb", "test/test_rake.rb", "test/test_rdoc_task.rb", "test/test_require.rb", "test/test_rules.rb", "test/test_task_arguments.rb", "test/test_task_manager.rb", "test/test_tasklib.rb", "test/test_tasks.rb", "test/test_test_task.rb", "test/test_top_level_functions.rb", "test/test_win32.rb", "test/data/imports/deps.mf", "test/data/sample.mf", "test/data/chains/Rakefile", "test/data/default/Rakefile", "test/data/dryrun/Rakefile", "test/data/file_creation_task/Rakefile", "test/data/imports/Rakefile", "test/data/multidesc/Rakefile", "test/data/namespace/Rakefile", "test/data/statusreturn/Rakefile", "test/data/unittest/Rakefile", "test/data/unittest/subdir", "doc/command_line_usage.rdoc", "doc/example", "doc/example/a.c", "doc/example/b.c", "doc/example/main.c", "doc/example/Rakefile1", "doc/example/Rakefile2", "doc/glossary.rdoc", "doc/jamis.rb", "doc/proto_rake.rdoc", "doc/rake.1.gz", "doc/rakefile.rdoc", "doc/rational.rdoc", "doc/release_notes", "doc/release_notes/rake-0.4.14.rdoc", "doc/release_notes/rake-0.4.15.rdoc", "doc/release_notes/rake-0.5.0.rdoc", "doc/release_notes/rake-0.5.3.rdoc", "doc/release_notes/rake-0.5.4.rdoc", "doc/release_notes/rake-0.6.0.rdoc", "doc/release_notes/rake-0.7.0.rdoc", "doc/release_notes/rake-0.7.1.rdoc", "doc/release_notes/rake-0.7.2.rdoc", "doc/release_notes/rake-0.7.3.rdoc", "doc/release_notes/rake-0.8.0.rdoc", "doc/release_notes/rake-0.8.2.rdoc", "doc/release_notes/rake-0.8.3.rdoc", "doc/release_notes/rake-0.8.4.rdoc", "doc/release_notes/rake-0.8.5.rdoc", "doc/release_notes/rake-0.8.6.rdoc", "doc/release_notes/rake-0.8.7.rdoc"]
|
16
|
+
s.homepage = %q{http://rake.rubyforge.org}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--main", "README", "--title", "Rake -- Ruby Make"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{rake}
|
20
|
+
s.rubygems_version = %q{1.3.3}
|
21
|
+
s.summary = %q{Ruby based make-like utility.}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 2
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
else
|
29
|
+
end
|
30
|
+
else
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{rubyforge}
|
5
|
+
s.version = "1.0.4"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Ryan Davis", "Eric Hodel", "Ara T Howard"]
|
9
|
+
s.date = %q{2009-07-21}
|
10
|
+
s.default_executable = %q{rubyforge}
|
11
|
+
s.description = %q{A script which automates a limited set of rubyforge operations.
|
12
|
+
|
13
|
+
* Run 'rubyforge help' for complete usage.
|
14
|
+
* Setup: For first time users AND upgrades to 0.4.0:
|
15
|
+
* rubyforge setup (deletes your username and password, so run sparingly!)
|
16
|
+
* edit ~/.rubyforge/user-config.yml
|
17
|
+
* rubyforge config
|
18
|
+
* For all rubyforge upgrades, run 'rubyforge config' to ensure you have latest.
|
19
|
+
* Don't forget to login! logging in will store a cookie in your
|
20
|
+
.rubyforge directory which expires after a time. always run the
|
21
|
+
login command before any operation that requires authentication,
|
22
|
+
such as uploading a package.}
|
23
|
+
s.email = ["ryand-ruby@zenspider.com", "drbrain@segment7.net", "ara.t.howard@gmail.com"]
|
24
|
+
s.executables = ["rubyforge"]
|
25
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
26
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/rubyforge", "lib/rubyforge.rb", "lib/rubyforge/client.rb", "lib/rubyforge/cookie_manager.rb", "test/test_rubyforge.rb", "test/test_rubyforge_client.rb", "test/test_rubyforge_cookie_manager.rb"]
|
27
|
+
s.homepage = %q{http://codeforpeople.rubyforge.org/rubyforge/}
|
28
|
+
s.rdoc_options = ["--main", "README.txt"]
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
s.rubyforge_project = %q{codeforpeople}
|
31
|
+
s.rubygems_version = %q{1.3.5}
|
32
|
+
s.summary = %q{A script which automates a limited set of rubyforge operations}
|
33
|
+
s.test_files = ["test/test_rubyforge.rb", "test/test_rubyforge_client.rb", "test/test_rubyforge_cookie_manager.rb"]
|
34
|
+
|
35
|
+
if s.respond_to? :specification_version then
|
36
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
40
|
+
else
|
41
|
+
end
|
42
|
+
else
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "rubygems/dependency_installer"
|
3
|
+
require "rubygems/requirement"
|
4
|
+
require "isolate"
|
5
|
+
|
6
|
+
class TestIsolate < MiniTest::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@isolate = Isolate.new "tmp/gems"
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
@isolate.disable
|
13
|
+
Isolate.instance.disable if Isolate.instance
|
14
|
+
FileUtils.rm_rf "tmp/gems"
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_self_gems
|
18
|
+
assert_nil Isolate.instance
|
19
|
+
|
20
|
+
Isolate.gems "test/fixtures/with-hoe" do
|
21
|
+
gem "hoe"
|
22
|
+
end
|
23
|
+
|
24
|
+
refute_nil Isolate.instance
|
25
|
+
assert_equal "test/fixtures/with-hoe", Isolate.instance.path
|
26
|
+
assert_equal "hoe", Isolate.instance.entries.first.name
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_activate
|
30
|
+
@isolate = Isolate.new "test/fixtures/with-hoe"
|
31
|
+
|
32
|
+
assert_nil Gem.loaded_specs["hoe"]
|
33
|
+
|
34
|
+
@isolate.gem "hoe"
|
35
|
+
@isolate.activate
|
36
|
+
|
37
|
+
refute_nil Gem.loaded_specs["hoe"]
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_activate_environment
|
41
|
+
@isolate = Isolate.new "test/fixtures/with-hoe"
|
42
|
+
@isolate.gem "rubyforge"
|
43
|
+
|
44
|
+
@isolate.environment "borg" do
|
45
|
+
@isolate.gem "hoe"
|
46
|
+
end
|
47
|
+
|
48
|
+
@isolate.activate
|
49
|
+
assert_nil Gem.loaded_specs["hoe"]
|
50
|
+
refute_nil Gem.loaded_specs["rubyforge"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_activate_environment_explicit
|
54
|
+
@isolate = Isolate.new "test/fixtures/with-hoe"
|
55
|
+
|
56
|
+
@isolate.gem "rubyforge"
|
57
|
+
|
58
|
+
@isolate.environment "borg" do
|
59
|
+
@isolate.gem "hoe"
|
60
|
+
end
|
61
|
+
|
62
|
+
@isolate.activate "borg"
|
63
|
+
refute_nil Gem.loaded_specs["hoe"]
|
64
|
+
refute_nil Gem.loaded_specs["rubyforge"]
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_activate_install
|
68
|
+
@isolate = Isolate.new "tmp/gems", :install => true
|
69
|
+
|
70
|
+
@isolate.gem "foo"
|
71
|
+
|
72
|
+
# rescuing because activate, well, actually tries to activate
|
73
|
+
begin; @isolate.activate; rescue Gem::LoadError; end
|
74
|
+
|
75
|
+
assert_equal ["foo", Gem::Requirement.default],
|
76
|
+
Gem::DependencyInstaller.last_install
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_activate_ret
|
80
|
+
assert_equal @isolate, @isolate.activate
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_disable
|
84
|
+
home, path = ENV.values_at "GEM_HOME", "GEM_PATH"
|
85
|
+
load_path = $LOAD_PATH.dup
|
86
|
+
|
87
|
+
@isolate.enable
|
88
|
+
|
89
|
+
refute_equal home, ENV["GEM_HOME"]
|
90
|
+
refute_equal path, ENV["GEM_PATH"]
|
91
|
+
refute_equal load_path, $LOAD_PATH
|
92
|
+
|
93
|
+
@isolate.disable
|
94
|
+
|
95
|
+
assert_equal home, ENV["GEM_HOME"]
|
96
|
+
assert_equal path, ENV["GEM_PATH"]
|
97
|
+
assert_equal load_path, $LOAD_PATH
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_disable_ret
|
101
|
+
assert_equal @isolate, @isolate.disable
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_enable
|
105
|
+
assert !Gem.find_files("minitest/unit.rb").empty?,
|
106
|
+
"There's a minitest/unit in the current env, since we're running it."
|
107
|
+
|
108
|
+
@isolate.enable
|
109
|
+
|
110
|
+
assert_equal @isolate.path, ENV["GEM_PATH"]
|
111
|
+
assert_equal @isolate.path, ENV["GEM_HOME"]
|
112
|
+
|
113
|
+
assert_equal [], Gem.find_files("minitest/unit.rb"),
|
114
|
+
"Can't find minitest/unit now, 'cause we're activated!"
|
115
|
+
|
116
|
+
assert Gem.loaded_specs.empty?
|
117
|
+
assert_equal [@isolate.path], Gem.path
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_enable_block
|
121
|
+
path = Gem.path.dup
|
122
|
+
refute_equal [@isolate.path], Gem.path
|
123
|
+
|
124
|
+
@isolate.enable do
|
125
|
+
assert_equal [@isolate.path], Gem.path
|
126
|
+
end
|
127
|
+
|
128
|
+
assert_equal path, Gem.path
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_enable_ret
|
132
|
+
assert_equal @isolate, @isolate.enable
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_environment
|
136
|
+
@isolate.gem "none"
|
137
|
+
|
138
|
+
@isolate.environment "test", "ci" do
|
139
|
+
@isolate.gem "test-ci"
|
140
|
+
|
141
|
+
@isolate.environment "production" do
|
142
|
+
@isolate.gem "test-ci-production"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
none, test_ci, test_ci_production = @isolate.entries
|
147
|
+
|
148
|
+
assert_equal [], none.environments
|
149
|
+
assert_equal %w(test ci), test_ci.environments
|
150
|
+
assert_equal %w(test ci production), test_ci_production.environments
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_gem
|
154
|
+
g = @isolate.gem "foo"
|
155
|
+
assert @isolate.entries.include?(g)
|
156
|
+
|
157
|
+
assert_equal "foo", g.name
|
158
|
+
assert_equal Gem::Requirement.create(">= 0"), g.requirement
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_gem_multi_requirements
|
162
|
+
g = @isolate.gem "foo", "= 1.0", "< 2.0"
|
163
|
+
assert_equal Gem::Requirement.create(["= 1.0", "< 2.0"]), g.requirement
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_gem_options
|
167
|
+
g = @isolate.gem "foo", :source => "somewhere"
|
168
|
+
assert_equal "somewhere", g.options[:source]
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_initialize
|
172
|
+
i = Isolate.new "foo/gems"
|
173
|
+
assert_equal "foo/gems", i.path
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_initialize_options
|
177
|
+
refute @isolate.install?
|
178
|
+
refute @isolate.verbose?
|
179
|
+
|
180
|
+
i = Isolate.new "foo/gems", :install => true, :verbose => true
|
181
|
+
assert i.install?
|
182
|
+
assert i.verbose?
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Gem::DependencyInstaller#install is brutally stubbed.
|
187
|
+
|
188
|
+
class Gem::DependencyInstaller
|
189
|
+
@@last_install = nil
|
190
|
+
def self.last_install; @@last_install end
|
191
|
+
|
192
|
+
alias old_install install
|
193
|
+
|
194
|
+
def install name, requirement
|
195
|
+
@@last_install = [name, requirement]
|
196
|
+
end
|
197
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: isolate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Barnette
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-21 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.3
|
24
|
+
version:
|
25
|
+
description: |-
|
26
|
+
Isolate is a very simple RubyGems sandbox. It restricts GEM_PATH and
|
27
|
+
GEM_HOME, and provides a DSL for expressing your code's runtime Gem
|
28
|
+
dependencies.
|
29
|
+
|
30
|
+
While Isolate doesn't make any assumptions about what sort of code
|
31
|
+
you're writing, it was extracted from a few Rails apps, so it's
|
32
|
+
naturally going to be most useful with stuff like Rails, Merb, or
|
33
|
+
Sinatra.
|
34
|
+
|
35
|
+
Isolate is very, very, very stupid simple. For a much more
|
36
|
+
full-featured Gem bundler, check out Yehuda Katz and Carl Lerche's
|
37
|
+
Bundler[http://github.com/wycats/bundler]: It does a lot of fancy AOT
|
38
|
+
dependency resolution, supports non-gem resources, and is probably a
|
39
|
+
better fit for you. For a widely used Gem manager and installer, check
|
40
|
+
out Chad Wooley's GemInstaller[http://geminstaller.rubyforge.org].
|
41
|
+
|
42
|
+
YMMV, but I haven't tried Isolate with anything older than RubyGems
|
43
|
+
1.3.5.
|
44
|
+
email:
|
45
|
+
- jbarnette@rubyforge.org
|
46
|
+
executables: []
|
47
|
+
|
48
|
+
extensions: []
|
49
|
+
|
50
|
+
extra_rdoc_files:
|
51
|
+
- Manifest.txt
|
52
|
+
- CHANGELOG.rdoc
|
53
|
+
- README.rdoc
|
54
|
+
files:
|
55
|
+
- .autotest
|
56
|
+
- CHANGELOG.rdoc
|
57
|
+
- Manifest.txt
|
58
|
+
- README.rdoc
|
59
|
+
- Rakefile
|
60
|
+
- lib/isolate.rb
|
61
|
+
- test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
|
62
|
+
- test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
|
63
|
+
- test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
|
64
|
+
- test/test_isolate.rb
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/jbarnette/isolate
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --main
|
72
|
+
- README.rdoc
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project: isolate
|
90
|
+
rubygems_version: 1.3.5
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: Isolate is a very simple RubyGems sandbox
|
94
|
+
test_files:
|
95
|
+
- test/test_isolate.rb
|