isolate 1.9.1 → 1.9.2

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/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.9.2 / 2010-02-17
2
+
3
+ * Make it easier to break out the manifest to a separate file.
4
+
1
5
  === 1.9.1 / 2010-01-18
2
6
 
3
7
  * Append to sources on install, don't just replace 'em.
data/Manifest.txt CHANGED
@@ -6,6 +6,7 @@ Rakefile
6
6
  lib/hoe/isolate.rb
7
7
  lib/isolate.rb
8
8
  lib/isolate/rake.rb
9
+ test/fixtures/isolate.rb
9
10
  test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
10
11
  test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
11
12
  test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec
data/README.rdoc CHANGED
@@ -38,7 +38,7 @@ same name. Version specifiers are optional.
38
38
  require "rubygems"
39
39
  require "isolate"
40
40
 
41
- Isolate.gems "vendor/isolated" do
41
+ Isolate.gems "tmp/gems" do
42
42
  gem "johnson", "~> 1.1" # or maybe...
43
43
  gem "jbarnette-johnson"
44
44
  end
@@ -61,7 +61,7 @@ Sometimes different sets of gems are appropriate at different
61
61
  times. Isolate allows you to restrict gems by 'environment' (which is
62
62
  really just a string passed in when things are activated).
63
63
 
64
- Isolate.gems "vendor/isolated" do
64
+ Isolate.gems "tmp/gems" do
65
65
  gem "intercession"
66
66
 
67
67
  environment :test, :cucumber do
@@ -86,6 +86,15 @@ exceptions, <tt>:source</tt> and <tt>:args</tt>.
86
86
  # pass gem install args (the part after the '--')
87
87
  gem "agem", :args => "--no-blah"
88
88
 
89
+ === An External File
90
+
91
+ If you'd like to have a separate file that *just* has your +gem+ and
92
+ +environment+ calls in it, You can pass an optional <tt>:file</tt>
93
+ option instead of (or in addition to) providing a block.
94
+
95
+ # keepin' things clean
96
+ Isolate.gems "tmp/gems", :file => "config/isolate.rb"
97
+
89
98
  === Installing Isolated Gems
90
99
 
91
100
  By default, Isolate will install and clean up your gems
@@ -93,17 +102,17 @@ automatically. You can pass the <tt>:cleanup</tt>, <tt>:install</tt>,
93
102
  and <tt>:verbose</tt> options to control things:
94
103
 
95
104
  # don't remove unnecesary gems
96
- Isolate.gems "vendor/isolated", :cleanup => false do
105
+ Isolate.gems "tmp/gems", :cleanup => false do
97
106
  ...
98
107
  end
99
108
 
100
109
  # install, but quietly
101
- Isolate.gems "vendor/isolated", :verbose => false do
110
+ Isolate.gems "tmp/gems", :verbose => false do
102
111
  ...
103
112
  end
104
113
 
105
114
  # don't install
106
- Isolate.gems "vendor/isolated", :install => false do
115
+ Isolate.gems "tmp/gems", :install => false do
107
116
  ...
108
117
  end
109
118
 
@@ -142,49 +151,55 @@ doesn't want to depend on any system gems (except isolate, of course).
142
151
 
143
152
  Gem dependencies are defined in <tt>config/preinitializer.rb</tt>. If
144
153
  you want, you could just as easily put them in
145
- <tt>config/{gems,deps,whatever}.rb</tt>, just make sure it's loaded in
154
+ <tt>config/{gems,deps,isolate}.rb</tt>, just make sure it's loaded in
146
155
  the preinitializer:
147
156
 
148
157
  require "rubygems"
149
158
  require "isolate"
150
159
 
151
- Isolate.gems "vendor/isolated" do
152
- gem "rails", "= 2.2.2"
160
+ Isolate.gems "tmp/gems", :file => "config/isolate.rb"
153
161
 
154
- # async emails!
155
- gem "ar_mailer", "~> 1.3", '>= 1.3.3'
162
+ In <tt>config/isolate.rb</tt>:
156
163
 
157
- # Facebook integration
158
- gem "facebooker", ">= 1.0.31"
164
+ gem "rails", "= 2.2.2"
159
165
 
160
- # Google contacts integration
161
- gem "gmail_contacts", "~> 1.7"
166
+ # async emails!
167
+ gem "ar_mailer", "~> 1.3", '>= 1.3.3'
162
168
 
163
- # View templates
164
- gem "haml", "~> 2.0"
169
+ # Facebook integration
170
+ gem "facebooker", ">= 1.0.31"
165
171
 
166
- # Session as model
167
- gem "intercession", "~> 1.0"
172
+ # Google contacts integration
173
+ gem "gmail_contacts", "~> 1.7"
168
174
 
169
- # XML/HTML parsing in Facebooker and tests
170
- gem "nokogiri", ">= 1.2.3"
175
+ # View templates
176
+ gem "haml", "~> 2.0"
171
177
 
172
- # Twitter authentication
173
- gem "oauth", "~> 0.3"
178
+ # Session as model
179
+ gem "intercession", "~> 1.0"
174
180
 
175
- environment :cucumber, :development, :test do
176
- gem "cucumber" # stories!
177
- gem "modelizer" # easy model factories
178
- gem "sqlite3-ruby" # database support
179
- gem "vlad" # deployment
180
- gem "webrat" # integration tests
181
- end
181
+ # XML/HTML parsing in Facebooker and tests
182
+ gem "nokogiri", ">= 1.2.3"
183
+
184
+ # Twitter authentication
185
+ gem "oauth", "~> 0.3"
186
+
187
+ environment :cucumber, :development, :test do
188
+ gem "cucumber" # stories!
189
+ gem "modelizer" # easy model factories
190
+ gem "sqlite3-ruby" # database support
191
+ gem "vlad" # deployment
192
+ gem "webrat" # integration tests
182
193
  end
183
194
 
184
- Since this is in the preinitializer, Isolate will install and activate
185
- the all gems before Rails loads. The current environment is determined
186
- by looking at the <tt>ISOLATE_ENV</tt>, <tt>RAILS_ENV</tt>, or
187
- <tt>RACK_ENV</tt> environment variable. If none are set,
195
+ You could specify all this inside an <tt>Isolate.gems</tt> block in
196
+ <tt>config/preinitializer.rb</tt>, of course, but sometimes it's nicer
197
+ to have an external file that's just your dependency manifest.
198
+
199
+ Since this is loaded in the preinitializer, Isolate will install and
200
+ activate the all gems before Rails loads. The current environment is
201
+ determined by looking at the <tt>ISOLATE_ENV</tt>, <tt>RAILS_ENV</tt>,
202
+ or <tt>RACK_ENV</tt> environment variable. If none are set,
188
203
  <tt>"development"</tt> is the default.
189
204
 
190
205
  Pow. Isolated!
data/lib/isolate.rb CHANGED
@@ -8,7 +8,7 @@ require "rubygems/requirement"
8
8
 
9
9
  class Isolate
10
10
 
11
- VERSION = "1.9.1" # :nodoc:
11
+ VERSION = "1.9.2" # :nodoc:
12
12
 
13
13
  # An isolated Gem, with requirement, environment restrictions, and
14
14
  # installation options. Internal use only.
@@ -37,10 +37,13 @@ class Isolate
37
37
  ENV["ISOLATE_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
38
38
  end
39
39
 
40
- # Declare an isolated RubyGems environment, installed in +path+. The
40
+ # Declare an isolated RubyGems environment, installed in +path+. Any
41
41
  # block given will be <tt>instance_eval</tt>ed, see Isolate#gem and
42
42
  # Isolate#environment for the sort of stuff you can do.
43
43
  #
44
+ # If you'd like to specify gems and environments in a separate file,
45
+ # you can pass an optional <tt>:file</tt> option.
46
+ #
44
47
  # Option defaults:
45
48
  #
46
49
  # { :cleanup => true, :install => true, :verbose => true }
@@ -78,6 +81,7 @@ class Isolate
78
81
  @verbose = options.fetch :verbose, true
79
82
  @cleanup = @install && options.fetch(:cleanup, true)
80
83
 
84
+ instance_eval IO.read(options[:file]) if options[:file]
81
85
  instance_eval(&block) if block_given?
82
86
  end
83
87
 
@@ -0,0 +1 @@
1
+ gem "hoe"
data/test/test_isolate.rb CHANGED
@@ -9,6 +9,8 @@ class TestIsolate < MiniTest::Unit::TestCase
9
9
  def setup
10
10
  @isolate = Isolate.new "tmp/gems", :install => false, :verbose => false
11
11
  @env = ENV.to_hash
12
+
13
+ Gem.loaded_specs.clear
12
14
  end
13
15
 
14
16
  def teardown
@@ -213,6 +215,14 @@ class TestIsolate < MiniTest::Unit::TestCase
213
215
  assert_equal File.expand_path("foo/gems"), i.path
214
216
  end
215
217
 
218
+ def test_initialize_block
219
+ i = Isolate.new "foo/gems" do
220
+ gem "hoe"
221
+ end
222
+
223
+ assert_equal "hoe", i.entries.first.name
224
+ end
225
+
216
226
  def test_initialize_options
217
227
  i = Isolate.new "foo/gems"
218
228
  assert i.install?
@@ -228,6 +238,9 @@ class TestIsolate < MiniTest::Unit::TestCase
228
238
 
229
239
  i = Isolate.new "foo/gems", :install => false
230
240
  refute i.cleanup?, "no install, no cleanup"
241
+
242
+ i = Isolate.new "foo/gems", :file => "test/fixtures/isolate.rb"
243
+ assert_equal "hoe", i.entries.first.name
231
244
  end
232
245
  end
233
246
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-18 00:00:00 -08:00
13
+ date: 2010-02-17 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 0.2.1
34
+ version: 0.3.0
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
@@ -76,6 +76,7 @@ files:
76
76
  - lib/hoe/isolate.rb
77
77
  - lib/isolate.rb
78
78
  - lib/isolate/rake.rb
79
+ - test/fixtures/isolate.rb
79
80
  - test/fixtures/with-hoe/specifications/hoe-2.3.3.gemspec
80
81
  - test/fixtures/with-hoe/specifications/rake-0.8.7.gemspec
81
82
  - test/fixtures/with-hoe/specifications/rubyforge-1.0.4.gemspec