Configuration[:require_js][:globals] wasn't named such. renamed to fix

This commit is contained in:
Parker Moore 2013-04-05 16:45:37 +02:00
parent d3606e20b6
commit 84aa44b77d
2 changed files with 18 additions and 12 deletions

View File

@ -18,18 +18,16 @@ module Guard
# Call #run_on_change for all files which match this guard. # Call #run_on_change for all files which match this guard.
def run_all def run_all
if Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq).size > 0 if Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq).size > 0
configurator = Octopress::Configuration.new Octopress.configurator.write_configs_for_generation
configurator.write_configs_for_generation
system "jekyll build #{"--drafts" unless Octopress.env == 'production'}" system "jekyll build #{"--drafts" unless Octopress.env == 'production'}"
configurator.remove_configs_for_generation Octopress.configurator.remove_configs_for_generation
end end
end end
def run_on_changes(_) def run_on_changes(_)
configurator = Octopress::Configuration.new Octopress.configurator.write_configs_for_generation
configurator.write_configs_for_generation
system "jekyll build #{"--drafts" unless Octopress.env == 'production'}" system "jekyll build #{"--drafts" unless Octopress.env == 'production'}"
configurator.remove_configs_for_generation Octopress.configurator.remove_configs_for_generation
end end
end end
end end

View File

@ -10,15 +10,23 @@ module Octopress
attr_reader :config attr_reader :config
def initialize def initialize
configurator = Octopress::Configuration.new
@configuration = configurator.read_configuration
@js_assets_path = File.expand_path("../../assets/javascripts", File.dirname(__FILE__)) @js_assets_path = File.expand_path("../../assets/javascripts", File.dirname(__FILE__))
# Read js dependencies from require_js.yml configuration unless Octopress.configuration.has_key? :require_js
@globals = @configuration[:require_js][:globals].collect {|item| Dir.glob("#{@js_assets_path}/#{item}") }.flatten.uniq abort "No :require_js key in configuration. Cannot proceed.".red
@modules = @configuration[:require_js][:modules].collect {|item| Dir.glob("#{@js_assets_path}/#{item}") }.flatten.uniq end
unless Octopress.configuration[:require_js].has_key? :dependencies
abort "No :dependencies key in :require_js configuration. Cannot proceed.".red
end
unless Octopress.configuration[:require_js].has_key? :modules
abort "No :modules key in :require_js configuration. Cannot proceed.".red
end
@template_path = File.expand_path("../../#{@configuration[:source]}", File.dirname(__FILE__)) # Read js dependencies from require_js.yml configuration
@globals = Octopress.configuration[:require_js][:dependencies].collect {|item| Dir.glob("#{@js_assets_path}/#{item}") }.flatten.uniq
@modules = Octopress.configuration[:require_js][:modules].collect {|item| Dir.glob("#{@js_assets_path}/#{item}") }.flatten.uniq
@template_path = File.expand_path("../../#{Octopress.configuration[:source]}", File.dirname(__FILE__))
@build_path = "/javascripts/build" @build_path = "/javascripts/build"
end end