Permalink
Browse files

Add support for "overwrite_current" build option

  • Loading branch information...
1 parent 873e10e commit 08f507122fdb205acfd06a3c96f4e9f7ac3bbd84 Charles Jolley committed Jul 29, 2009
Showing with 39 additions and 11 deletions.
  1. +7 −1 Buildfile
  2. +29 −8 buildtasks/manifest.rake
  3. +1 −0 lib/sproutcore/builders/html.rb
  4. +1 −1 lib/sproutcore/models/manifest.rb
  5. +1 −1 lib/sproutcore/tools/build.rb
View
@@ -72,7 +72,13 @@ mode :all do
# frameworks automatically if found.
:theme => 'sproutcore/standard_theme',
- :use_packed => true
+ :use_packed => true,
+
+ # if set to true then the index.html will build into the global language
+ # and target directory. This can interfere with deploying multiple builds
+ # at one but it is more convenient.
+ :overwrite_current => false
+
end
View
@@ -422,15 +422,36 @@ namespace :manifest do
friendly_url << resource_name
end
friendly_url = friendly_url.join('/')
+
+ is_pref_lang = (MANIFEST.language == CONFIG.preferred_language)
+ is_hidden = !TARGET.loadable? && is_index
+ overwrite_current = CONFIG.overwrite_current
+
+ # index.html entries get generated three times. Once for inside the
+ # build dir, once for the language and once for the entire target name
+ # Note that you must generate an index.html entry for all three even
+ # if you won't actually use it because other index.html entries may
+ # reference it
+ (is_index ? 3 : 1).times do |rep_cnt|
+
+ MANIFEST.add_composite resource_name,
+ :entry_type => :html,
+ :combined => true,
+ :build_task => 'build:html',
+ :source_entries => entries, # make independent
+ :hidden => is_hidden,
+ :include_required_targets => TARGET.loadable? && is_index,
+ :friendly_url => friendly_url,
+ :is_index => is_index
+
+ # if this is the index, setup next rep
+ if is_index
+ resource_name = File.join('..', resource_name)
+ is_hidden = true if !TARGET.loadable? || !overwrite_current
+ is_hidden = true if (rep_cnt>=2) && !is_pref_lang
+ end
+ end
- MANIFEST.add_composite resource_name,
- :entry_type => :html,
- :combined => true,
- :build_task => 'build:html',
- :source_entries => entries,
- :hidden => !TARGET.loadable? && is_index,
- :include_required_targets => TARGET.loadable? && is_index,
- :friendly_url => friendly_url
end
end
@@ -98,6 +98,7 @@ def expand_required_targets(target, opts = {})
# Renders the html file, returning the resulting string which can be
# written to a file.
def render
+
# render each entry...
@entries.each { |entry| render_entry(entry) }
@@ -57,7 +57,7 @@ def prepare!
end
def prepared?; @is_prepared || false; end
-
+
# Returns the options that select the current variation. The current
# implementation is hardcoded to return the language, but this may be
# generalized in the future.
@@ -62,7 +62,7 @@ def build(*targets)
is_allowed
end
end
-
+
# if there are entries to build, log and build
if entries.size > 0
info "Building entries for #{manifest.target.target_name}:#{manifest.language}..."

0 comments on commit 08f5071

Please sign in to comment.