Permalink
Browse files

Release 0.0.7. Fixed bug with resolving JS libs.

  • Loading branch information...
1 parent a705b3b commit bf9f6e6e5f004a585a798f2f3e0f76792ce736ee @midas committed Mar 11, 2009
Showing with 15 additions and 18 deletions.
  1. +1 −1 README.rdoc
  2. +1 −1 guilded.gemspec
  3. +1 −1 lib/guilded.rb
  4. +12 −15 lib/guilded/guilder.rb
View
@@ -79,7 +79,7 @@ The Guilded-Base gem contains the framework to build Guilded components.
Add to environment file:
- config.gem "guilded", :version => '0.0.5'
+ config.gem "guilded", :version => '0.0.7'
Run:
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = %q{guilded}
- s.version = "0.0.6"
+ s.version = "0.0.7"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["C. Jason Harrelson (midas)"]
View
@@ -68,7 +68,7 @@
# <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %>
#
module Guilded
- VERSION = '0.0.6'
+ VERSION = '0.0.7'
end
ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -1,5 +1,6 @@
require 'digest'
require 'singleton'
+require 'guilded/exceptions'
module Guilded
@@ -25,7 +26,7 @@ class Guilder
attr_reader :initialized_at
- def initialize( options={} ) #:nodoc:
+ def initialize #:nodoc:
if defined?( GUILDED_CONFIG )
configure_guilded
else
@@ -178,7 +179,8 @@ def configure_guilded #:nodoc:
#
def init_sources #:nodoc:
@combined_css_srcs << "#{@reset_css}" unless @reset_css.nil? || @reset_css.empty?
- @combined_js_srcs << "#{@jquery_js}" << "#{@js_folder}#{@guilded_js}"
+ #@combined_js_srcs << "#{@jquery_js}" << "#{@js_folder}#{@guilded_js}"
+ resolve_js_libs( "#{@jquery_js}", "#{@js_folder}#{@guilded_js}" )
end
# Combines all JavaScript and CSS files into lists to include based on what Guilded components are on
@@ -207,7 +209,7 @@ def generate_asset_lists #:nodoc:
# a jQuery plugin, etc.
#
def combine_js_sources( component, libs=[] ) #:nodoc:
- resolve_js_libs( libs )
+ resolve_js_libs( *libs )
comp_src = add_guilded_js_path( component )
@combined_js_srcs.push( comp_src ) unless @combined_js_srcs.include?( comp_src )
@@ -219,7 +221,7 @@ def combine_js_sources( component, libs=[] ) #:nodoc:
# parts fo the name to try and get the debug version of the library. If it cannot
# find the debug version of the file, it will just remain what was initially provded.
#
- def resolve_js_libs( libs ) #:nodoc:
+ def resolve_js_libs( *libs ) #:nodoc:
if development?
# Try to use an unpacked or unminimized version
libs.each do |lib|
@@ -253,19 +255,14 @@ def add_guilded_js_path( source ) #:nodoc:
part = "#{@js_folder}#{GUILDED_NS}#{source.to_s}"
ext = 'js'
- return "#{part}.#{ext}" if development?
+ return "#{part}.#{ext}" unless production?
- #TODO: switch this to take min, pack or compressed out if in development mode for efficiency in production
-
- possibles = {
- "#{@js_path}#{part}.pack.#{ext}" => "#{part}.pack.#{ext}",
- "#{@js_path}#{part}.min.#{ext}" => "#{part}.min.#{ext}",
- "#{@js_path}#{part}.compressed.#{ext}" => "#{part}.compressed.#{ext}",
- "#{@js_path}#{part}.#{ext}" => "#{part}.#{ext}"
- }
+ possibles = [ "#{@js_path}#{part}.min.#{ext}", "#{@js_path}#{part}.pack.#{ext}", "#{@js_path}#{part}.compressed.#{ext}",
+ "#{@js_path}#{part}.#{ext}" ]
+ parts = [ "#{part}.min.#{ext}", "{part}.pack.#{ext}", "#{part}.compressed.#{ext}", "#{part}.#{ext}" ]
- possibles.each do |full_path, part_path|
- return part_path if File.exists?( full_path )
+ possibles.each_with_index do |full_path, i|
+ return parts[i] if File.exists?( full_path )
end
"" # Should never reach here

0 comments on commit bf9f6e6

Please sign in to comment.