bonsai 1.3.0 → 1.3.1

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/CHANGES CHANGED
@@ -1,9 +1,6 @@
1
- = 1.3.0 (29/03/2010)
1
+ = 1.3.0 (20/03/2010)
2
2
 
3
3
  * File assets are no longer stripped of digits from the file name (Closes Issue #7)
4
- * File asset "name" property is titlecased. (Closes Issue #11)
5
- * Added a .gitignore so that the output directory is ignored from the get-go.
6
- * Lock to mustache 0.6 to avoid 0.9.X bugs
7
4
 
8
5
  = 1.2.0 (13/03/2010)
9
6
 
data/Gemfile CHANGED
@@ -1,13 +1,12 @@
1
- source :gemcutter
2
-
3
1
  gem 'jeweler'
4
2
  gem 'rspec'
5
3
  gem 'yard'
6
4
  gem 'tilt'
7
- gem 'mustache', '0.6.0'
5
+ gem 'mustache'
8
6
  gem 'builder'
9
7
  gem 'watch'
10
8
  gem 'sinatra'
11
9
  gem 'maruku'
12
10
  gem 'less'
13
- gem 'launchy'
11
+ gem 'launchy'
12
+ gem 'activesupport'
data/Gemfile.lock CHANGED
@@ -1,95 +1,58 @@
1
- ---
2
- dependencies:
3
- maruku:
4
- group:
5
- - :default
6
- version: ">= 0"
7
- mustache:
8
- group:
9
- - :default
10
- version: = 0.6.0
11
- yard:
12
- group:
13
- - :default
14
- version: ">= 0"
15
- rspec:
16
- group:
17
- - :default
18
- version: ">= 0"
19
- watch:
20
- group:
21
- - :default
22
- version: ">= 0"
23
- sinatra:
24
- group:
25
- - :default
26
- version: ">= 0"
27
- jeweler:
28
- group:
29
- - :default
30
- version: ">= 0"
31
- less:
32
- group:
33
- - :default
34
- version: ">= 0"
35
- tilt:
36
- group:
37
- - :default
38
- version: ">= 0"
39
- builder:
40
- group:
41
- - :default
42
- version: ">= 0"
43
- launchy:
44
- group:
45
- - :default
46
- version: ">= 0"
47
- specs:
48
- - rake:
49
- version: 0.8.7
50
- - builder:
51
- version: 2.1.2
52
- - configuration:
53
- version: 1.1.0
54
- - json_pure:
55
- version: 1.2.3
56
- - gemcutter:
57
- version: 0.5.0
58
- - git:
59
- version: 1.2.5
60
- - rubyforge:
61
- version: 2.0.4
62
- - jeweler:
63
- version: 1.4.0
64
- - launchy:
65
- version: 0.3.5
66
- - mutter:
67
- version: 0.5.3
68
- - polyglot:
69
- version: 0.3.1
70
- - treetop:
71
- version: 1.4.5
72
- - less:
73
- version: 1.2.21
74
- - syntax:
75
- version: 1.0.0
76
- - maruku:
77
- version: 0.6.0
78
- - mustache:
79
- version: 0.6.0
80
- - rack:
81
- version: 1.1.0
82
- - rspec:
83
- version: 1.3.0
84
- - sinatra:
85
- version: "1.0"
86
- - tilt:
87
- version: "0.8"
88
- - watch:
89
- version: 0.1.0
90
- - yard:
91
- version: 0.5.4
92
- hash: b3b574f01bf6f8e6fe47ea377ef334b53b8a4396
93
- sources:
94
- - Rubygems:
95
- uri: http://gemcutter.org
1
+ GEM
2
+ specs:
3
+ activesupport (2.3.5)
4
+ builder (2.1.2)
5
+ configuration (1.1.0)
6
+ gemcutter (0.2.0)
7
+ json_pure
8
+ net-scp
9
+ git (1.2.5)
10
+ jeweler (1.4.0)
11
+ gemcutter (>= 0.1.0)
12
+ git (>= 1.2.5)
13
+ rubyforge (>= 2.0.0)
14
+ json_pure (1.4.3)
15
+ launchy (0.3.7)
16
+ configuration (>= 0.0.5)
17
+ rake (>= 0.8.1)
18
+ less (1.2.20)
19
+ mutter (>= 0.4.2)
20
+ treetop (>= 1.4.2)
21
+ maruku (0.6.0)
22
+ syntax (>= 1.0.0)
23
+ mustache (0.6.0)
24
+ mutter (0.5.2)
25
+ net-scp (1.0.2)
26
+ net-ssh (>= 1.99.1)
27
+ net-ssh (2.0.15)
28
+ polyglot (0.3.1)
29
+ rack (1.2.1)
30
+ rake (0.8.7)
31
+ rspec (1.3.0)
32
+ rubyforge (2.0.4)
33
+ json_pure (>= 1.1.7)
34
+ sinatra (1.0)
35
+ rack (>= 1.0)
36
+ syntax (1.0.0)
37
+ tilt (0.8)
38
+ treetop (1.4.8)
39
+ polyglot (>= 0.3.1)
40
+ watch (0.1.0)
41
+ yard (0.2.2)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ activesupport
48
+ builder
49
+ jeweler
50
+ launchy
51
+ less
52
+ maruku
53
+ mustache
54
+ rspec
55
+ sinatra
56
+ tilt
57
+ watch
58
+ yard
data/Rakefile CHANGED
@@ -1,13 +1,15 @@
1
1
  # coding: utf-8
2
2
  begin
3
- require File.dirname(__FILE__) + '/.bundle/environment'
3
+ require "rubygems"
4
+ require "bundler"
5
+ Bundler.setup
4
6
  rescue LoadError
5
7
  raise <<-HELP
6
8
  Bonsai uses the gem bundler to handle its development dependencies under
7
- multiple environments. So if you're testing under 1.8, 1.9, jruby or otherwise
9
+ multiple environments. So if you're testing under 1.8, 1.9.x, jruby or otherwise
8
10
  you should ensure that you have the `bundler` gem installed.
9
11
 
10
- Then run `bundle install --relock`. Following going through these steps you should
12
+ Then run `gem bundle`. Following going through these steps you should
11
13
  not see this error message. If you do, please contact me or raise an issue.
12
14
  (http://github.com/benschwarz/bonsai/issues)
13
15
  HELP
@@ -27,19 +29,19 @@ begin
27
29
  gem.executables = ['bonsai']
28
30
  gem.has_rdoc = false
29
31
  gem.files.exclude 'vendor/gems'
30
- gem.files.exclude 'vendor/cache'
31
32
 
32
33
  gem.add_development_dependency "rspec", ">= 1.3.0"
33
34
  gem.add_development_dependency "yard", ">= 0"
34
- gem.add_dependency "tilt", ">= 0.8"
35
- gem.add_dependency "mustache", "= 0.6"
36
- gem.add_dependency "builder", ">= 2.1.2"
37
- gem.add_dependency "watch", ">= 0.1.0"
38
- gem.add_dependency "sinatra", ">= 0.9.4"
39
- gem.add_dependency "maruku", ">= 0.6.0"
40
- gem.add_dependency "less", ">= 1.2.17"
41
- gem.add_dependency "rack", ">= 1.1.0"
42
- gem.add_dependency "launchy", ">= 0.3.3"
35
+ gem.add_dependency "tilt", "= 0.5"
36
+ gem.add_dependency "mustache", "= 0.5.0"
37
+ gem.add_dependency "builder", "= 2.1.2"
38
+ gem.add_dependency "watch", "= 0.1.0"
39
+ gem.add_dependency "sinatra", "= 0.9.4"
40
+ gem.add_dependency "maruku", "= 0.6.0"
41
+ gem.add_dependency "less", "= 1.2.17"
42
+ gem.add_dependency "rack", "= 1.1.0"
43
+ gem.add_dependency "launchy", "= 0.3.3"
44
+ gem.add_dependency "activesupport", "= 2.3.5"
43
45
 
44
46
  gem.post_install_message = %q{
45
47
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -1,4 +1,4 @@
1
- require 'lib/bonsai'
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../lib/bonsai")
2
2
  require 'benchmark'
3
3
 
4
4
  Bonsai.root_dir = File.dirname(__FILE__) + "/../spec/support"
data/bonsai.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bonsai}
8
- s.version = "1.3.0"
8
+ s.version = "1.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Schwarz"]
12
- s.date = %q{2010-03-29}
12
+ s.date = %q{2010-08-03}
13
13
  s.default_executable = %q{bonsai}
14
14
  s.description = %q{A static site generator that uses the best toolset available}
15
15
  s.email = %q{ben.schwarz@gmail.com}
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
20
20
  ]
21
21
  s.files = [
22
22
  ".bundle/config",
23
- ".bundle/environment.rb",
24
23
  ".document",
25
24
  ".gitignore",
26
25
  ".kick",
@@ -42,6 +41,7 @@ Gem::Specification.new do |s|
42
41
  "lib/bonsai/page.rb",
43
42
  "lib/bonsai/sitemap.rb",
44
43
  "lib/bonsai/template.rb",
44
+ "lib/bonsai/templates/.gitignore",
45
45
  "lib/bonsai/templates/content/1.varieties/1.fig/default.yml",
46
46
  "lib/bonsai/templates/content/1.varieties/2.maple/default.yml",
47
47
  "lib/bonsai/templates/content/1.varieties/3.magic/images/magic.jpg",
@@ -65,6 +65,7 @@ Gem::Specification.new do |s|
65
65
  "lib/bonsai/templates/templates/shared/nav.mustache",
66
66
  "lib/bonsai/webserver.rb",
67
67
  "lib/bonsai/webserver/error.erb",
68
+ "lib/core_ext/string.rb",
68
69
  "spec/bonsai/console_spec.rb",
69
70
  "spec/bonsai/exporter_spec.rb",
70
71
  "spec/bonsai/generate_spec.rb",
@@ -115,9 +116,21 @@ Gem::Specification.new do |s|
115
116
  "spec/support/site.yml",
116
117
  "spec/support/templates/demo-template.mustache",
117
118
  "spec/support/templates/partials/inserted.mustache",
118
- "vendor/yui-compressor/yuicompressor-2.4.2.jar"
119
+ "vendor/cache/activesupport-2.3.5.gem",
120
+ "vendor/cache/builder-2.1.2.gem",
121
+ "vendor/cache/configuration-1.1.0.gem",
122
+ "vendor/cache/gemcutter-0.5.0.gem",
123
+ "vendor/cache/git-1.2.5.gem",
124
+ "vendor/cache/jeweler-1.4.0.gem",
125
+ "vendor/cache/json_pure-1.2.3.gem",
126
+ "vendor/cache/maruku-0.6.0.gem",
127
+ "vendor/cache/rake-0.8.7.gem",
128
+ "vendor/cache/rspec-1.3.0.gem",
129
+ "vendor/cache/rubyforge-2.0.4.gem",
130
+ "vendor/cache/syntax-1.0.0.gem",
131
+ "vendor/cache/watch-0.1.0.gem",
132
+ "vendor/cache/yard-0.2.2.gem"
119
133
  ]
120
- s.has_rdoc = false
121
134
  s.homepage = %q{http://github.com/benschwarz/bonsai}
122
135
  s.post_install_message = %q{
123
136
 
@@ -130,7 +143,7 @@ Gem::Specification.new do |s|
130
143
  }
131
144
  s.rdoc_options = ["--charset=UTF-8"]
132
145
  s.require_paths = ["lib"]
133
- s.rubygems_version = %q{1.3.6}
146
+ s.rubygems_version = %q{1.3.7}
134
147
  s.summary = %q{A static site generator that uses the best toolset available}
135
148
  s.test_files = [
136
149
  "spec/bonsai/console_spec.rb",
@@ -148,43 +161,46 @@ Gem::Specification.new do |s|
148
161
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
149
162
  s.specification_version = 3
150
163
 
151
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
164
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
152
165
  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
153
166
  s.add_development_dependency(%q<yard>, [">= 0"])
154
- s.add_runtime_dependency(%q<tilt>, [">= 0.8"])
155
- s.add_runtime_dependency(%q<mustache>, ["= 0.6"])
156
- s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
157
- s.add_runtime_dependency(%q<watch>, [">= 0.1.0"])
158
- s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
159
- s.add_runtime_dependency(%q<maruku>, [">= 0.6.0"])
160
- s.add_runtime_dependency(%q<less>, [">= 1.2.17"])
161
- s.add_runtime_dependency(%q<rack>, [">= 1.1.0"])
162
- s.add_runtime_dependency(%q<launchy>, [">= 0.3.3"])
167
+ s.add_runtime_dependency(%q<tilt>, ["= 0.5"])
168
+ s.add_runtime_dependency(%q<mustache>, ["= 0.5.0"])
169
+ s.add_runtime_dependency(%q<builder>, ["= 2.1.2"])
170
+ s.add_runtime_dependency(%q<watch>, ["= 0.1.0"])
171
+ s.add_runtime_dependency(%q<sinatra>, ["= 0.9.4"])
172
+ s.add_runtime_dependency(%q<maruku>, ["= 0.6.0"])
173
+ s.add_runtime_dependency(%q<less>, ["= 1.2.17"])
174
+ s.add_runtime_dependency(%q<rack>, ["= 1.1.0"])
175
+ s.add_runtime_dependency(%q<launchy>, ["= 0.3.3"])
176
+ s.add_runtime_dependency(%q<activesupport>, ["= 2.3.5"])
163
177
  else
164
178
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
165
179
  s.add_dependency(%q<yard>, [">= 0"])
166
- s.add_dependency(%q<tilt>, [">= 0.8"])
167
- s.add_dependency(%q<mustache>, ["= 0.6"])
168
- s.add_dependency(%q<builder>, [">= 2.1.2"])
169
- s.add_dependency(%q<watch>, [">= 0.1.0"])
170
- s.add_dependency(%q<sinatra>, [">= 0.9.4"])
171
- s.add_dependency(%q<maruku>, [">= 0.6.0"])
172
- s.add_dependency(%q<less>, [">= 1.2.17"])
173
- s.add_dependency(%q<rack>, [">= 1.1.0"])
174
- s.add_dependency(%q<launchy>, [">= 0.3.3"])
180
+ s.add_dependency(%q<tilt>, ["= 0.5"])
181
+ s.add_dependency(%q<mustache>, ["= 0.5.0"])
182
+ s.add_dependency(%q<builder>, ["= 2.1.2"])
183
+ s.add_dependency(%q<watch>, ["= 0.1.0"])
184
+ s.add_dependency(%q<sinatra>, ["= 0.9.4"])
185
+ s.add_dependency(%q<maruku>, ["= 0.6.0"])
186
+ s.add_dependency(%q<less>, ["= 1.2.17"])
187
+ s.add_dependency(%q<rack>, ["= 1.1.0"])
188
+ s.add_dependency(%q<launchy>, ["= 0.3.3"])
189
+ s.add_dependency(%q<activesupport>, ["= 2.3.5"])
175
190
  end
176
191
  else
177
192
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
178
193
  s.add_dependency(%q<yard>, [">= 0"])
179
- s.add_dependency(%q<tilt>, [">= 0.8"])
180
- s.add_dependency(%q<mustache>, ["= 0.6"])
181
- s.add_dependency(%q<builder>, [">= 2.1.2"])
182
- s.add_dependency(%q<watch>, [">= 0.1.0"])
183
- s.add_dependency(%q<sinatra>, [">= 0.9.4"])
184
- s.add_dependency(%q<maruku>, [">= 0.6.0"])
185
- s.add_dependency(%q<less>, [">= 1.2.17"])
186
- s.add_dependency(%q<rack>, [">= 1.1.0"])
187
- s.add_dependency(%q<launchy>, [">= 0.3.3"])
194
+ s.add_dependency(%q<tilt>, ["= 0.5"])
195
+ s.add_dependency(%q<mustache>, ["= 0.5.0"])
196
+ s.add_dependency(%q<builder>, ["= 2.1.2"])
197
+ s.add_dependency(%q<watch>, ["= 0.1.0"])
198
+ s.add_dependency(%q<sinatra>, ["= 0.9.4"])
199
+ s.add_dependency(%q<maruku>, ["= 0.6.0"])
200
+ s.add_dependency(%q<less>, ["= 1.2.17"])
201
+ s.add_dependency(%q<rack>, ["= 1.1.0"])
202
+ s.add_dependency(%q<launchy>, ["= 0.3.3"])
203
+ s.add_dependency(%q<activesupport>, ["= 2.3.5"])
188
204
  end
189
205
  end
190
206
 
@@ -64,12 +64,15 @@ module Bonsai
64
64
 
65
65
  readme = <<-README
66
66
  This site was built using Bonsai (http://tinytree.info)
67
-
68
- To make changes to the site you will require the original source files.
67
+
68
+ To make changes to the site using Bonsai you will require the original source files.
69
69
  Please contact the author of your site for details.
70
+
71
+ It may also be a good idea to ensure that you've got Bonsai version #{Bonsai.version} or higher.
72
+ If you experience any unexplainable issues try uninstalling all versions of Bonsai (`gem uninstall bonsai`) and install version #{Bonsai.version} (`gem install bonsai -v #{Bonsai.version}`)
70
73
  README
71
74
 
72
- File.open("#{path}/ABOUT-THIS-SITE", "w") {|file| file.write(readme) }
75
+ File.open("#{path}/ABOUT-THIS-SITE.txt", "w") {|file| file.write(readme) }
73
76
  end
74
77
 
75
78
  def copy_assets
data/lib/bonsai/page.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'tilt'
3
+ require 'active_support/inflector'
3
4
 
4
5
  # Use RDiscount for those who care
5
6
  begin
@@ -67,8 +68,8 @@ module Bonsai
67
68
  end
68
69
 
69
70
  # This method is used for the exporter to copy assets
70
- def assets
71
- Dir["#{directory}/**/*"].select{|path| !File.directory?(path) && !File.basename(path).include?("yml") }.map do |file|
71
+ def assets(disk_path = directory)
72
+ Dir["#{disk_path}/**/*"].select{|path| !File.directory?(path) && !File.basename(path).include?("yml") }.map do |file|
72
73
  file_to_hash(file)
73
74
  end
74
75
  end
@@ -95,8 +96,8 @@ module Bonsai
95
96
  self.class.all(File.dirname(disk_path[/(.+)\/[^\/]*$/, 1]), "*").delete_if{|p| p == self}
96
97
  end
97
98
 
98
- def children
99
- self.class.all(File.dirname(disk_path), "*").delete_if{|p| p.floating? }
99
+ def children(path = nil)
100
+ self.class.all((path||directory), "*").delete_if{|p| p.floating? }
100
101
  end
101
102
 
102
103
  def ancestors
@@ -169,8 +170,8 @@ module Bonsai
169
170
  # that isn't itself, a child-page (a page object)
170
171
  def disk_assets
171
172
  assets = {}
172
- Dir["#{File.dirname(disk_path)}/**"].select{|p| File.directory?(p)}.reject {|p|
173
- Dir.entries(p).any?{|e| e.include? "yml"}
173
+ Dir["#{File.dirname(disk_path)}/**"].select{|p|
174
+ File.directory?(p)}.reject {|p| Dir.entries(p).any?{|e| e.include? "yml" }
174
175
  }.each{|asset_path| assets.merge!(map_to_disk(asset_path)) }
175
176
 
176
177
  assets
@@ -180,9 +181,10 @@ module Bonsai
180
181
  name = File.basename(path)
181
182
 
182
183
  {
183
- name.to_sym => Dir["#{path}/*"].map do |file|
184
- file_to_hash(file)
185
- end
184
+ name.to_sym => {
185
+ :files => assets(path),
186
+ :children => children(path).map{|page| page.to_hash }
187
+ }
186
188
  }
187
189
  end
188
190
 
@@ -200,7 +202,7 @@ module Bonsai
200
202
 
201
203
  def file_to_hash(file)
202
204
  {
203
- :name => File.basename(file),
205
+ :name => File.basename(file, ".*").titleize,
204
206
  :path => "#{web_path(File.dirname(file))}/#{File.basename(file)}",
205
207
  :disk_path => File.expand_path(file)
206
208
  }
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ output/*
@@ -1,5 +1,5 @@
1
1
  # The key value pairs found below are available within the templates.
2
- # {{site_name}}, {{url}}, {{copyright}} and {{analytics_code}}
2
+ # {{site_name}}, {{url}}, {{copyright}} and {{analytics_code}} are examples
3
3
 
4
4
  :site_name: Your website title
5
5
  :url: http://yourdomain.com
@@ -0,0 +1,11 @@
1
+ class String
2
+ def to_permalink
3
+ # Pinched: http://github.com/jrun/merb_permalink_fu/tree/master/lib/merb_permalink_fu/permalink_fu.rb
4
+ string = self
5
+
6
+ string = string.gsub(/\W+/, ' ')
7
+ string = string.strip
8
+ string = string.downcase
9
+ string = string.gsub(/\ +/, '-') # spaces to dashes, preferred separator char everywhere
10
+ end
11
+ end
@@ -120,7 +120,7 @@ describe Bonsai::Exporter do
120
120
  end
121
121
 
122
122
  it "should write a readme file to explain how the site was generated" do
123
- File.exists?("#{Bonsai::Exporter.path}/ABOUT-THIS-SITE").should be_true
123
+ File.exists?("#{Bonsai::Exporter.path}/ABOUT-THIS-SITE.txt").should be_true
124
124
  end
125
125
 
126
126
  describe "asset compression" do
@@ -37,12 +37,12 @@ describe Bonsai::Generate do
37
37
  File.exists?("#{@path}/site.yml").should be_true
38
38
  end
39
39
 
40
- it "should generate 21 files" do
41
- Dir.glob("#{@path}/**/*", File::FNM_DOTMATCH).select{|f| File.file?(f) }.size.should == 21
40
+ it "should generate 24 files" do
41
+ Dir.glob("#{@path}/**/*", File::FNM_DOTMATCH).select{|f| File.file?(f) }.size.should == 24
42
42
  end
43
43
 
44
- it "should generate 14 directories" do
45
- Dir.glob("#{@path}/**/*").select{|f| File.directory?(f) }.size.should == 14
44
+ it "should generate 16 directories" do
45
+ Dir.glob("#{@path}/**/*").select{|f| File.directory?(f) }.size.should == 16
46
46
  end
47
47
  end
48
48
  end
@@ -37,6 +37,7 @@ describe Bonsai::Page do
37
37
  @page.should respond_to :mtime
38
38
  @page.mtime.should be_an_instance_of(Time)
39
39
  end
40
+
40
41
  it "should remove numbers over 10 from the permalink" do
41
42
  Bonsai::Page.find("many-pages").permalink.should == "/many-pages/"
42
43
  end
@@ -56,7 +57,7 @@ describe Bonsai::Page do
56
57
  end
57
58
 
58
59
  it "should have the correct name" do
59
- @page.assets.first[:name].should == "001.jpg"
60
+ @page.assets.first[:name].should == "001"
60
61
  end
61
62
 
62
63
  it "should have the correct path" do
@@ -66,6 +67,51 @@ describe Bonsai::Page do
66
67
  it "should have the correct disk_path" do
67
68
  @page.assets.first[:disk_path].should == "/Users/ben/Documents/Projects/bonsai/spec/support/content/1.about-us/history/001.jpg"
68
69
  end
70
+
71
+ it "should titleize the name attribute and remove the file extension" do
72
+ @page.assets[2][:name].should == "A File Asset"
73
+ end
74
+
75
+ describe "disk_assets" do
76
+ before :all do
77
+ @page = Bonsai::Page.find("about-us/contact")
78
+ end
79
+
80
+ it "should have magic" do
81
+ @page.to_hash.should have_key(:magic)
82
+ end
83
+
84
+ it "should have assets" do
85
+ @page.to_hash[:magic][:files].should be_an_instance_of(Array)
86
+ @page.to_hash[:magic][:files].should_not be_empty
87
+ end
88
+
89
+ it "it should be a an array of hashes" do
90
+ @page.to_hash[:magic][:files].should be_an_instance_of(Array)
91
+ @page.to_hash[:magic][:files].first.should be_an_instance_of(Hash)
92
+ @page.to_hash[:magic][:files].size.should == 2
93
+ end
94
+
95
+ it "should have children" do
96
+ @page.to_hash[:magic][:children].should_not be_empty
97
+ end
98
+
99
+ describe "children (pages)" do
100
+ it "should represent the children as pages" do
101
+ @page.to_hash[:magic][:children].first.should be_an_instance_of(Bonsai::Page)
102
+ end
103
+
104
+ it "should contain a single child" do
105
+ @page.to_hash[:magic][:children].size.should == 1
106
+ end
107
+
108
+ %w(slug permalink name page_title children siblings parent ancestors navigation updated_at created_at).each do |key|
109
+ it "should have a to_hash key for #{key}" do
110
+ @page.to_hash[:magic][:children].first.to_hash.keys.should include(key.to_sym)
111
+ end
112
+ end
113
+ end
114
+ end
69
115
  end
70
116
 
71
117
  it "should be equal" do
@@ -150,7 +196,7 @@ describe Bonsai::Page do
150
196
  end
151
197
 
152
198
  it "should replace mustache variables with properties from the content file" do
153
- @output.should == "Hello from our template, named Contact\n\nGet in touch\n\n/about-us/contact/images/image001.jpg\n/about-us/contact/child/\n/about-us/contact/magic/image001.jpg\n/about-us/contact/magic/image002.jpg\nThis content should be inserted!\n\n<p>&ldquo;A designer knows he has achieved perfection\nnot when there is nothing left to add,\nbut when there is nothing left to take away.&rdquo;</p>\n\n<p>– Antoine de Saint-Exupery</p>\n"
199
+ @output.should == "Hello from our template, named Contact\n\nGet in touch\n\n/about-us/contact/images/image001.jpg\n/about-us/contact/child/\n/about-us/contact/magic/containing-a-page\n/about-us/contact/magic/image001.jpg\n/about-us/contact/magic/image002.jpg\nThis content should be inserted!\n\n<p>&ldquo;A designer knows he has achieved perfection\nnot when there is nothing left to add,\nbut when there is nothing left to take away.&rdquo;</p>\n\n<p>– Antoine de Saint-Exupery</p>\n"
154
200
  end
155
201
 
156
202
  it "should write in images" do
@@ -199,28 +245,6 @@ describe Bonsai::Page do
199
245
  @page.to_hash[:url].should == "http://tinytree.info"
200
246
  @page.to_hash[:copyright].should == 2010
201
247
  end
202
-
203
- describe "disk_assets" do
204
- before :all do
205
- @vars = @page.to_hash
206
- end
207
-
208
- describe "enum" do
209
- it "should not have a child" do
210
- @vars.should_not have_key(:child)
211
- end
212
-
213
- it "should have magic" do
214
- @vars.should have_key(:magic)
215
- end
216
-
217
- it "it should be a an array of hashes" do
218
- @vars[:magic].should be_an_instance_of(Array)
219
- @vars[:magic].first.should be_an_instance_of(Hash)
220
- @vars[:magic].size.should == 2
221
- end
222
- end
223
- end
224
248
  end
225
249
 
226
250
  describe "broken page" do
@@ -13,7 +13,7 @@ describe Bonsai::Template do
13
13
  describe "instance" do
14
14
  it "should give the template source" do
15
15
  @template = Bonsai::Template.find("demo-template")
16
- File.read(@template.path).should == "Hello from our template, named {{name}}\n\n{{page_title}}\n\n{{#images}}\n {{path}}\n{{/images}}\n\n{{#children}}\n {{permalink}}\n{{/children}}\n\n{{#magic}}\n {{path}}\n{{/magic}}\n\n{{>partials/inserted}}\n\n{{{body}}}"
16
+ File.read(@template.path).should == "Hello from our template, named {{name}}\n\n{{page_title}}\n\n{{#images}}\n {{#files}}\n {{path}}\n {{/files}}\n{{/images}}\n\n{{#children}}\n {{permalink}}\n{{/children}}\n\n{{#magic}}\n {{path}}\n{{/magic}}\n\n{{>partials/inserted}}\n\n{{{body}}}"
17
17
  end
18
18
  end
19
19
  end
@@ -3,7 +3,9 @@ Hello from our template, named {{name}}
3
3
  {{page_title}}
4
4
 
5
5
  {{#images}}
6
- {{path}}
6
+ {{#files}}
7
+ {{path}}
8
+ {{/files}}
7
9
  {{/images}}
8
10
 
9
11
  {{#children}}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bonsai
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 3
8
- - 0
9
- version: 1.3.0
9
+ - 1
10
+ version: 1.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Ben Schwarz
@@ -14,159 +15,198 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-03-29 00:00:00 +11:00
18
+ date: 2010-08-03 00:00:00 +10:00
18
19
  default_executable: bonsai
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: rspec
22
- prerelease: false
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
+ hash: 27
27
28
  segments:
28
29
  - 1
29
30
  - 3
30
31
  - 0
31
32
  version: 1.3.0
32
33
  type: :development
34
+ name: rspec
35
+ prerelease: false
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
- name: yard
36
- prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
43
+ hash: 3
41
44
  segments:
42
45
  - 0
43
46
  version: "0"
44
47
  type: :development
48
+ name: yard
49
+ prerelease: false
45
50
  version_requirements: *id002
46
51
  - !ruby/object:Gem::Dependency
47
- name: tilt
48
- prerelease: false
49
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
50
54
  requirements:
51
- - - ">="
55
+ - - "="
52
56
  - !ruby/object:Gem::Version
57
+ hash: 1
53
58
  segments:
54
59
  - 0
55
- - 8
56
- version: "0.8"
60
+ - 5
61
+ version: "0.5"
57
62
  type: :runtime
63
+ name: tilt
64
+ prerelease: false
58
65
  version_requirements: *id003
59
66
  - !ruby/object:Gem::Dependency
60
- name: mustache
61
- prerelease: false
62
67
  requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
63
69
  requirements:
64
70
  - - "="
65
71
  - !ruby/object:Gem::Version
72
+ hash: 11
66
73
  segments:
67
74
  - 0
68
- - 6
69
- version: "0.6"
75
+ - 5
76
+ - 0
77
+ version: 0.5.0
70
78
  type: :runtime
79
+ name: mustache
80
+ prerelease: false
71
81
  version_requirements: *id004
72
82
  - !ruby/object:Gem::Dependency
73
- name: builder
74
- prerelease: false
75
83
  requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
76
85
  requirements:
77
- - - ">="
86
+ - - "="
78
87
  - !ruby/object:Gem::Version
88
+ hash: 15
79
89
  segments:
80
90
  - 2
81
91
  - 1
82
92
  - 2
83
93
  version: 2.1.2
84
94
  type: :runtime
95
+ name: builder
96
+ prerelease: false
85
97
  version_requirements: *id005
86
98
  - !ruby/object:Gem::Dependency
87
- name: watch
88
- prerelease: false
89
99
  requirement: &id006 !ruby/object:Gem::Requirement
100
+ none: false
90
101
  requirements:
91
- - - ">="
102
+ - - "="
92
103
  - !ruby/object:Gem::Version
104
+ hash: 27
93
105
  segments:
94
106
  - 0
95
107
  - 1
96
108
  - 0
97
109
  version: 0.1.0
98
110
  type: :runtime
111
+ name: watch
112
+ prerelease: false
99
113
  version_requirements: *id006
100
114
  - !ruby/object:Gem::Dependency
101
- name: sinatra
102
- prerelease: false
103
115
  requirement: &id007 !ruby/object:Gem::Requirement
116
+ none: false
104
117
  requirements:
105
- - - ">="
118
+ - - "="
106
119
  - !ruby/object:Gem::Version
120
+ hash: 51
107
121
  segments:
108
122
  - 0
109
123
  - 9
110
124
  - 4
111
125
  version: 0.9.4
112
126
  type: :runtime
127
+ name: sinatra
128
+ prerelease: false
113
129
  version_requirements: *id007
114
130
  - !ruby/object:Gem::Dependency
115
- name: maruku
116
- prerelease: false
117
131
  requirement: &id008 !ruby/object:Gem::Requirement
132
+ none: false
118
133
  requirements:
119
- - - ">="
134
+ - - "="
120
135
  - !ruby/object:Gem::Version
136
+ hash: 7
121
137
  segments:
122
138
  - 0
123
139
  - 6
124
140
  - 0
125
141
  version: 0.6.0
126
142
  type: :runtime
143
+ name: maruku
144
+ prerelease: false
127
145
  version_requirements: *id008
128
146
  - !ruby/object:Gem::Dependency
129
- name: less
130
- prerelease: false
131
147
  requirement: &id009 !ruby/object:Gem::Requirement
148
+ none: false
132
149
  requirements:
133
- - - ">="
150
+ - - "="
134
151
  - !ruby/object:Gem::Version
152
+ hash: 61
135
153
  segments:
136
154
  - 1
137
155
  - 2
138
156
  - 17
139
157
  version: 1.2.17
140
158
  type: :runtime
159
+ name: less
160
+ prerelease: false
141
161
  version_requirements: *id009
142
162
  - !ruby/object:Gem::Dependency
143
- name: rack
144
- prerelease: false
145
163
  requirement: &id010 !ruby/object:Gem::Requirement
164
+ none: false
146
165
  requirements:
147
- - - ">="
166
+ - - "="
148
167
  - !ruby/object:Gem::Version
168
+ hash: 19
149
169
  segments:
150
170
  - 1
151
171
  - 1
152
172
  - 0
153
173
  version: 1.1.0
154
174
  type: :runtime
175
+ name: rack
176
+ prerelease: false
155
177
  version_requirements: *id010
156
178
  - !ruby/object:Gem::Dependency
157
- name: launchy
158
- prerelease: false
159
179
  requirement: &id011 !ruby/object:Gem::Requirement
180
+ none: false
160
181
  requirements:
161
- - - ">="
182
+ - - "="
162
183
  - !ruby/object:Gem::Version
184
+ hash: 21
163
185
  segments:
164
186
  - 0
165
187
  - 3
166
188
  - 3
167
189
  version: 0.3.3
168
190
  type: :runtime
191
+ name: launchy
192
+ prerelease: false
169
193
  version_requirements: *id011
194
+ - !ruby/object:Gem::Dependency
195
+ requirement: &id012 !ruby/object:Gem::Requirement
196
+ none: false
197
+ requirements:
198
+ - - "="
199
+ - !ruby/object:Gem::Version
200
+ hash: 9
201
+ segments:
202
+ - 2
203
+ - 3
204
+ - 5
205
+ version: 2.3.5
206
+ type: :runtime
207
+ name: activesupport
208
+ prerelease: false
209
+ version_requirements: *id012
170
210
  description: A static site generator that uses the best toolset available
171
211
  email: ben.schwarz@gmail.com
172
212
  executables:
@@ -178,7 +218,6 @@ extra_rdoc_files:
178
218
  - README.md
179
219
  files:
180
220
  - .bundle/config
181
- - .bundle/environment.rb
182
221
  - .document
183
222
  - .gitignore
184
223
  - .kick
@@ -200,6 +239,7 @@ files:
200
239
  - lib/bonsai/page.rb
201
240
  - lib/bonsai/sitemap.rb
202
241
  - lib/bonsai/template.rb
242
+ - lib/bonsai/templates/.gitignore
203
243
  - lib/bonsai/templates/content/1.varieties/1.fig/default.yml
204
244
  - lib/bonsai/templates/content/1.varieties/2.maple/default.yml
205
245
  - lib/bonsai/templates/content/1.varieties/3.magic/images/magic.jpg
@@ -223,6 +263,7 @@ files:
223
263
  - lib/bonsai/templates/templates/shared/nav.mustache
224
264
  - lib/bonsai/webserver.rb
225
265
  - lib/bonsai/webserver/error.erb
266
+ - lib/core_ext/string.rb
226
267
  - spec/bonsai/console_spec.rb
227
268
  - spec/bonsai/exporter_spec.rb
228
269
  - spec/bonsai/generate_spec.rb
@@ -273,8 +314,21 @@ files:
273
314
  - spec/support/site.yml
274
315
  - spec/support/templates/demo-template.mustache
275
316
  - spec/support/templates/partials/inserted.mustache
276
- - vendor/yui-compressor/yuicompressor-2.4.2.jar
277
- has_rdoc: false
317
+ - vendor/cache/activesupport-2.3.5.gem
318
+ - vendor/cache/builder-2.1.2.gem
319
+ - vendor/cache/configuration-1.1.0.gem
320
+ - vendor/cache/gemcutter-0.5.0.gem
321
+ - vendor/cache/git-1.2.5.gem
322
+ - vendor/cache/jeweler-1.4.0.gem
323
+ - vendor/cache/json_pure-1.2.3.gem
324
+ - vendor/cache/maruku-0.6.0.gem
325
+ - vendor/cache/rake-0.8.7.gem
326
+ - vendor/cache/rspec-1.3.0.gem
327
+ - vendor/cache/rubyforge-2.0.4.gem
328
+ - vendor/cache/syntax-1.0.0.gem
329
+ - vendor/cache/watch-0.1.0.gem
330
+ - vendor/cache/yard-0.2.2.gem
331
+ has_rdoc: true
278
332
  homepage: http://github.com/benschwarz/bonsai
279
333
  licenses: []
280
334
 
@@ -284,23 +338,27 @@ rdoc_options:
284
338
  require_paths:
285
339
  - lib
286
340
  required_ruby_version: !ruby/object:Gem::Requirement
341
+ none: false
287
342
  requirements:
288
343
  - - ">="
289
344
  - !ruby/object:Gem::Version
345
+ hash: 3
290
346
  segments:
291
347
  - 0
292
348
  version: "0"
293
349
  required_rubygems_version: !ruby/object:Gem::Requirement
350
+ none: false
294
351
  requirements:
295
352
  - - ">="
296
353
  - !ruby/object:Gem::Version
354
+ hash: 3
297
355
  segments:
298
356
  - 0
299
357
  version: "0"
300
358
  requirements: []
301
359
 
302
360
  rubyforge_project:
303
- rubygems_version: 1.3.6
361
+ rubygems_version: 1.3.7
304
362
  signing_key:
305
363
  specification_version: 3
306
364
  summary: A static site generator that uses the best toolset available
@@ -1,230 +0,0 @@
1
- # DO NOT MODIFY THIS FILE
2
-
3
- require 'digest/sha1'
4
- require 'rubygems'
5
-
6
- module Gem
7
- class Dependency
8
- if !instance_methods.map { |m| m.to_s }.include?("requirement")
9
- def requirement
10
- version_requirements
11
- end
12
- end
13
- end
14
- end
15
-
16
- module Bundler
17
- module SharedHelpers
18
-
19
- def default_gemfile
20
- gemfile = find_gemfile
21
- gemfile or raise GemfileNotFound, "The default Gemfile was not found"
22
- Pathname.new(gemfile)
23
- end
24
-
25
- def in_bundle?
26
- find_gemfile
27
- end
28
-
29
- private
30
-
31
- def find_gemfile
32
- return ENV['BUNDLE_GEMFILE'] if ENV['BUNDLE_GEMFILE']
33
-
34
- previous = nil
35
- current = File.expand_path(Dir.pwd)
36
-
37
- until !File.directory?(current) || current == previous
38
- filename = File.join(current, 'Gemfile')
39
- return filename if File.file?(filename)
40
- current, previous = File.expand_path("..", current), current
41
- end
42
- end
43
-
44
- def clean_load_path
45
- # handle 1.9 where system gems are always on the load path
46
- if defined?(::Gem)
47
- me = File.expand_path("../../", __FILE__)
48
- $LOAD_PATH.reject! do |p|
49
- next if File.expand_path(p).include?(me)
50
- p != File.dirname(__FILE__) &&
51
- Gem.path.any? { |gp| p.include?(gp) }
52
- end
53
- $LOAD_PATH.uniq!
54
- end
55
- end
56
-
57
- def reverse_rubygems_kernel_mixin
58
- # Disable rubygems' gem activation system
59
- ::Kernel.class_eval do
60
- if private_method_defined?(:gem_original_require)
61
- alias rubygems_require require
62
- alias require gem_original_require
63
- end
64
-
65
- undef gem
66
- end
67
- end
68
-
69
- def cripple_rubygems(specs)
70
- reverse_rubygems_kernel_mixin
71
-
72
- executables = specs.map { |s| s.executables }.flatten
73
-
74
- :: Kernel.class_eval do
75
- private
76
- def gem(*) ; end
77
- end
78
- Gem.source_index # ensure RubyGems is fully loaded
79
-
80
- ::Kernel.send(:define_method, :gem) do |dep, *reqs|
81
- if executables.include? File.basename(caller.first.split(':').first)
82
- return
83
- end
84
- opts = reqs.last.is_a?(Hash) ? reqs.pop : {}
85
-
86
- unless dep.respond_to?(:name) && dep.respond_to?(:requirement)
87
- dep = Gem::Dependency.new(dep, reqs)
88
- end
89
-
90
- spec = specs.find { |s| s.name == dep.name }
91
-
92
- if spec.nil?
93
- e = Gem::LoadError.new "#{dep.name} is not part of the bundle. Add it to Gemfile."
94
- e.name = dep.name
95
- e.version_requirement = dep.requirement
96
- raise e
97
- elsif dep !~ spec
98
- e = Gem::LoadError.new "can't activate #{dep}, already activated #{spec.full_name}. " \
99
- "Make sure all dependencies are added to Gemfile."
100
- e.name = dep.name
101
- e.version_requirement = dep.requirement
102
- raise e
103
- end
104
-
105
- true
106
- end
107
-
108
- # === Following hacks are to improve on the generated bin wrappers ===
109
-
110
- # Yeah, talk about a hack
111
- source_index_class = (class << Gem::SourceIndex ; self ; end)
112
- source_index_class.send(:define_method, :from_gems_in) do |*args|
113
- source_index = Gem::SourceIndex.new
114
- source_index.spec_dirs = *args
115
- source_index.add_specs(*specs)
116
- source_index
117
- end
118
-
119
- # OMG more hacks
120
- gem_class = (class << Gem ; self ; end)
121
- gem_class.send(:define_method, :bin_path) do |name, *args|
122
- exec_name, *reqs = args
123
-
124
- spec = nil
125
-
126
- if exec_name
127
- spec = specs.find { |s| s.executables.include?(exec_name) }
128
- spec or raise Gem::Exception, "can't find executable #{exec_name}"
129
- else
130
- spec = specs.find { |s| s.name == name }
131
- exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
132
- end
133
-
134
- gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
135
- gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
136
- File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
137
- end
138
- end
139
-
140
- extend self
141
- end
142
- end
143
-
144
- module Bundler
145
- LOCKED_BY = '0.9.13'
146
- FINGERPRINT = "b3b574f01bf6f8e6fe47ea377ef334b53b8a4396"
147
- AUTOREQUIRES = {:default=>[["builder", false], ["jeweler", false], ["launchy", false], ["less", false], ["maruku", false], ["mustache", false], ["rspec", false], ["sinatra", false], ["tilt", false], ["watch", false], ["yard", false]]}
148
- SPECS = [
149
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/rake-0.8.7/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/rake-0.8.7.gemspec", :name=>"rake"},
150
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/builder-2.1.2/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/builder-2.1.2.gemspec", :name=>"builder"},
151
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/configuration-1.1.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/configuration-1.1.0.gemspec", :name=>"configuration"},
152
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/json_pure-1.2.3/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/json_pure-1.2.3.gemspec", :name=>"json_pure"},
153
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/gemcutter-0.5.0/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/gemcutter-0.5.0.gemspec", :name=>"gemcutter"},
154
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/git-1.2.5/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/git-1.2.5.gemspec", :name=>"git"},
155
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/rubyforge-2.0.4/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/rubyforge-2.0.4.gemspec", :name=>"rubyforge"},
156
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/jeweler-1.4.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/jeweler-1.4.0.gemspec", :name=>"jeweler"},
157
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/launchy-0.3.5/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/launchy-0.3.5.gemspec", :name=>"launchy"},
158
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/mutter-0.5.3/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/mutter-0.5.3.gemspec", :name=>"mutter"},
159
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/polyglot-0.3.1.gemspec", :name=>"polyglot"},
160
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/treetop-1.4.5/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/treetop-1.4.5.gemspec", :name=>"treetop"},
161
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/less-1.2.21/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/less-1.2.21.gemspec", :name=>"less"},
162
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/syntax-1.0.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/syntax-1.0.0.gemspec", :name=>"syntax"},
163
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/maruku-0.6.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/maruku-0.6.0.gemspec", :name=>"maruku"},
164
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/mustache-0.6.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/mustache-0.6.0.gemspec", :name=>"mustache"},
165
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/rack-1.1.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/rack-1.1.0.gemspec", :name=>"rack"},
166
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/rspec-1.3.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/rspec-1.3.0.gemspec", :name=>"rspec"},
167
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/sinatra-1.0/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/sinatra-1.0.gemspec", :name=>"sinatra"},
168
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/tilt-0.8/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/tilt-0.8.gemspec", :name=>"tilt"},
169
- {:load_paths=>["/Users/ben/.gem/ruby/1.8/gems/watch-0.1.0/lib"], :loaded_from=>"/Users/ben/.gem/ruby/1.8/specifications/watch-0.1.0.gemspec", :name=>"watch"},
170
- {:load_paths=>["/Users/ben/.bundle/ruby/1.8/gems/yard-0.5.4/lib"], :loaded_from=>"/Users/ben/.bundle/ruby/1.8/specifications/yard-0.5.4.gemspec", :name=>"yard"},
171
- ].map do |hash|
172
- if hash[:virtual_spec]
173
- spec = eval(hash[:virtual_spec], binding, "<virtual spec for '#{hash[:name]}'>")
174
- else
175
- dir = File.dirname(hash[:loaded_from])
176
- spec = Dir.chdir(dir){ eval(File.read(hash[:loaded_from]), binding, hash[:loaded_from]) }
177
- end
178
- spec.loaded_from = hash[:loaded_from]
179
- spec.require_paths = hash[:load_paths]
180
- spec
181
- end
182
-
183
- extend SharedHelpers
184
-
185
- def self.configure_gem_path_and_home(specs)
186
- # Fix paths, so that Gem.source_index and such will work
187
- paths = specs.map{|s| s.installation_path }
188
- paths.flatten!; paths.compact!; paths.uniq!; paths.reject!{|p| p.empty? }
189
- ENV['GEM_PATH'] = paths.join(File::PATH_SEPARATOR)
190
- ENV['GEM_HOME'] = paths.first
191
- Gem.clear_paths
192
- end
193
-
194
- def self.match_fingerprint
195
- print = Digest::SHA1.hexdigest(File.read(File.expand_path('../../Gemfile', __FILE__)))
196
- unless print == FINGERPRINT
197
- abort 'Gemfile changed since you last locked. Please `bundle lock` to relock.'
198
- end
199
- end
200
-
201
- def self.setup(*groups)
202
- match_fingerprint
203
- clean_load_path
204
- cripple_rubygems(SPECS)
205
- configure_gem_path_and_home(SPECS)
206
- SPECS.each do |spec|
207
- Gem.loaded_specs[spec.name] = spec
208
- $LOAD_PATH.unshift(*spec.require_paths)
209
- end
210
- end
211
-
212
- def self.require(*groups)
213
- groups = [:default] if groups.empty?
214
- groups.each do |group|
215
- (AUTOREQUIRES[group.to_sym] || []).each do |file, explicit|
216
- if explicit
217
- Kernel.require file
218
- else
219
- begin
220
- Kernel.require file
221
- rescue LoadError
222
- end
223
- end
224
- end
225
- end
226
- end
227
-
228
- # Setup bundle when it's required.
229
- setup
230
- end