diff --git a/Buildfile b/Buildfile
index 4df5394..84262a5 100644
--- a/Buildfile
+++ b/Buildfile
@@ -73,6 +73,9 @@ mode :all do
# frameworks automatically if found.
:theme => 'sproutcore/standard_theme',
+ # use default bootstrap framework
+ :bootstrap_inline => 'sproutcore/bootstrap:javascript',
+
:use_packed => true,
# if set to true then the index.html will build into the global language
diff --git a/lib/sproutcore/helpers/static_helper.rb b/lib/sproutcore/helpers/static_helper.rb
index cae01f0..b68f37d 100644
--- a/lib/sproutcore/helpers/static_helper.rb
+++ b/lib/sproutcore/helpers/static_helper.rb
@@ -115,6 +115,90 @@ def javascripts_for_client(target_name = nil, opts = {})
urls.join("\n")
end
+ # Detects and includes any bootstrap code
+ #
+ def bootstrap
+
+ ret = []
+
+ # Reference any external bootstrap scripts
+ if (resources_names = target.config.bootstrap)
+ Array(resources_names).each do |resource_name|
+ ret << %()
+ end
+ end
+
+ # Reference any inlined bootstrap scripts
+ if (resources_names = target.config.bootstrap_inline)
+ Array(resources_names).each do |resource_name|
+ ret << inline_javascript(resource_name)
+ end
+ end
+
+ # Reference any @content_for_bootstrap
+ if @content_for_bootstrap
+ ret << %()
+ end
+
+ return ret * "\n"
+ end
+
+ # Attempts to include the named javascript entry inline to the file
+ #
+ # === Options
+ # language:: the language to use. defaults to current
+ #
+ def inline_javascript(resource_name, opts ={})
+
+ resource_name = resource_name.to_s
+
+ # determine which manifest to search. if a language is explicitly
+ # specified, lookup manifest for that language. otherwise use
+ # current manifest.
+ m = self.manifest
+ if opts[:language]
+ m = target.manifest_for(:language => opts[:language]).build!
+ end
+
+ entry = m.find_entry(resource_name, :entry_type => :javascript)
+ if entry.nil?
+ entry = m.find_entry(resource_name, :hidden => true, :entry_type => :javascript)
+ end
+
+ return '' if entry.nil?
+
+ ret = File.readlines(entry.build!.build_path)*''
+ return %()
+ end
+
+ # Attempts to include the named javascript entry inline to the file
+ #
+ # === Options
+ # language:: the language to use. defaults to current
+ #
+ def inline_stylesheet(resource_name, opts ={})
+
+ resource_name = resource_name.to_s
+
+ # determine which manifest to search. if a language is explicitly
+ # specified, lookup manifest for that language. otherwise use
+ # current manifest.
+ m = self.manifest
+ if opts[:language]
+ m = target.manifest_for(:language => opts[:language]).build!
+ end
+
+ entry = m.find_entry(resource_name, :entry_type => :stylesheet)
+ if entry.nil?
+ entry = m.find_entry(resource_name, :hidden => true, :entry_type => :stylesheet)
+ end
+
+ return '' if entry.nil?
+
+ ret = File.readlines(entry.build!.build_path)
+ return %()
+ end
+
# Attempts to render the named entry as a partial
#
# === Options
diff --git a/lib/sproutcore/models/manifest.rb b/lib/sproutcore/models/manifest.rb
index e7790b4..8440fcc 100644
--- a/lib/sproutcore/models/manifest.rb
+++ b/lib/sproutcore/models/manifest.rb
@@ -350,7 +350,7 @@ def find_entry(fragment, opts = {}, seen=nil)
def unique_staging_path(path)
paths = entries(:hidden => true).map { |e| e.staging_path }
while paths.include?(path)
- path = path.sub(/(__\$[0-9]+)?(\.\w+)?$/,"__$#{next_staging_uuid}\\2")
+ path = path.sub(/(__\$[0-9]+)?(\.\w+)?$/,"__#{next_staging_uuid}\\2")
end
return path
end
@@ -360,7 +360,7 @@ def unique_staging_path(path)
def unique_cache_path(path)
paths = entries(:hidden => true).map { |e| e.cache_path }
while paths.include?(path)
- path = path.sub(/(__\$[0-9]+)?(\.\w+)?$/,"__$#{next_staging_uuid}\\2")
+ path = path.sub(/(__\$[0-9]+)?(\.\w+)?$/,"__#{next_staging_uuid}\\2")
end
return path
end