bonsai 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.bundle/environment.rb +230 -0
- data/CHANGES +7 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +95 -0
- data/Rakefile +5 -4
- data/VERSION +1 -1
- data/bonsai.gemspec +14 -11
- data/lib/bonsai/page.rb +15 -13
- data/spec/bonsai/exporter_spec.rb +1 -1
- data/spec/bonsai/page_spec.rb +18 -4
- data/spec/support/content/1.about-us/history/{image001.jpg → 001.jpg} +0 -0
- data/spec/support/content/1.about-us/history/{a_file_asset.txt → 1_a_file_asset.txt} +0 -0
- metadata +13 -11
data/.bundle/config
ADDED
@@ -0,0 +1,230 @@
|
|
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
|
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
= 1.3.0 (29/03/2010)
|
2
|
+
|
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
|
+
|
1
8
|
= 1.2.0 (13/03/2010)
|
2
9
|
|
3
10
|
* Updates to default templates
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,95 @@
|
|
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
|
data/Rakefile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
begin
|
3
|
-
require File.dirname(__FILE__) + '/
|
3
|
+
require File.dirname(__FILE__) + '/.bundle/environment'
|
4
4
|
rescue LoadError
|
5
5
|
raise <<-HELP
|
6
6
|
Bonsai uses the gem bundler to handle its development dependencies under
|
7
7
|
multiple environments. So if you're testing under 1.8, 1.9, jruby or otherwise
|
8
8
|
you should ensure that you have the `bundler` gem installed.
|
9
9
|
|
10
|
-
Then run `
|
10
|
+
Then run `bundle install --relock`. Following going through these steps you should
|
11
11
|
not see this error message. If you do, please contact me or raise an issue.
|
12
12
|
(http://github.com/benschwarz/bonsai/issues)
|
13
13
|
HELP
|
@@ -27,11 +27,12 @@ begin
|
|
27
27
|
gem.executables = ['bonsai']
|
28
28
|
gem.has_rdoc = false
|
29
29
|
gem.files.exclude 'vendor/gems'
|
30
|
+
gem.files.exclude 'vendor/cache'
|
30
31
|
|
31
32
|
gem.add_development_dependency "rspec", ">= 1.3.0"
|
32
33
|
gem.add_development_dependency "yard", ">= 0"
|
33
|
-
gem.add_dependency "tilt", ">= 0.
|
34
|
-
gem.add_dependency "mustache", "
|
34
|
+
gem.add_dependency "tilt", ">= 0.8"
|
35
|
+
gem.add_dependency "mustache", "= 0.6"
|
35
36
|
gem.add_dependency "builder", ">= 2.1.2"
|
36
37
|
gem.add_dependency "watch", ">= 0.1.0"
|
37
38
|
gem.add_dependency "sinatra", ">= 0.9.4"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
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.
|
8
|
+
s.version = "1.3.0"
|
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-
|
12
|
+
s.date = %q{2010-03-29}
|
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}
|
@@ -19,11 +19,14 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
|
-
".
|
22
|
+
".bundle/config",
|
23
|
+
".bundle/environment.rb",
|
24
|
+
".document",
|
23
25
|
".gitignore",
|
24
26
|
".kick",
|
25
27
|
"CHANGES",
|
26
28
|
"Gemfile",
|
29
|
+
"Gemfile.lock",
|
27
30
|
"LICENSE",
|
28
31
|
"README.md",
|
29
32
|
"Rakefile",
|
@@ -87,11 +90,11 @@ Gem::Specification.new do |s|
|
|
87
90
|
"spec/support/content/1.about-us/1.contact/magic/image001.jpg",
|
88
91
|
"spec/support/content/1.about-us/1.contact/magic/image002.jpg",
|
89
92
|
"spec/support/content/1.about-us/demo-template.yml",
|
90
|
-
"spec/support/content/1.about-us/history/
|
93
|
+
"spec/support/content/1.about-us/history/001.jpg",
|
94
|
+
"spec/support/content/1.about-us/history/1_a_file_asset.txt",
|
91
95
|
"spec/support/content/1.about-us/history/child/a_file_asset.txt",
|
92
96
|
"spec/support/content/1.about-us/history/child/demo-template.yml",
|
93
97
|
"spec/support/content/1.about-us/history/demo-template.yml",
|
94
|
-
"spec/support/content/1.about-us/history/image001.jpg",
|
95
98
|
"spec/support/content/1.about-us/history/images/image001.jpg",
|
96
99
|
"spec/support/content/1.about-us/history/magic/image001.jpg",
|
97
100
|
"spec/support/content/1.about-us/history/magic/image002.jpg",
|
@@ -148,8 +151,8 @@ Gem::Specification.new do |s|
|
|
148
151
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
149
152
|
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
150
153
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
151
|
-
s.add_runtime_dependency(%q<tilt>, [">= 0.
|
152
|
-
s.add_runtime_dependency(%q<mustache>, ["
|
154
|
+
s.add_runtime_dependency(%q<tilt>, [">= 0.8"])
|
155
|
+
s.add_runtime_dependency(%q<mustache>, ["= 0.6"])
|
153
156
|
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
|
154
157
|
s.add_runtime_dependency(%q<watch>, [">= 0.1.0"])
|
155
158
|
s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
|
@@ -160,8 +163,8 @@ Gem::Specification.new do |s|
|
|
160
163
|
else
|
161
164
|
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
162
165
|
s.add_dependency(%q<yard>, [">= 0"])
|
163
|
-
s.add_dependency(%q<tilt>, [">= 0.
|
164
|
-
s.add_dependency(%q<mustache>, ["
|
166
|
+
s.add_dependency(%q<tilt>, [">= 0.8"])
|
167
|
+
s.add_dependency(%q<mustache>, ["= 0.6"])
|
165
168
|
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
166
169
|
s.add_dependency(%q<watch>, [">= 0.1.0"])
|
167
170
|
s.add_dependency(%q<sinatra>, [">= 0.9.4"])
|
@@ -173,8 +176,8 @@ Gem::Specification.new do |s|
|
|
173
176
|
else
|
174
177
|
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
175
178
|
s.add_dependency(%q<yard>, [">= 0"])
|
176
|
-
s.add_dependency(%q<tilt>, [">= 0.
|
177
|
-
s.add_dependency(%q<mustache>, ["
|
179
|
+
s.add_dependency(%q<tilt>, [">= 0.8"])
|
180
|
+
s.add_dependency(%q<mustache>, ["= 0.6"])
|
178
181
|
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
179
182
|
s.add_dependency(%q<watch>, [">= 0.1.0"])
|
180
183
|
s.add_dependency(%q<sinatra>, [">= 0.9.4"])
|
data/lib/bonsai/page.rb
CHANGED
@@ -68,15 +68,13 @@ module Bonsai
|
|
68
68
|
|
69
69
|
# This method is used for the exporter to copy assets
|
70
70
|
def assets
|
71
|
-
Dir["#{directory}/**/*"].select{|
|
72
|
-
|
73
|
-
:name => File.basename(a),
|
74
|
-
:path => web_path(a),
|
75
|
-
:disk_path => a
|
76
|
-
}
|
71
|
+
Dir["#{directory}/**/*"].select{|path| !File.directory?(path) && !File.basename(path).include?("yml") }.map do |file|
|
72
|
+
file_to_hash(file)
|
77
73
|
end
|
78
74
|
end
|
79
75
|
|
76
|
+
# "Floating pages" are pages that are not prefixed with a numeric eg: 1.about-us
|
77
|
+
# These pages are not present in the `children` or other meta-content arrays
|
80
78
|
def floating?
|
81
79
|
!!(File.dirname(disk_path) =~ /\/[a-zA-z][\w-]+$/)
|
82
80
|
end
|
@@ -167,8 +165,8 @@ module Bonsai
|
|
167
165
|
end
|
168
166
|
end
|
169
167
|
|
170
|
-
# Creates methods for each sub-folder within the page's folder
|
171
|
-
# that isn't a
|
168
|
+
# Creates "methods" for each sub-folder within the page's folder
|
169
|
+
# that isn't itself, a child-page (a page object)
|
172
170
|
def disk_assets
|
173
171
|
assets = {}
|
174
172
|
Dir["#{File.dirname(disk_path)}/**"].select{|p| File.directory?(p)}.reject {|p|
|
@@ -183,11 +181,7 @@ module Bonsai
|
|
183
181
|
|
184
182
|
{
|
185
183
|
name.to_sym => Dir["#{path}/*"].map do |file|
|
186
|
-
|
187
|
-
:name => File.basename(file),
|
188
|
-
:path => web_path(file),
|
189
|
-
:disk_path => file
|
190
|
-
}
|
184
|
+
file_to_hash(file)
|
191
185
|
end
|
192
186
|
}
|
193
187
|
end
|
@@ -203,5 +197,13 @@ module Bonsai
|
|
203
197
|
def web_path(path)
|
204
198
|
path.gsub(self.class.path, '').gsub(/\/\d+\./, '/')
|
205
199
|
end
|
200
|
+
|
201
|
+
def file_to_hash(file)
|
202
|
+
{
|
203
|
+
:name => File.basename(file),
|
204
|
+
:path => "#{web_path(File.dirname(file))}/#{File.basename(file)}",
|
205
|
+
:disk_path => File.expand_path(file)
|
206
|
+
}
|
207
|
+
end
|
206
208
|
end
|
207
209
|
end
|
@@ -104,7 +104,7 @@ describe Bonsai::Exporter do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'should copy the assets of each page to its directory' do
|
107
|
-
File.exists?("#{Bonsai::Exporter.path}/about-us/history/
|
107
|
+
File.exists?("#{Bonsai::Exporter.path}/about-us/history/1_a_file_asset.txt").should be_true
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should copy the contents of the public directory to the root export path" do
|
data/spec/bonsai/page_spec.rb
CHANGED
@@ -48,10 +48,24 @@ describe Bonsai::Page do
|
|
48
48
|
it "should respond to disk path" do
|
49
49
|
@page.disk_path.should == "#{Bonsai.root_dir}/content/1.about-us/history/demo-template.yml"
|
50
50
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
|
52
|
+
describe "assets" do
|
53
|
+
it "should have assets" do
|
54
|
+
@page.assets.should be_an_instance_of(Array)
|
55
|
+
@page.assets.length.should == 6
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should have the correct name" do
|
59
|
+
@page.assets.first[:name].should == "001.jpg"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have the correct path" do
|
63
|
+
@page.assets.first[:path].should == "/about-us/history/001.jpg"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should have the correct disk_path" do
|
67
|
+
@page.assets.first[:disk_path].should == "/Users/ben/Documents/Projects/bonsai/spec/support/content/1.about-us/history/001.jpg"
|
68
|
+
end
|
55
69
|
end
|
56
70
|
|
57
71
|
it "should be equal" do
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 3
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ben Schwarz
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-29 00:00:00 +11:00
|
18
18
|
default_executable: bonsai
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -52,8 +52,8 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
segments:
|
54
54
|
- 0
|
55
|
-
-
|
56
|
-
version: "0.
|
55
|
+
- 8
|
56
|
+
version: "0.8"
|
57
57
|
type: :runtime
|
58
58
|
version_requirements: *id003
|
59
59
|
- !ruby/object:Gem::Dependency
|
@@ -61,13 +61,12 @@ dependencies:
|
|
61
61
|
prerelease: false
|
62
62
|
requirement: &id004 !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - "="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
segments:
|
67
67
|
- 0
|
68
|
-
-
|
69
|
-
|
70
|
-
version: 0.5.0
|
68
|
+
- 6
|
69
|
+
version: "0.6"
|
71
70
|
type: :runtime
|
72
71
|
version_requirements: *id004
|
73
72
|
- !ruby/object:Gem::Dependency
|
@@ -178,11 +177,14 @@ extra_rdoc_files:
|
|
178
177
|
- LICENSE
|
179
178
|
- README.md
|
180
179
|
files:
|
180
|
+
- .bundle/config
|
181
|
+
- .bundle/environment.rb
|
181
182
|
- .document
|
182
183
|
- .gitignore
|
183
184
|
- .kick
|
184
185
|
- CHANGES
|
185
186
|
- Gemfile
|
187
|
+
- Gemfile.lock
|
186
188
|
- LICENSE
|
187
189
|
- README.md
|
188
190
|
- Rakefile
|
@@ -246,11 +248,11 @@ files:
|
|
246
248
|
- spec/support/content/1.about-us/1.contact/magic/image001.jpg
|
247
249
|
- spec/support/content/1.about-us/1.contact/magic/image002.jpg
|
248
250
|
- spec/support/content/1.about-us/demo-template.yml
|
249
|
-
- spec/support/content/1.about-us/history/
|
251
|
+
- spec/support/content/1.about-us/history/001.jpg
|
252
|
+
- spec/support/content/1.about-us/history/1_a_file_asset.txt
|
250
253
|
- spec/support/content/1.about-us/history/child/a_file_asset.txt
|
251
254
|
- spec/support/content/1.about-us/history/child/demo-template.yml
|
252
255
|
- spec/support/content/1.about-us/history/demo-template.yml
|
253
|
-
- spec/support/content/1.about-us/history/image001.jpg
|
254
256
|
- spec/support/content/1.about-us/history/images/image001.jpg
|
255
257
|
- spec/support/content/1.about-us/history/magic/image001.jpg
|
256
258
|
- spec/support/content/1.about-us/history/magic/image002.jpg
|