From 2d2874bf8a61bd79e82abe582c659f3644de5ff0 Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Wed, 4 Aug 2010 14:35:56 -0500 Subject: [PATCH 1/8] Provide option to include script tags in the g_apply_behavior method. --- lib/guilded/guilder.rb | 175 ++++++++++++++++-------------- lib/guilded/rails/view_helpers.rb | 42 +++---- 2 files changed, 115 insertions(+), 102 deletions(-) diff --git a/lib/guilded/guilder.rb b/lib/guilded/guilder.rb index 5c88da4..2fedfe7 100644 --- a/lib/guilded/guilder.rb +++ b/lib/guilded/guilder.rb @@ -3,30 +3,30 @@ require 'guilded/exceptions' module Guilded - + # Guilder is the worker for the entire Guilded framework. It collects all of the necessary components for a page # through its add() method. When the g_apply_behavior() method is called at the end of a page, the Guilder writes # HTML to include all of the necessary asset files (caching them in production). It also writes a JavaScript initialization - # function and fires the initialization function on page load and a before and after initialization callback allowing for + # function and fires the initialization function on page load and a before and after initialization callback allowing for # custom initializtion to occur. # - # This initialization function calls the initialization function for each Guilded component that was added to the current - # page. For example, if a Guilded component named 'g_load_alerter' was added to a page, the Guilder would include this line + # This initialization function calls the initialization function for each Guilded component that was added to the current + # page. For example, if a Guilded component named 'g_load_alerter' was added to a page, the Guilder would include this line # in the initialization function it writes: g.initLoadAlerter( /* passing options hash here */ ); The g before the function - # is a JavaScript namespace that Guilded automatically creates to facilitate avoiding name collisions with other JavaScript + # is a JavaScript namespace that Guilded automatically creates to facilitate avoiding name collisions with other JavaScript # libraries and code. # - # Th options hash that is passed to the init functions for each Guilded component is simply the options hash from the + # Th options hash that is passed to the init functions for each Guilded component is simply the options hash from the # component's view helper. The Guilder calls .to_json() on the options hash. Thus, if there are pairs in the options hash - # that need not go to the JavaScript init method they should be removed within the view helper. + # that need not go to the JavaScript init method they should be removed within the view helper. # class Guilder include Singleton - + GUILDED_NS = "guilded." - + attr_reader :initialized_at, :jquery_js, :mootools_js - + def initialize #:nodoc: if defined?( GUILDED_CONFIG ) @config = GUILDED_CONFIG @@ -45,7 +45,7 @@ def initialize #:nodoc: # unless the user specified no reset to be included. init_sources end - + # Adds an element with its options to the @g_elements hash to be used later. # def add( element, options={}, libs=[], styles=[] ) @@ -54,18 +54,18 @@ def add( element, options={}, libs=[], styles=[] ) @need_mootools = true if options[:mootools] @g_elements[ options[:id].to_sym ] = Guilded::ComponentDef.new( element, options, libs, styles ) end - - # Adds a data structure to be passed to the Guilded JavaScript environment for use on the client + + # Adds a data structure to be passed to the Guilded JavaScript environment for use on the client # side. The data is passed using the ruby to_json method on the data structure provided. # # === Parameters # * +name+ - The desired name of the variable on the client side. - # * +data+ - The data to pass to the Guilded JavaScript environment. + # * +data+ - The data to pass to the Guilded JavaScript environment. # def add_data( name, data ) @g_data_elements.merge!( name.to_sym => data ) end - + # Adds JavaScript sources to the libs collection by resolving them to the normal or min version # based on the current running environment, development, production, etc. # @@ -76,41 +76,41 @@ def add_js_sources( *sources ) def add_css_source( src, position=:post ) @css_temp_hold[position.to_sym] << src unless @css_temp_hold[position.to_sym].include?( src ) end - + def count #:nodoc: @g_elements.size end - + # The number of Guilded components to be renderred. # def component_count count end - - # The current number of CSS assets necessary for the Guilded component set. + + # The current number of CSS assets necessary for the Guilded component set. # def style_count @combined_css_srcs.size end - - # The current number of JavaScript assets necessary for the Guilded component set. + + # The current number of JavaScript assets necessary for the Guilded component set. # def script_count @combined_js_srcs.size end - + # Returns true if the component type is included, otherwise false. # def include_component?( type ) @g_elements.has_key?( type.to_sym ) end - + # The collection of JavaScript assets for the current Guilded component set. # def combined_js_srcs @combined_js_srcs end - + # The collection of CSS assets for the current Guilded component set. # def combined_css_srcs @@ -120,7 +120,7 @@ def combined_css_srcs @css_temp_hold[:post].each { |src| @combined_css_srcs << src } @combined_css_srcs end - + # Clears out all but the reset CSS and the base JavaScripts # def reset! @@ -137,12 +137,12 @@ def reset! def inject_css( *sources ) @combined_css_srcs.insert( @default_css_count, *sources ) end - + def inject_js( *sources ) @combined_js_srcs.insert( @default_js_count, *sources ) end - - # Generates the markup required to include all the assets necessary for the Guilded compoents in + + # Generates the markup required to include all the assets necessary for the Guilded compoents in # @g_elements collection. Use this if you are not interested in caching asset files. # def apply #:nodoc: @@ -153,45 +153,58 @@ def apply #:nodoc: to_init << generate_javascript_init reset! end - - # Writes an initialization method that calls each Guilded components initialization method. This + + # Writes an initialization method that calls each Guilded components initialization method. This # method will exceute on document load finish. # - def generate_javascript_init #:nodoc: - code = "var initGuildedElements = function(){" + def generate_javascript_init( options={} ) #:nodoc: + options[:include_script_tags] = true if options[:include_script_tags].nil? + code = "" + + if options[:include_script_tags] + code << "" + end + + code end - + # Generates a name to use when caching the current set of Guilded component JavaScript assets. Sorts and concatenates - # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique + # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique # and shorter string. # def js_cache_name generate_js_cache_name( @combined_js_srcs ) end - + # Generates a name to use when caching the current set of Guilded component CSS assets. Sorts and concatenates - # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique + # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique # and shorter string. # def css_cache_name name = generate_css_cache_name( @combined_css_srcs ) name end - - def generate_js_cache_name( sources ) #:nodoc: + + def generate_js_cache_name( sources ) #:nodoc: sorted_srcs = sources.sort stripped_srcs = sorted_srcs.map { |src| src.gsub( /.js/, '' ).gsub( /\//, '_') } joined = stripped_srcs.join( "+" ) "#{Digest::MD5.hexdigest( joined )}" end - + def generate_css_cache_name( sources ) #:nodoc: sorted_srcs = sources.sort stripped_srcs = sorted_srcs.map { |src| src.gsub( /.css/, '' ).gsub( /\//, '_') } @@ -206,48 +219,48 @@ def generate_asset_lists #:nodoc: @g_elements.each_value do |defi| #TODO get stylesheet (skin) stuff using rails caching combine_css_sources( defi.kind, defi.options[:skin], defi.styles ) unless defi.exclude_css? - + # Combine all JavaScript sources so that the caching option can be used on # the javascript_incldue_tag helper. combine_js_sources( defi.kind, defi.libs ) unless defi.exclude_js? end end - + def jquery_js @config[:jquery_js] end - + def jquery_remote_url @config[:jquery_remote_url] end - + def use_remote_jquery @config[:use_remote_jquery] end - + def app_root @config[:app_root] end - + def environment @config[:environment] end - - def development? #:nodoc: + + def development? #:nodoc: environment.to_sym == :development end - - def production? #:nodoc: + + def production? #:nodoc: environment.to_sym == :production end - - def test? #:nodoc: + + def test? #:nodoc: environment.to_sym == :test end - + protected - - def configure_guilded #:nodoc: + + def configure_guilded #:nodoc: @js_path = @config[:js_path] @js_folder = @config[:js_folder] @jquery_js = @config[:jquery_js] @@ -274,17 +287,17 @@ def configure_guilded #:nodoc: @css_folder.freeze @reset_css.freeze @env.freeze - end - + end + # Adds the Guilded reset CSS file and the guilded.js and jQuery files to the respective sources # collections. # - def init_sources #:nodoc: + def init_sources #:nodoc: @css_temp_hold[:reset] << "#{@reset_css}" unless @reset_css.nil? || @reset_css.empty? resolve_js_libs( "#{@jquery_js}", "#{@jquery_folder}#{@url_js}", "#{@js_folder}#{@guilded_js}" ) #TODO include the jQuery lib from Google server in production end - + # Helper method that takes the libs and component specific js files and puts them # into one array so that the javascript_include_tag can correctly cache them. Automatically # ignores files that have already been inlcuded. @@ -292,24 +305,24 @@ def init_sources #:nodoc: # *parameters* # combined_src (required) An array of the combined sorces for the page being renderred. # component (required) The name of a guilded component. - # libs An array of JavaScript libraries that this component depends on. More than likely + # libs An array of JavaScript libraries that this component depends on. More than likely # a jQuery plugin, etc. # def combine_js_sources( component, libs=[] ) #:nodoc: libs << @mootools_js if @need_mootools resolve_js_libs( *libs ) - + comp_src = add_guilded_js_path( component ) @combined_js_srcs.push( comp_src ) unless @combined_js_srcs.include?( comp_src ) end - + # Helper method that adds the aditional JavaScript library icludes to the include set. - # + # # If running development mode, it will try to remove any .pack, .min, or.compressed - # parts fo the name to try and get the debug version of the library. If it cannot + # 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| @@ -325,41 +338,41 @@ def resolve_js_libs( *libs ) #:nodoc: libs.each { |lib| @combined_js_srcs.push( lib ) unless @combined_js_srcs.include?( lib ) } end end - + # Helper method that takes an array of js sources and adds the correct guilded # path to them. Returns an array with the new path resolved sources. # - def map_guilded_js_paths( *sources ) #:nodoc: + def map_guilded_js_paths( *sources ) #:nodoc: sources.map { |source| add_guilded_js_path( source ) } end - + # Adds the guilded JS path to the the source name passed in. When not in development mode, - # it looks for a .pack.js, .min.jsm .compressed.js and chooses one of these over the + # it looks for a .pack.js, .min.jsm .compressed.js and chooses one of these over the # development version. # - def add_guilded_js_path( source ) #:nodoc: + def add_guilded_js_path( source ) #:nodoc: part = "#{@js_folder}#{GUILDED_NS}#{source.to_s}" ext = 'js' - + return "#{part}.#{ext}" unless production? - + 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_with_index do |full_path, i| - return parts[i] if File.exists?( full_path ) + return parts[i] if File.exists?( full_path ) end - + "" # Should never reach here end - - def combine_css_sources( component, skin, styles=[] ) #:nodoc: + + def combine_css_sources( component, skin, styles=[] ) #:nodoc: # Get all of this components defined external styles styles.each do |style| @css_temp_hold[:components].push( style ) unless @css_temp_hold[:components].include?( style ) end - + #Get the default or guilded skin styles for this component comp_src = add_guilded_css_path( component, skin ) @css_temp_hold[:components].push( comp_src ) unless @css_temp_hold[:components].include?( comp_src ) || comp_src.empty? @@ -368,8 +381,8 @@ def combine_css_sources( component, skin, styles=[] ) #:nodoc: skin_user_src = add_guilded_css_path( component, "#{skin || 'default'}_user" ) @css_temp_hold[:components].push( skin_user_src ) unless @css_temp_hold[:components].include?( skin_user_src ) || skin_user_src.empty? end - - def add_guilded_css_path( source, skin ) #:nodoc: + + def add_guilded_css_path( source, skin ) #:nodoc: skin = 'default' if skin.nil? || skin.empty? part = "#{@css_folder}#{source.to_s}/#{skin}.css" path = "#{@css_path}#{part}" diff --git a/lib/guilded/rails/view_helpers.rb b/lib/guilded/rails/view_helpers.rb index 7cff075..3495996 100644 --- a/lib/guilded/rails/view_helpers.rb +++ b/lib/guilded/rails/view_helpers.rb @@ -5,18 +5,18 @@ module ViewHelpers # Generates the initGuildedElements function and includes a call to each GUIlded # element(s) Init method. # - # Must be called once per rendered page. You can include it just before the closing body - # tag of your application layout. If no Guilded elements were called in the template, the + # Must be called once per rendered page. You can include it just before the closing body + # tag of your application layout. If no Guilded elements were called in the template, the # call to g_apply_behavior will not output anything. # - def g_apply_behavior - Guilded::Guilder.instance.generate_javascript_init + def g_apply_behavior( options={} ) + Guilded::Guilder.instance.generate_javascript_init( options ) end - + # Generates the JavaScript include(s) for each Guilded element that is used. # - # Must be called once per rendered page. You can include it just before the closing body - # tag of your application layout. If no Guilded elements were called in the template, the + # Must be called once per rendered page. You can include it just before the closing body + # tag of your application layout. If no Guilded elements were called in the template, the # call to g_apply_includes will not output anything. # def g_apply_includes @@ -33,12 +33,12 @@ def g_apply_includes end output end - + def g_apply_style "" end - - # Injects the CSS into the header. Must be called once per rendered page and within a scope that allows access + + # Injects the CSS into the header. Must be called once per rendered page and within a scope that allows access # to the output buffer of the tempalte system being used. # def g_inject_styles @@ -47,12 +47,12 @@ def g_inject_styles end # Creates a javascript include tag for a Guilded specific file. The only difference - # being that it adds the file to a sources array to be concatenated and included at the + # being that it adds the file to a sources array to be concatenated and included at the # end of the page with the dependencies specified for the Guilded components used. # # To explicitly include the jQuery or MooTools libraries you can use :jquery and/or :mootools # respectively. If a component that uses either jQuery or MooTools is used on a page, there is - # no need to explicitly include the library, as it will be resolved as a dependency and only + # no need to explicitly include the library, as it will be resolved as a dependency and only # included once. # def g_javascript_include_tag( *sources ) @@ -82,19 +82,19 @@ def g_javascript_include_tag( *sources ) '' end - # Replaces the Rails stylesheet_link_tag helper if you wnat Guilded to manage CSS for you. + # Replaces the Rails stylesheet_link_tag helper if you wnat Guilded to manage CSS for you. # Although the syntax is exactly the same, the method works a little differently. - # - # This helper adds the stylesheet(s) to a collection to be renderred out together - # with all the guilded componenets stylesheets. This allows the stylesheets passed + # + # This helper adds the stylesheet(s) to a collection to be renderred out together + # with all the guilded componenets stylesheets. This allows the stylesheets passed # to this method to be cached with the guilded stylesheests into a single reusable file. - # + # # The helper will ensure that these stylesheets are included after Guilded's reset - # stylesheet and before guilded's component's stylesheets so that they can override any + # stylesheet and before guilded's component's stylesheets so that they can override any # resets, etc and not override any guilded components styles. - + # *options* - # :position The place to position the css. pre for before the component's css or post for after. + # :position The place to position the css. pre for before the component's css or post for after. # Defaults to post. # def g_stylesheet_link_tag( *sources ) @@ -112,7 +112,7 @@ def g_skin_tag( source, skin='default' ) "" end end - + end end end \ No newline at end of file From cb1787ec08cdc9498530254fa19efb5117cab9e2 Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Wed, 4 Aug 2010 14:37:23 -0500 Subject: [PATCH 2/8] Release v1.0.13. --- History.txt | 11 ++++++++--- VERSION | 2 +- guilded.gemspec | 4 ++-- lib/guilded.rb | 36 ++++++++++++++++++------------------ 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/History.txt b/History.txt index 6a407ea..77ce5d8 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,8 @@ += 1.0.13 2010-08-04 + +* Provide option to include script tags in the g_apply_behavior method. + + = 1.0.12 2010-05-11 * Fixed a new compatibility issue with Rails 3 templating. @@ -77,7 +82,7 @@ = 0.2.8 2009-06-12 -* Removed some code from the InactiveRecord:Base extension for human attrbiute hint that returns unless +* Removed some code from the InactiveRecord:Base extension for human attrbiute hint that returns unless table_exists? as this does not make any sense for InactiveRecord. @@ -98,9 +103,9 @@ = 0.2.4 2009-05-29 -* Added add_data method to the Guilder object allowing named data structures to be passed to the JavaScript +* Added add_data method to the Guilder object allowing named data structures to be passed to the JavaScript executing environment. -* Added a jQuery event to the body DOM element called guildedInitialized. To execute JavaScript code after all +* Added a jQuery event to the body DOM element called guildedInitialized. To execute JavaScript code after all Guilded components are intialized, simply bind to this event. diff --git a/VERSION b/VERSION index bb83058..2ac9634 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.12 +1.0.13 diff --git a/guilded.gemspec b/guilded.gemspec index 599c18a..70ae208 100644 --- a/guilded.gemspec +++ b/guilded.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{guilded} - s.version = "1.0.12" + s.version = "1.0.13" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["C. Jason Harrelson (midas)"] - s.date = %q{2010-05-11} + s.date = %q{2010-08-04} s.description = %q{Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible (in most cases). Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do as it was intended.} s.email = %q{jason@lookforwardenterprises.com} s.extra_rdoc_files = [ diff --git a/lib/guilded.rb b/lib/guilded.rb index 219f8f8..3ccbb52 100644 --- a/lib/guilded.rb +++ b/lib/guilded.rb @@ -10,35 +10,35 @@ require 'guilded/rails/active_record/human_attribute_hint' require 'guilded/rails/inactive_record/human_attribute_hint' -# Guilded is a framework for creating reusable UI components for web applications. Guilded provides the facilities to +# Guilded is a framework for creating reusable UI components for web applications. Guilded provides the facilities to # easily add components and all of their required assets to a page. -# +# # A Guilded component is a set of XHTML, CSS and JavaScript that combine to create a rich UI. The Guilded component should be # authored using progressive enhancement to enable users without CSS or JavaScript enabled to utilize the essential functionality # of the component. The easiest way to accomplish this requirement is to write your behavior code as a jQuery plugin. Doing -# so will naturally guide your behavior code to be applied through progrssive enhancement and also allow your behavior code +# so will naturally guide your behavior code to be applied through progrssive enhancement and also allow your behavior code # to be used without Guilded. # # To create a Guilded component at least four things must occur: writing a view helper, writing a JavaScript initialization -# function, writing a default stylesheet and writing either a rake task or generator to place these assets into a project's -# public directory. It is also probable that a jQuery plugin with the behavior code will need to be authored. If this is the -# case, then the JavaScript initialization function will most likely just call the jQuery plugin on the DOM element(s) that should +# function, writing a default stylesheet and writing either a rake task or generator to place these assets into a project's +# public directory. It is also probable that a jQuery plugin with the behavior code will need to be authored. If this is the +# case, then the JavaScript initialization function will most likely just call the jQuery plugin on the DOM element(s) that should # have the behavior applied. # # The view helper should output the HTML necessary for the component. It must also add the component to a collection so that # Guilded can collect its assets and add them to the page. This is accomplished through a call to the Guilder.add() method. # The Guilder is a singleton, so you must access it like: Guilded::Guilder.instance.add( ... ). The Guilder.add() method adds -# element to a collection with it's options. Guilded automatically looks for CSS assets that obey the naming convention -# {component_name}/default.css. Guilded also automatically looks for a JavaScript asset named: guilded.{component_name}.js. -# This asset should at least include the initComponentName( options ). The Guilded.add() method can also add additional CSS and -# JavaScript assets necessary for a component. An example of an additional JavaScript asset is the jQuery plugin authored to +# element to a collection with it's options. Guilded automatically looks for CSS assets that obey the naming convention +# {component_name}/default.css. Guilded also automatically looks for a JavaScript asset named: guilded.{component_name}.js. +# This asset should at least include the initComponentName( options ). The Guilded.add() method can also add additional CSS and +# JavaScript assets necessary for a component. An example of an additional JavaScript asset is the jQuery plugin authored to # contain the behavior of a component. The view helper must be called with an :id option as it is used to differentiate different -# instances of the same component on a single page from each other. It will also be used as the DOM element's id. A Guilded view +# instances of the same component on a single page from each other. It will also be used as the DOM element's id. A Guilded view # helper should have a g_ appended to the beginning of it to help differentiate from normal view helepr sin a project. -# +# # The JavaScript initialization function should be named init{ComponentName}( options ). The options hash from the view helper # will automatically be passed to this function. The function should handle a before and after init callback to enable the user -# to set up anything necessary for the component and perform additional tasks. This function must also perform any other code +# to set up anything necessary for the component and perform additional tasks. This function must also perform any other code # necessary to set up the behavior for a compnent. An example fo this would be adding behavior to events or simply calling # a jQuery plugin on element(s) of the component. Remember that any JavaScript relating to Guilded should be placed in the 'g' # namespace that Guilded creates on every page. An example init function for a g_load_alerter would be: @@ -56,23 +56,23 @@ # # For a user to implement these callback functions, they should create a JavaScript file with the functions and call it on # any page they need it on utilizing Guilded's JavaScript include helper g_javascript_include_tag. This helper will add the -# JavaScript files after the jQuery and Guilded framework files, but within the component files in the order they were added. +# JavaScript files after the jQuery and Guilded framework files, but within the component files in the order they were added. # This will make the 'g' namespace available for use. Obviously this file must be included prior to calling the component's helper, -# or the callback functions will not be defined for use. +# or the callback functions will not be defined for use. # # The default stylesheet for a Guilded component should be the minimum amount of CSS for the component to function. When no :skin # option is passed to the view helper when a component is added, Guilded will look for the default stylesheet. The assets # used within the stylesheet (images) should be placed in a folder named default that is in the same directory as the default.css # file. All asssets used in the stylesheet should use an absolute reference from the public directory: /stylesheets/guilded/{component_name}/default/{asset_name}. # -# In order to create another skin for a component, simply create a {skin_name}.css file and a {skin_name} directory with the style -# assets in it. Be sure to reference the style assets with absolute paths from teh public directory so that the skin will work in +# In order to create another skin for a component, simply create a {skin_name}.css file and a {skin_name} directory with the style +# assets in it. Be sure to reference the style assets with absolute paths from teh public directory so that the skin will work in # all cases. Then call the component's view helper and use the :skin option: # # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %> # module Guilded - VERSION = '1.0.12' + VERSION = '1.0.13' end ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView ) From 3810f8a6ef4d3b36fe1770a8a5900d6e091fd71f Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Wed, 11 Aug 2010 17:54:10 -0500 Subject: [PATCH 3/8] Change home page and source code addresses. --- README.rdoc | 70 ++++++++++++++++++++++++++--------------------------- Rakefile | 2 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/README.rdoc b/README.rdoc index 4364817..04840cf 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,36 +1,36 @@ = guilded -http://github.com/midas/guilded +http://github.com/guilded/guilded == DESCRIPTION -Guilded is a framework for building web based components centered around current web standards and best practices. The current +Guilded is a framework for building web based components centered around current web standards and best practices. The current framework is written in ruby, but could be ported to other languages. Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is -filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and -are not accessible. Guilded seeks to provide the same level of componentization and ease of use without sacrificing degradability -and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do -as it was intended. +filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and +are not accessible. Guilded seeks to provide the same level of componentization and ease of use without sacrificing degradability +and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do +as it was intended. -XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript -through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are -enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. +XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript +through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are +enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement -due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly -desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will +due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly +desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will allow the jQuery or MooTools plugin to be used outside of the Guilded project, if desired. Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable. -Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged +Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged in a Gem and have a dependency on the Guilded gem. The Guilded gem contains the framework to build Guilded components. -Update: Due to the quality components, etc. being generated by the MooTools community and the general quality of the library, we +Update: Due to the quality components, etc. being generated by the MooTools community and the general quality of the library, we have decided to include support for it in Guilded as of release 0.3.0. @@ -41,39 +41,39 @@ have decided to include support for it in Guilded as of release 0.3.0. * Automatic addition of MooTools 1.2.3 library if a utilized component defines it as a dependency using the :mootools => true option with the Guilder.add() method when defining the component. * Automatic addition of Yahoo's reset-min.css. -* Redefinition of jQuery's $ method to $j and running jQuery in no conflict mode to allow other libraries to retain control +* Redefinition of jQuery's $ method to $j and running jQuery in no conflict mode to allow other libraries to retain control of the $ method. * Definition of the g namespace to avoid JavaScript name collisions. Simply define your custom functions within the g object. * Definition of convenience method $j(). Equivalent to jQuery() or $(). Guilded runs jQuery in no conflict mode, giving the $ back to any other JavaScript frameworks in use. You must use $j() or jQuery() in lieu of $(). * Definition of convenience method $jc(). Equivalent to jQuery( '.' + className ). -* Definition of convenience method $jid(). Equivalent to jQuery( '#' + idName ). +* Definition of convenience method $jid(). Equivalent to jQuery( '#' + idName ). * The assets required for each component are added by the author to a central data store. When the view helper to create the component is called, these assets are added to the asset store. This results in a single method call with some options - to use a Guilded component. No need to include JavaScript source files or CSS files. Guilded automatically does this for + to use a Guilded component. No need to include JavaScript source files or CSS files. Guilded automatically does this for you. -* For CSS assets, Guilded simply loops through the collection of CSS assets creating an HTML link tag for each asset, or one +* For CSS assets, Guilded simply loops through the collection of CSS assets creating an HTML link tag for each asset, or one HTML link tag for the cached version of these asset(s), when running in production mode. * For JavaScript assets, Guilded loops through the collection of JavaScript assets creating an HTML script tag for each, or a single script tag for the cached version of these asset(s), when running in production mode. * Pass named data structures from the server to the client side environment for use with the Guilder.add_data() method. Once Guilded is initialized, the data structure will be instantiated for you with the name specified within the g object. -* Execute custom JavaScript code after all Guilded components are initialized (ensuring everything you wish to use is instantiated) +* Execute custom JavaScript code after all Guilded components are initialized (ensuring everything you wish to use is instantiated) using the 'guildedInitialized' custom jQuery event defined on the body DOM element. -* g_javascript_include_tag view helper that will explicitly add JavaScript libraries to the libs collection to be included in the - assets. This helper will also resolve any libs to their full or compressed versions dependent on the current executing environment. +* g_javascript_include_tag view helper that will explicitly add JavaScript libraries to the libs collection to be included in the + assets. This helper will also resolve any libs to their full or compressed versions dependent on the current executing environment. Additionally, the symbols :jquery and :mootools will be expanded to the lib version defined in the Guilded configuration. === Caching of CSS and JavaScript assets needed to render a web page. -* The CSS assets are cached to form one file. In addition, the JavaScript assets are cached to form one file. These files are - named by sorting and concatenating into a single string the names of each individual respective asset. This string is then hashed - to generate a reproducable unique string. This file naming technique allows Guilded to find cached asset files that - match a combination of Guilded components, not an action, URI, etc. Thus, one file for a certain combination of Guilded +* The CSS assets are cached to form one file. In addition, the JavaScript assets are cached to form one file. These files are + named by sorting and concatenating into a single string the names of each individual respective asset. This string is then hashed + to generate a reproducable unique string. This file naming technique allows Guilded to find cached asset files that + match a combination of Guilded components, not an action, URI, etc. Thus, one file for a certain combination of Guilded components is generated and then reused on any page where the combination appears. === Automatic choosing of packed, compressed or minified JavaScript files when in production mode. -* In production mode, Guilded automatically looks for a .pack, .compressed or .min version of the JavaScript assets. If one of - these is found, it includes it, otherwise, it includes the version specified by the author in the view helper. This is usually +* In production mode, Guilded automatically looks for a .pack, .compressed or .min version of the JavaScript assets. If one of + these is found, it includes it, otherwise, it includes the version specified by the author in the view helper. This is usually an unpacked version of the file. === Additional common utilities @@ -131,7 +131,7 @@ Install the Gem: bundle install # Rails 3 rake gems:install # Rails 2 gem install guilded # Manual - + Generate: rails generate guilded_config # Rails 3 @@ -142,7 +142,7 @@ Generate: Edit the settings file at config/initializers/load_guilded_settings.rb. Change any of these settings to reflect how -you would like Guilded to be configured. If you change where any file(s) are configured to be located, then also move +you would like Guilded to be configured. If you change where any file(s) are configured to be located, then also move the respective file(s). @@ -150,7 +150,7 @@ the respective file(s). === COMPONENT FRAMEWORK -You must make a call to the view helper to apply the CSS. The raw method must be used with Rails 3 as the new default +You must make a call to the view helper to apply the CSS. The raw method must be used with Rails 3 as the new default escapes strings. It should be placed in your layout: <%= raw g_apply_style %> # Rails 3 @@ -162,26 +162,26 @@ do not have to include it in every template): # Rails 3 <%= raw g_apply_includes %> <% g_inject_styles %> # Rails 2 <%= g_apply_includes %> <% g_inject_styles %> -A before filter is automatically set up in your application controller to reset the Guilded singleton that manages +A before filter is automatically set up in your application controller to reset the Guilded singleton that manages everything after each rendering. The code looks like this: before_filter :reset_guilded - + #... - + protected - + def reset_guilded Guilded::Guilder.instance.reset! end diff --git a/Rakefile b/Rakefile index 29de3ae..f1008d8 100644 --- a/Rakefile +++ b/Rakefile @@ -8,7 +8,7 @@ begin gem.summary = %Q{A framework for building web based components centered around current web standards and best practices.} gem.description = %Q{Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible (in most cases). Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do as it was intended.} gem.email = "jason@lookforwardenterprises.com" - gem.homepage = "http://github.com/midas/guilded" + gem.homepage = "http://github.com/guilded/guilded" gem.authors = ["C. Jason Harrelson (midas)"] gem.add_development_dependency "shoulda", ">= 2.10.2" gem.add_development_dependency "rspec", ">= 1.2.9" From 038be18d14d55e2902786b845f439183f1101841 Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Fri, 30 Sep 2011 15:07:56 -0500 Subject: [PATCH 4/8] Do not include path helpers in JS init options hash unless option set to true. --- lib/guilded/guilder.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/guilded/guilder.rb b/lib/guilded/guilder.rb index 2fedfe7..c46014e 100644 --- a/lib/guilded/guilder.rb +++ b/lib/guilded/guilder.rb @@ -170,6 +170,8 @@ def generate_javascript_init( options={} ) #:nodoc: code << "g.#{name} = #{data.to_json};" end @g_elements.each_value do |guilded_def| + include_path_helpers = guilded_def.options.delete( :include_path_helpers_in_init_options ) + guilded_def.options.delete( :path_helpers ) unless include_path_helpers code << "g.#{guilded_def.kind.to_s.camelize( :lower )}Init(#{guilded_def.options.to_json});" unless guilded_def.exclude_js? end code << "jQuery('body').trigger('guildedInitialized');};jQuery('document').ready(initGuildedElements);" @@ -389,4 +391,4 @@ def add_guilded_css_path( source, skin ) #:nodoc: File.exists?( path ) ? part : '' end end -end \ No newline at end of file +end From 7e2bd772ebdff889f0e65e970d00da919dbe7cde Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Fri, 30 Sep 2011 15:37:26 -0500 Subject: [PATCH 5/8] Use Bundler in stead of Jeweler for Gem builds, etc. --- .rvmrc | 2 + Gemfile | 24 ++++++ Gemfile.lock | 61 +++++++++++++++ History.txt | 172 ----------------------------------------- Rakefile | 68 +--------------- VERSION | 1 - guilded.gemspec | 127 ++++++------------------------ lib/guilded/version.rb | 3 + 8 files changed, 113 insertions(+), 345 deletions(-) create mode 100644 .rvmrc create mode 100644 Gemfile create mode 100644 Gemfile.lock delete mode 100644 History.txt delete mode 100644 VERSION create mode 100644 lib/guilded/version.rb diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 0000000..e2b4d0d --- /dev/null +++ b/.rvmrc @@ -0,0 +1,2 @@ +rvm use ruby-1.8.7-p334@guilded +rvm info diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..fc314c6 --- /dev/null +++ b/Gemfile @@ -0,0 +1,24 @@ +source "http://rubygems.org" + +group :development do + gem 'gem-dandy' + gem 'jeweler' +end + +group :development, :test do + gem 'ruby-debug' + gem 'guard' + gem 'rb-fsevent' + gem 'growl' + gem 'guard-rspec' + gem 'guard-shell' +end + +group :test do + gem 'rspec' +end + +# Specify your gem's dependencies in guilded.gemspec +gemspec + + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..d95aa82 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,61 @@ +PATH + remote: . + specs: + guilded (1.0.14) + +GEM + remote: http://rubygems.org/ + specs: + columnize (0.3.4) + diff-lcs (1.1.3) + gem-dandy (0.2.1) + trollop (= 1.16.2) + git (1.2.5) + growl (1.0.3) + guard (0.8.2) + thor (~> 0.14.6) + guard-rspec (0.4.5) + guard (>= 0.4.0) + guard-shell (0.1.1) + guard (>= 0.2.0) + jeweler (1.6.4) + bundler (~> 1.0) + git (>= 1.2.5) + rake + linecache (0.46) + rbx-require-relative (> 0.0.4) + rake (0.9.2) + rb-fsevent (0.4.3.1) + rbx-require-relative (0.0.5) + rspec (2.6.0) + rspec-core (~> 2.6.0) + rspec-expectations (~> 2.6.0) + rspec-mocks (~> 2.6.0) + rspec-core (2.6.4) + rspec-expectations (2.6.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.6.0) + ruby-debug (0.10.4) + columnize (>= 0.1) + ruby-debug-base (~> 0.10.4.0) + ruby-debug-base (0.10.4) + linecache (>= 0.3) + shoulda (2.11.3) + thor (0.14.6) + trollop (1.16.2) + +PLATFORMS + ruby + +DEPENDENCIES + gem-dandy + growl + guard + guard-rspec + guard-shell + guilded! + jeweler + rb-fsevent + rspec + ruby-debug + shoulda diff --git a/History.txt b/History.txt deleted file mode 100644 index 77ce5d8..0000000 --- a/History.txt +++ /dev/null @@ -1,172 +0,0 @@ -= 1.0.13 2010-08-04 - -* Provide option to include script tags in the g_apply_behavior method. - - -= 1.0.12 2010-05-11 - -* Fixed a new compatibility issue with Rails 3 templating. - - -= 1.0.11 2010-05-11 - -* Yanked (cancelled) - - -= 1.0.10 2010-04-22 - -* Added option to allow for serving jQuery lib from a remote asset server (ie. Google). -* Added Rails 3 compliant generators. - - -= 1.0.9 2010-04-16 - -* Updated the Rails Guilded initializer to get rid of deprecated RAILS_ROOT in favor of Rails.root. - - -= 1.0.8 2010-03-12 - -* Removed the human attribute override in favor of using the Rails I18n implementation. - - -= 1.0.7 2010-02-19 - -* Updated view helpers and Guilder to adapt to usage in Rails 3. - - -= 1.0.5 2010-01-21 - -* Gave css inclusion a :position option allowing for positioning before or after the component(s) css. - - -= 1.0.4 2010-01-04 - -* Fixed a bug with a file include to make Guilded work with the bundler gem. - - -= 1.0.3 2009-11-16 - -* The reset_guilded filter is now automatically set up in ActionController. - - -= 1.0.2 2009-11-13 - -* Fixed issue with human_attribute_name override not accepting an options hash. Was breaking remarkable gem. - - -= 1.0.1 2009-10-19 - -* Moved the browser detector to its own Gem. - - -= 1.0.0 2009-10-15 - -* It's about time for a 1.0.0 release -* Updated the browser detector to be more robust in its detection abilities and provide more features - - -= 0.3.0 2009-07-12 - -* Added support for MooTools library. -* Added :mootools option to the Guilder.add() method. If true is passed into this option when adding a component, Guilded - will automatically add the mootools library to the libs collection so that the lib will be included in the assets the - page loads. -* Updated the g_javascript_include_tag to resolve the :jquery and :mootools symbols to their respective libraries based - on the configuration of Guilded and the current running environment. - - -= 0.2.9 2009-06-18 - -* Added rescue code if the browser name or version fails. - - -= 0.2.8 2009-06-12 - -* Removed some code from the InactiveRecord:Base extension for human attrbiute hint that returns unless - table_exists? as this does not make any sense for InactiveRecord. - - -= 0.2.7 2009-06-10 - -* Changed the BrowserDetector to need to be instantiated to use. No longer just static methods. - - -= 0.2.6 2009-06-10 - -* Added some more view helpers for the browser detector. - - -= 0.2.5 2009-06-10 - -* Added BrowserDetector to assist with determining which browser is making a request. - - -= 0.2.4 2009-05-29 - -* Added add_data method to the Guilder object allowing named data structures to be passed to the JavaScript - executing environment. -* Added a jQuery event to the body DOM element called guildedInitialized. To execute JavaScript code after all - Guilded components are intialized, simply bind to this event. - - -= 0.2.0 2009-04-06 - -* Added human attribute hint support for InactiveRecord - - -= 0.2.0 2009-03-27 - -* Added Mark Perkins jquery-url plugin and made it a default library - - -= 0.1.9 2009-03-26 - -* Added Rails helper method to resolve REST path helpers and args - - -= 0.1.5 2009-03-24 - -* Added g_apply_style helper -* Added functionality to put CSS link tags in the HTML header, where they belong - - -== 0.1.4 2009-03-17 - -* Added include_component? method for testing if a component type is already present in the Guilded elements collection -* Fixed bug with Exception raising in add method - - -== 0.1.2 2009-03-13 - -* Fixed a bug with stylesheet and JS tag helpers. - - -== 0.1.0 2009-03-12 - -* Fixed a bug with requiring files. - - -== 0.0.9 2009-03-12 - -* Added Guilded::Rails::Helpers class to hold some common helpers for Rails components - - -== 0.0.8 2009-03-12 - -* Added attr_human_override and attr_human_hint - - -== 0.0.7 2009-03-11 - -* Bug fixes - - -== 0.0.6 2009-03-11 - -* Updated config file and Guilder to accept an :env variable. This variable will allow Guilded to know what environment - it is running in so that it knows whether to cache assets, etc. - - -== 0.0.1 2009-02-28 - -* Initial release diff --git a/Rakefile b/Rakefile index f1008d8..833ace3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,67 +1 @@ -require 'rubygems' -require 'rake' - -begin - require 'jeweler' - Jeweler::Tasks.new do |gem| - gem.name = "guilded" - gem.summary = %Q{A framework for building web based components centered around current web standards and best practices.} - gem.description = %Q{Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible (in most cases). Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do as it was intended.} - gem.email = "jason@lookforwardenterprises.com" - gem.homepage = "http://github.com/guilded/guilded" - gem.authors = ["C. Jason Harrelson (midas)"] - gem.add_development_dependency "shoulda", ">= 2.10.2" - gem.add_development_dependency "rspec", ">= 1.2.9" - gem.add_dependency "activesupport", ">= 2.0.2" - end - Jeweler::GemcutterTasks.new -rescue LoadError - puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" -end - -require 'spec/rake/spectask' -Spec::Rake::SpecTask.new(:spec) do |spec| - spec.libs << 'lib' << 'spec' - spec.spec_files = FileList['spec/**/*_spec.rb'] -end - -Spec::Rake::SpecTask.new(:rcov) do |spec| - spec.libs << 'lib' << 'spec' - spec.pattern = 'spec/**/*_spec.rb' - spec.rcov = true -end - -task :spec => :check_dependencies - -task :default => :spec - -begin - require 'rcov/rcovtask' - Rcov::RcovTask.new do |test| - test.libs << 'test' - test.pattern = 'test/**/*_test.rb' - test.verbose = true - end -rescue LoadError - task :rcov do - abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" - end -end - -task :test => :check_dependencies - -task :default => :test - -require 'rake/rdoctask' -Rake::RDocTask.new do |rdoc| - if File.exist?('VERSION') - version = File.read('VERSION') - else - version = "" - end - - rdoc.rdoc_dir = 'rdoc' - rdoc.title = "tester #{version}" - rdoc.rdoc_files.include('README*') - rdoc.rdoc_files.include('lib/**/*.rb') -end +require "bundler/gem_tasks" diff --git a/VERSION b/VERSION deleted file mode 100644 index 2ac9634..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.13 diff --git a/guilded.gemspec b/guilded.gemspec index 70ae208..d8ce415 100644 --- a/guilded.gemspec +++ b/guilded.gemspec @@ -1,113 +1,30 @@ -# Generated by jeweler -# DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require "guilded/version" Gem::Specification.new do |s| - s.name = %q{guilded} - s.version = "1.0.13" - - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.authors = ["C. Jason Harrelson (midas)"] - s.date = %q{2010-08-04} + s.name = "guilded" + s.version = Guilded::VERSION + s.authors = ["Jason Harrelson"] + s.email = ["jason@lookforwardenterprises.com"] + s.homepage = "http://github.com/guilded/guilded" + s.summary = %q{A framework for building web based components centered around current web standards and best practices.} s.description = %q{Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible (in most cases). Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do as it was intended.} - s.email = %q{jason@lookforwardenterprises.com} - s.extra_rdoc_files = [ - "README.rdoc" - ] - s.files = [ - ".gitignore", - "History.txt", - "README.rdoc", - "Rakefile", - "VERSION", - "guilded.gemspec", - "lib/generators/guilded_assets/guilded_assets_generator.rb", - "lib/generators/guilded_assets/templates/guilded.js", - "lib/generators/guilded_assets/templates/guilded.min.js", - "lib/generators/guilded_assets/templates/jquery-1.2.6.js", - "lib/generators/guilded_assets/templates/jquery-1.2.6.min.js", - "lib/generators/guilded_assets/templates/jquery-1.3.2.js", - "lib/generators/guilded_assets/templates/jquery-1.3.2.min.js", - "lib/generators/guilded_assets/templates/jquery-url.js", - "lib/generators/guilded_assets/templates/jquery-url.min.js", - "lib/generators/guilded_assets/templates/mootools-1.2.3.js", - "lib/generators/guilded_assets/templates/mootools-1.2.3.min.js", - "lib/generators/guilded_assets/templates/reset-min.css", - "lib/generators/guilded_config/guilded_config_generator.rb", - "lib/generators/guilded_config/templates/guilded_config.rb", - "lib/guilded.rb", - "lib/guilded/component_def.rb", - "lib/guilded/exceptions.rb", - "lib/guilded/guilder.rb", - "lib/guilded/rails.rb", - "lib/guilded/rails/active_record/human_attribute_hint.rb", - "lib/guilded/rails/controller_actions.rb", - "lib/guilded/rails/helpers.rb", - "lib/guilded/rails/inactive_record/human_attribute_hint.rb", - "lib/guilded/rails/view_helpers.rb", - "rails_generators/guilded_assets/guilded_assets_generator.rb", - "rails_generators/guilded_assets/templates/guilded.js", - "rails_generators/guilded_assets/templates/guilded.min.js", - "rails_generators/guilded_assets/templates/jquery-1.2.6.js", - "rails_generators/guilded_assets/templates/jquery-1.2.6.min.js", - "rails_generators/guilded_assets/templates/jquery-1.3.2.js", - "rails_generators/guilded_assets/templates/jquery-1.3.2.min.js", - "rails_generators/guilded_assets/templates/jquery-url.js", - "rails_generators/guilded_assets/templates/jquery-url.min.js", - "rails_generators/guilded_assets/templates/mootools-1.2.3.js", - "rails_generators/guilded_assets/templates/mootools-1.2.3.min.js", - "rails_generators/guilded_assets/templates/reset-min.css", - "rails_generators/guilded_config/guilded_config_generator.rb", - "rails_generators/guilded_config/templates/guilded_config.rb", - "script/console", - "script/destroy", - "script/generate", - "spec/generators/guilded_assets_generator_spec.rb", - "spec/generators/guilded_config_generator_spec.rb", - "spec/guilded/component_def_spec.rb", - "spec/guilded/guilder_spec.rb", - "spec/guilded_spec.rb", - "spec/spec.opts", - "spec/spec_helper.rb", - "tasks/rails.rake", - "tasks/rspec.rake", - "test/guilded/rails/helpers_test.rb", - "test/test_helper.rb" - ] - s.homepage = %q{http://github.com/midas/guilded} - s.rdoc_options = ["--charset=UTF-8"] - s.require_paths = ["lib"] - s.rubygems_version = %q{1.3.6} - s.summary = %q{A framework for building web based components centered around current web standards and best practices.} - s.test_files = [ - "spec/generators/guilded_assets_generator_spec.rb", - "spec/generators/guilded_config_generator_spec.rb", - "spec/guilded/component_def_spec.rb", - "spec/guilded/guilder_spec.rb", - "spec/guilded_spec.rb", - "spec/spec_helper.rb", - "test/guilded/rails/helpers_test.rb", - "test/test_helper.rb" - ] - if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 3 + s.rubyforge_project = "guilded" + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - s.add_development_dependency(%q, [">= 2.10.2"]) - s.add_development_dependency(%q, [">= 1.2.9"]) - s.add_runtime_dependency(%q, [">= 2.0.2"]) - else - s.add_dependency(%q, [">= 2.10.2"]) - s.add_dependency(%q, [">= 1.2.9"]) - s.add_dependency(%q, [">= 2.0.2"]) - end - else - s.add_dependency(%q, [">= 2.10.2"]) - s.add_dependency(%q, [">= 1.2.9"]) - s.add_dependency(%q, [">= 2.0.2"]) + # specify any dependencies here; for example: + %w( + rspec + shoulda + ).each do |development_dependency| + s.add_development_dependency development_dependency end -end + # s.add_runtime_dependency "rest-client" +end diff --git a/lib/guilded/version.rb b/lib/guilded/version.rb new file mode 100644 index 0000000..a81bf18 --- /dev/null +++ b/lib/guilded/version.rb @@ -0,0 +1,3 @@ +module Guilded + VERSION = "1.0.14" +end From 15347dd4adbf34da03aa8ae04ad945a3ce89bfbb Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Thu, 5 Jan 2012 16:03:26 -0600 Subject: [PATCH 6/8] Fix issue caused by ActiveRecord::Relation in Rails 3.x. --- lib/guilded/rails/helpers.rb | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/guilded/rails/helpers.rb b/lib/guilded/rails/helpers.rb index 3463224..4becfd7 100644 --- a/lib/guilded/rails/helpers.rb +++ b/lib/guilded/rails/helpers.rb @@ -1,18 +1,20 @@ module Guilded module Rails - + require 'active_support' #require 'rubygems' #gem 'activesupport', '2.3.2' - + # Common functionality that Rails Guilded components may need to use. # class Helpers - + # Resolves the REST path helper names and arguments from a ActiveRecord object(s). # - def self.resolve_rest_path_helpers( ar_obj_col_or_class, options={} ) - if ar_obj_col_or_class.is_a?( Array ) + def self.resolve_rest_path_helpers( ar_obj_col_or_class, options={} ) + if ar_obj_col_or_class.is_a?( ActiveRecord::Relation ) + ar_obj = ar_obj_col_or_class.first + elsif ar_obj_col_or_class.is_a?( Array ) ar_obj = ar_obj_col_or_class[0] elsif ar_obj_col_or_class.is_a?( ActiveRecord::Base ) ar_obj = ar_obj_col_or_class @@ -21,7 +23,7 @@ def self.resolve_rest_path_helpers( ar_obj_col_or_class, options={} ) else ar_obj = ar_obj_col_or_class end - + plural_ar_type = ar_obj.class.to_s.tableize singular_ar_type = plural_ar_type.singularize polymorphic_as = options[:polymorphic_as] @@ -35,12 +37,12 @@ def self.resolve_rest_path_helpers( ar_obj_col_or_class, options={} ) scoped_by = Array.new shallow_scoped_by = Array.new helpers = Hash.new - + if options[:namespace] pre << "#{options[:namespace].to_s}_" - shallow_pre << "#{options[:namespace].to_s}_" + shallow_pre << "#{options[:namespace].to_s}_" end - + if options[:scoped_by] scoped_by = options[:scoped_by].is_a?( Array ) ? options[:scoped_by] : Array.new << options[:scoped_by] scoped_by.each_with_index do |scoper, i| @@ -51,7 +53,7 @@ def self.resolve_rest_path_helpers( ar_obj_col_or_class, options={} ) shallow_scoped_by = scoped_by.clone shallow_scoped_by.pop if options[:shallow] end - + helpers[:index_rest_helper] = "#{pre}#{plural_derived_type}_path" helpers[:index_rest_args] = scoped_by helpers[:show_rest_helper] = "#{shallow_pre}#{singular_derived_type}_path" @@ -62,10 +64,10 @@ def self.resolve_rest_path_helpers( ar_obj_col_or_class, options={} ) helpers[:edit_rest_args] = shallow_scoped_by helpers[:delete_rest_helper] = "delete_#{shallow_pre}#{singular_derived_type}_path" helpers[:delete_rest_args] = shallow_scoped_by - + return helpers end - + # Helper method that generates a path from an item. If item is :home then this method # will call the home_path method to generate a link # @@ -116,8 +118,8 @@ def self.resolve_field_methods_and_titles( choices, ar_obj ) return methods, titles end - + end - + end -end \ No newline at end of file +end From 17c9945a5a161f9a64a6282b79e7bd60cfac0240 Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Thu, 5 Jan 2012 16:04:00 -0600 Subject: [PATCH 7/8] Bump version to v1.1.0. --- lib/guilded/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/guilded/version.rb b/lib/guilded/version.rb index a81bf18..9330bfd 100644 --- a/lib/guilded/version.rb +++ b/lib/guilded/version.rb @@ -1,3 +1,3 @@ module Guilded - VERSION = "1.0.14" + VERSION = "1.1.0" end From 913288cfef984ed88a1bafbaa99cc6b977d7778a Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Tue, 19 Mar 2013 17:05:51 -0500 Subject: [PATCH 8/8] Update RVM Ruby version to 1.9.3-p392. --- .rvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rvmrc b/.rvmrc index e2b4d0d..af57717 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1,2 +1,2 @@ -rvm use ruby-1.8.7-p334@guilded +rvm use ruby-1.9.3-p392@guilded --create rvm info