impromptu 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.5.1
data/impromptu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{impromptu}
8
- s.version = "1.5.0"
8
+ s.version = "1.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Will Cannings"]
12
- s.date = %q{2011-01-23}
12
+ s.date = %q{2011-03-10}
13
13
  s.description = %q{Component and dependency manager for Ruby}
14
14
  s.email = %q{me@willcannings.com}
15
15
  s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ module Impromptu
31
31
  # Indicate whether this file needs to be preloaded
32
32
  def preload=(preload)
33
33
  @preload = preload
34
+ @resources.each {|resource| resource.preload = preload}
34
35
  end
35
36
 
36
37
  # True if this file needs to be preloaded before other files
@@ -81,10 +81,18 @@ module Impromptu
81
81
  @options[:preload]
82
82
  end
83
83
 
84
+ # Turn preloading on for this folder (can be done after initialisation)
85
+ # and run an initial preload. Ensures files are always loaded.
86
+ def preload!
87
+ @options[:preload] = true
88
+ @files.each {|file| file.preload = true}
89
+ preload
90
+ end
91
+
84
92
  # Preload the resources defined by this folder. Should only be called
85
93
  # by the Impromptu module, and only once (at app startup).
86
94
  def preload
87
- return unless preload?
95
+ return unless preload? || force
88
96
  @files.each do |file|
89
97
  file.reload
90
98
  end
@@ -416,5 +416,28 @@ class TestIntegration < Test::Unit::TestCase
416
416
  assert Framework::Klass2.new_method
417
417
  end
418
418
  end
419
+
420
+
421
+ # ----------------------------------------
422
+ # Preloading a folder after initialisation
423
+ # ----------------------------------------
424
+ context "and preloading a folder" do
425
+ setup do
426
+ Impromptu.components.first.folders.first.preload!
427
+ end
428
+
429
+ should "preload the folder and all files and resources associated with it" do
430
+ folder = Impromptu.components.first.folders.first
431
+ assert folder.preload?
432
+
433
+ folder.files.each do |file|
434
+ assert file.preload?
435
+ file.resources.each do |resource|
436
+ assert resource.preload?
437
+ end
438
+ end
439
+ end
440
+
441
+ end
419
442
  end
420
443
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 0
9
- version: 1.5.0
8
+ - 1
9
+ version: 1.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Will Cannings
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-23 00:00:00 +11:00
17
+ date: 2011-03-10 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency