midas-guilded 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,8 @@
1
+ == 0.0.6 2009-02-11
2
+
3
+ * Updated config file and Guilder to accept an :env variable. This variable will allow Guilded to know what environment
4
+ it is running in so that it knows whether to cache assets, etc.
5
+
1
6
  == 0.0.1 2009-02-28
2
7
 
3
- * 1 major enhancement:
4
- * Initial release
8
+ * Initial release
@@ -1,10 +1,10 @@
1
1
  = guilded-base
2
2
 
3
- * http://github.com/midas/guilded-base/tree/master
3
+ http://github.com/midas/guilded-base/tree/master
4
4
 
5
5
  == DESCRIPTION
6
6
 
7
- Warning: This project just started and there are no releases available yet.
7
+ Warning: This project just started and there are no stable releases available yet.
8
8
 
9
9
  Guilded is a framework for building web based components centered around current web standards and best practices. The current
10
10
  framework is written in ruby, but could be ported to other languages.
@@ -26,13 +26,39 @@ allow the jQuery plugin to be used outside of the Guilded project, if desired.
26
26
  Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable.
27
27
 
28
28
  Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged
29
- in a Gem and have a dependency on the guilded-base gem.
29
+ in a Gem and have a dependency on the guilded gem.
30
30
 
31
31
  The Guilded-Base gem contains the framework to build Guilded components.
32
32
 
33
33
 
34
34
  == FEATURES
35
35
 
36
+ === Centralized control of CSS and JavaScript assets needed to render a web page.
37
+ * Automatic addition of jQuery 1.3.2 library.
38
+ * Automatic addition of Yahoo's reset-min.css.
39
+ * Redefinition of jQuery's $ method to $j and running jQuery in no conflict mode to allow other libraries to retain control
40
+ of the $ method.
41
+ * Definition of the g namespace to avoid JavaScript name collisions.
42
+ * Definition of convenience method $jc(). Equivalent to jQuery( '.' + className ).
43
+ * Definition of convenience method $jid(). Equivalent to jQuery( '#' + idName ).
44
+ * The assets required for each component are added by the author to a central data store. When the view helper to create
45
+ the component is called, these assets are added to the asset store. This results in a single method call with some options
46
+ to use a Guilded component.
47
+ * For CSS assets, Guilded simply loops through the collection of CSS assets creating an HTML link tag for each asset, or one
48
+ HTML link tag for the cached version of these asset(s), when running in production mode.
49
+ * For JavaScript assets, Guilded loops through the collection of JavaScript assets creating an HTML script tag for each, or a
50
+ single script tag for the cached version of these asset(s), when running in production mode.
51
+
52
+ === Caching of CSS and JavaScript assets needed to render a web page.
53
+ * The CSS assets are cached to form one file. In addition, the JavaScript assets are cached to form one file. These files are
54
+ named by sorting and concatenating into a single string the names of each individual respective asset. This string is then hashed
55
+ to generate a reproducable unique string. This file naming technique allows Guilded to find cached asset files that
56
+ match a combination of Guilded components, not an action, URI, etc. Thus, one file for a certain combination of Guilded
57
+ components is generated and then reused on any page where the combination appears.
58
+
59
+ === Automatic choosing of packed, compressed or minified JavaScript files when in production mode.
60
+ * In production mode, Guilded automatically looks for a .pack, .compressed or .min version of the JavaScript assets. If one of
61
+ 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.
36
62
 
37
63
  == PROBLEMS
38
64
 
@@ -40,30 +66,29 @@ The Guilded-Base gem contains the framework to build Guilded components.
40
66
 
41
67
  == REQUIREMENTS
42
68
 
43
- jQuery
69
+ * jQuery 1.3.2 (included in Guilded)
44
70
 
45
71
 
46
72
  == INSTALL
47
73
 
48
- gem sources -a http://gems.github.com
49
-
50
- sudo gem install midas-guilded
74
+ gem sources -a http://gems.github.com
75
+ sudo gem install midas-guilded
51
76
 
52
77
 
53
78
  == INSTALL FOR RAILS
54
79
 
55
80
  Add to environment file:
56
81
 
57
- config.gem "guilded", :version => '0.0.3'
82
+ config.gem "guilded", :version => '0.0.5'
58
83
 
59
84
  Run:
60
85
 
61
- sudo rake:gems:install
86
+ sudo rake:gems:install
62
87
 
63
88
  Generate:
64
89
 
65
- script/generate guilded_config
66
- script/generate guilded_assets
90
+ script/generate guilded_config
91
+ script/generate guilded_assets
67
92
 
68
93
 
69
94
  Edit the settings file at config/initializers/load_guilded_settings.rb. Change any of these settings to reflect how
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/lib/guilded'
4
4
  # Generate all the Rake tasks
5
5
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
6
  $hoe = Hoe.new('guilded', Guilded::VERSION) do |p|
7
- p.developer('midas', 'jaosn@lookforwardenterprises.com')
7
+ p.developer('C. Jason Harrelson (midas)', 'jason@lookforwardenterprises.com')
8
8
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
9
  p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
10
  p.rubyforge_name = p.name # TODO this is default value
@@ -1,13 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
+
2
3
  Gem::Specification.new do |s|
3
4
  s.name = %q{guilded}
4
- s.version = "0.0.5"
5
+ s.version = "0.0.6"
5
6
 
6
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
- s.authors = ["midas"]
8
- s.date = %q{2009-03-03}
9
- s.description = %q{Warning: This project just started and there are no releases available yet. 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 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 to do what 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. 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 allow the jQuery 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 in a Gem and have a dependency on the guilded-base gem. The Guilded-Base gem contains the framework to build Guilded components.}
10
- s.email = ["jaosn@lookforwardenterprises.com"]
8
+ s.authors = ["C. Jason Harrelson (midas)"]
9
+ s.date = %q{2009-03-11}
10
+ s.description = %q{Warning: This project just started and there are no stable releases available yet. 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 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 to do what 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. 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 allow the jQuery 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 in a Gem and have a dependency on the guilded gem. The Guilded-Base gem contains the framework to build Guilded components.}
11
+ s.email = ["jason@lookforwardenterprises.com"]
11
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
12
13
  s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "guilded.gemspec", "lib/guilded.rb", "lib/guilded/component_def.rb", "lib/guilded/exceptions.rb", "lib/guilded/guilder.rb", "lib/guilded/rails.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/reset-min.css", "rails_generators/guilded_config/guilded_config_generator.rb", "rails_generators/guilded_config/templates/load_guilded_settings.rb", "script/console", "script/destroy", "script/generate", "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"]
13
14
  s.has_rdoc = true
@@ -17,7 +18,7 @@ Gem::Specification.new do |s|
17
18
  s.require_paths = ["lib"]
18
19
  s.rubyforge_project = %q{guilded}
19
20
  s.rubygems_version = %q{1.3.1}
20
- s.summary = %q{Warning: This project just started and there are no releases available yet}
21
+ s.summary = %q{Warning: This project just started and there are no stable releases available yet}
21
22
 
22
23
  if s.respond_to? :specification_version then
23
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -35,7 +36,3 @@ Gem::Specification.new do |s|
35
36
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
36
37
  end
37
38
  end
38
-
39
-
40
-
41
-
@@ -6,8 +6,69 @@ require 'guilded/guilder'
6
6
  require 'guilded/exceptions'
7
7
  require 'guilded/rails/view_helpers'
8
8
 
9
+ # Guilded is a framework for creating reusable UI components for web applications. Guilded provides the facilities to
10
+ # easily add components and all of their required assets to a page.
11
+ #
12
+ # A Guilded component is a set of XHTML, CSS and JavaScript that combine to create a rich UI. The Guilded component should be
13
+ # authored using progressive enhancement to enable users without CSS or JavaScript enabled to utilize the essential functionality
14
+ # of the component. The easiest way to accomplish this requirement is to write your behavior code as a jQuery plugin. Doing
15
+ # so will naturally guide your behavior code to be applied through progrssive enhancement and also allow your behavior code
16
+ # to be used without Guilded.
17
+ #
18
+ # To create a Guilded component at least four things must occur: writing a view helper, writing a JavaScript initialization
19
+ # function, writing a default stylesheet and writing either a rake task or generator to place these assets into a project's
20
+ # public directory. It is also probable that a jQuery plugin with the behavior code will need to be authored. If this is the
21
+ # case, then the JavaScript initialization function will most likely just call the jQuery plugin on the DOM element(s) that should
22
+ # have the behavior applied.
23
+ #
24
+ # The view helper should output the HTML necessary for the component. It must also add the component to a collection so that
25
+ # Guilded can collect its assets and add them to the page. This is accomplished through a call to the Guilder.add() method.
26
+ # The Guilder is a singleton, so you must access it like: Guilded::Guilder.instance.add( ... ). The Guilder.add() method adds
27
+ # element to a collection with it's options. Guilded automatically looks for CSS assets that obey the naming convention
28
+ # {component_name}/default.css. Guilded also automatically looks for a JavaScript asset named: guilded.{component_name}.js.
29
+ # This asset should at least include the initComponentName( options ). The Guilded.add() method can also add additional CSS and
30
+ # JavaScript assets necessary for a component. An example of an additional JavaScript asset is the jQuery plugin authored to
31
+ # contain the behavior of a component. The view helper must be called with an :id option as it is used to differentiate different
32
+ # 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
33
+ # helper should have a g_ appended to the beginning of it to help differentiate from normal view helepr sin a project.
34
+ #
35
+ # The JavaScript initialization function should be named init{ComponentName}( options ). The options hash from the view helper
36
+ # will automatically be passed to this function. The function should handle a before and after init callback to enable the user
37
+ # to set up anything necessary for the component and perform additional tasks. This function must also perform any other code
38
+ # necessary to set up the behavior for a compnent. An example fo this would be adding behavior to events or simply calling
39
+ # a jQuery plugin on element(s) of the component. Remember that any JavaScript relating to Guilded should be placed in the 'g'
40
+ # namespace that Guilded creates on every page. An example init function for a g_load_alerter would be:
41
+ #
42
+ # g.initLoadAlerter = function( options )
43
+ # {
44
+ # if( g.beforeInitLoadAlerter )
45
+ # g.beforeInitLoadAlerter( options );
46
+ #
47
+ # // Initialization code here...
48
+ #
49
+ # if( g.afterInitLoadAlerter )
50
+ # g.afterInitLoadAlerter( options );
51
+ # };
52
+ #
53
+ # For a user to implement these callback functions, they should create a JavaScript file with the functions and call it on
54
+ # any page they need it on utilizing Guilded's JavaScript include helper g_javascript_include_tag. This helper will add the
55
+ # JavaScript files after the jQuery and Guilded framework files, but within the component files in the order they were added.
56
+ # This will make the 'g' namespace available for use. Obviously this file must be included prior to calling the component's helper,
57
+ # or the callback functions will not be defined for use.
58
+ #
59
+ # The default stylesheet for a Guilded component should be the minimum amount of CSS for the component to function. When no :skin
60
+ # option is passed to the view helper when a component is added, Guilded will look for the default stylesheet. The assets
61
+ # used within the stylesheet (images) should be placed in a folder named default that is in the same directory as the default.css
62
+ # file. All asssets used in the stylesheet should use an absolute reference from the public directory: /stylesheets/guilded/{component_name}/default/{asset_name}.
63
+ #
64
+ # In order to create another skin for a component, simply create a {skin_name}.css file and a {skin_name} directory with the style
65
+ # assets in it. Be sure to reference the style assets with absolute paths from teh public directory so that the skin will work in
66
+ # all cases. Then call the component's view helper and use the :skin option:
67
+ #
68
+ # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %>
69
+ #
9
70
  module Guilded
10
- VERSION = '0.0.5'
71
+ VERSION = '0.0.6'
11
72
  end
12
73
 
13
74
  ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -2,16 +2,26 @@ require 'digest'
2
2
  require 'singleton'
3
3
 
4
4
  module Guilded
5
+
6
+ # Guilder is the worker for the entire Guilded framework. It collects all of the necessary components for a page
7
+ # through its add() method. When the g_apply_behavior() method is called at the end of a page, the Guilder writes
8
+ # HTML to include all of the necessary asset files (caching them in production). It also writes s JavaScript initialization
9
+ # function and fires the initialization function on page load.
10
+ #
11
+ # This initialization function calls the initialization function for each Guilded component that was added to the current
12
+ # page. For example, if a Guilded component named 'g_load_alerter' was added to a page, the Guilder would include this line
13
+ # in the initialization function it writes: g.initLoadAlerter( /* passing options hash here */ ); The g before the function
14
+ # is a JavaScript namespace that Guilded automatically creates to facilitate avoiding name collisions with other JavaScript
15
+ # libraries and code.
16
+ #
17
+ # Th options hash that is passed to the init functions for each Guilded component is simply the options hash from the
18
+ # component's view helper. The Guilder calls .to_json() on the options hash. Thus, if there are pairs in the options hash
19
+ # that need not go to the JavaScript init method they should be removed within the view helper.
20
+ #
5
21
  class Guilder
6
22
  include Singleton
7
23
 
8
- # The folder name for guilded JavaScript files. Must include trailing '/'.
9
- #GUILDED_JS_FOLDER = ""
10
- # The folder name for guilded css files. Must include trailing '/'.
11
- #GUILDED_CSS_FOLDER = "guilded/"
12
24
  GUILDED_NS = "guilded."
13
- # JS_PATH = GUILDED_CONFIG[:js_path] if defined?( GUILDED_CONFIG )
14
- # CSS_PATH = GUILDED_CONFIG[:css_path] if defined?( GUILDED_CONFIG )
15
25
 
16
26
  attr_reader :initialized_at
17
27
 
@@ -22,8 +32,6 @@ module Guilded
22
32
  raise Guilded::Exceptions::MissingConfiguration
23
33
  end
24
34
  @initialized_at = Time.now
25
- @env = options[:env].to_sym if options[:env]
26
- @env ||= :production
27
35
  @g_elements = Hash.new
28
36
  @combined_js_srcs = Array.new
29
37
  @combined_css_srcs = Array.new
@@ -41,27 +49,37 @@ module Guilded
41
49
  @g_elements[ options[:id] ] = Guilded::ComponentDef.new( element, options, libs, styles )
42
50
  end
43
51
 
44
- def count
52
+ def count #:nodoc:
45
53
  @g_elements.size
46
54
  end
47
55
 
56
+ # The number of Guilded components to be renderred.
57
+ #
48
58
  def component_count
49
59
  count
50
60
  end
51
61
 
62
+ # The current number of CSS assets necessary for the Guilded component set.
63
+ #
52
64
  def style_count
53
65
  @combined_css_srcs.size
54
66
  end
55
67
 
68
+ # The current number of JavaScript assets necessary for the Guilded component set.
69
+ #
56
70
  def script_count
57
71
  @combined_js_srcs.size
58
72
  end
59
73
 
74
+ # The collection of JavaScript assets for the current Guilded component set.
75
+ #
60
76
  def combined_js_srcs
61
77
  generate_asset_lists unless @assets_combined
62
78
  @combined_js_srcs
63
79
  end
64
80
 
81
+ # The collection of CSS assets for the current Guilded component set.
82
+ #
65
83
  def combined_css_srcs
66
84
  generate_asset_lists unless @assets_combined
67
85
  @combined_css_srcs
@@ -80,7 +98,7 @@ module Guilded
80
98
  # Generates the markup required to include all the assets necessary for the Guilded compoents in
81
99
  # @g_elements collection. Use this if you are not interested in caching asset files.
82
100
  #
83
- def apply
101
+ def apply #:nodoc:
84
102
  to_init = ""
85
103
  generate_asset_lists unless @assets_combined
86
104
  @combined_css_srcs.each { |css| to_init << "<link href=\"/stylesheets/#{css}\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />" }
@@ -92,7 +110,7 @@ module Guilded
92
110
  # Writes an initialization method that calls each Guilded components initialization method. This
93
111
  # method will exceute on document load finish.
94
112
  #
95
- def generate_javascript_init
113
+ def generate_javascript_init #:nodoc:
96
114
  code = "<script type=\"text/javascript\">"
97
115
  code << "var initGuildedElements = function(){"
98
116
  @g_elements.each_value do |guilded_def|
@@ -101,15 +119,21 @@ module Guilded
101
119
  code << "};jQuery('document').ready( initGuildedElements );</script>"
102
120
  end
103
121
 
122
+ # Generates a name to use when caching the current set of Guilded component JavaScript assets. Sorts and concatenates
123
+ # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique
124
+ # and shorter string.
104
125
  def js_cache_name
105
126
  generate_js_cache_name( @combined_js_srcs )
106
127
  end
107
128
 
129
+ # Generates a name to use when caching the current set of Guilded component CSS assets. Sorts and concatenates
130
+ # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique
131
+ # and shorter string.
108
132
  def css_cache_name
109
133
  generate_css_cache_name( @combined_css_srcs )
110
134
  end
111
135
 
112
- def generate_js_cache_name( sources )
136
+ def generate_js_cache_name( sources ) #:nodoc:
113
137
  generate_asset_lists unless @assets_combined
114
138
  #return"#{controller.class.to_s.underscore}_#{controller.action_name}" if development?
115
139
  sorted_srcs = sources.sort
@@ -118,7 +142,7 @@ module Guilded
118
142
  "#{Digest::MD5.hexdigest( joined )}"
119
143
  end
120
144
 
121
- def generate_css_cache_name( sources )
145
+ def generate_css_cache_name( sources ) #:nodoc:
122
146
  generate_asset_lists unless @assets_combined
123
147
  #return "#{controller.class.to_s.underscore}_#{controller.action_name}" if development?
124
148
  sorted_srcs = sources.sort
@@ -129,7 +153,7 @@ module Guilded
129
153
 
130
154
  protected
131
155
 
132
- def configure_guilded
156
+ def configure_guilded #:nodoc:
133
157
  @js_path = GUILDED_CONFIG[:js_path]
134
158
  @js_folder = GUILDED_CONFIG[:js_folder]
135
159
  @jquery_js = GUILDED_CONFIG[:jquery_js]
@@ -137,6 +161,8 @@ module Guilded
137
161
  @css_path = GUILDED_CONFIG[:css_path]
138
162
  @css_folder = GUILDED_CONFIG[:css_folder]
139
163
  @reset_css = GUILDED_CONFIG[:reset_css]
164
+ @env = GUILDED_CONFIG[:environment]
165
+ @env ||= :production
140
166
  @js_path.freeze
141
167
  @css_path.freeze
142
168
  @js_folder.freeze
@@ -144,12 +170,13 @@ module Guilded
144
170
  @guilded_js.freeze
145
171
  @css_folder.freeze
146
172
  @reset_css.freeze
173
+ @env.freeze
147
174
  end
148
175
 
149
176
  # Adds the Guilded reset CSS file and the guilded.js and jQuery files to the respective sources
150
177
  # collections.
151
178
  #
152
- def init_sources
179
+ def init_sources #:nodoc:
153
180
  @combined_css_srcs << "#{@reset_css}" unless @reset_css.nil? || @reset_css.empty?
154
181
  @combined_js_srcs << "#{@jquery_js}" << "#{@js_folder}#{@guilded_js}"
155
182
  end
@@ -157,7 +184,7 @@ module Guilded
157
184
  # Combines all JavaScript and CSS files into lists to include based on what Guilded components are on
158
185
  # the current page.
159
186
  #
160
- def generate_asset_lists
187
+ def generate_asset_lists #:nodoc:
161
188
  @assets_combined = true
162
189
  @g_elements.each_value do |defi|
163
190
  #TODO get stylesheet (skin) stuff using rails caching
@@ -179,7 +206,7 @@ module Guilded
179
206
  # libs An array of JavaScript libraries that this component depends on. More than likely
180
207
  # a jQuery plugin, etc.
181
208
  #
182
- def combine_js_sources( component, libs=[] ) #:doc:
209
+ def combine_js_sources( component, libs=[] ) #:nodoc:
183
210
  resolve_js_libs( libs )
184
211
 
185
212
  comp_src = add_guilded_js_path( component )
@@ -192,7 +219,7 @@ module Guilded
192
219
  # parts fo the name to try and get the debug version of the library. If it cannot
193
220
  # find the debug version of the file, it will just remain what was initially provded.
194
221
  #
195
- def resolve_js_libs( libs )
222
+ def resolve_js_libs( libs ) #:nodoc:
196
223
  if development?
197
224
  # Try to use an unpacked or unminimized version
198
225
  libs.each do |lib|
@@ -214,7 +241,7 @@ module Guilded
214
241
  # Helper method that takes an array of js sources and adds the correct guilded
215
242
  # path to them. Returns an array with the new path resolved sources.
216
243
  #
217
- def map_guilded_js_paths( *sources )
244
+ def map_guilded_js_paths( *sources ) #:nodoc:
218
245
  sources.map { |source| add_guilded_js_path( source ) }
219
246
  end
220
247
 
@@ -222,12 +249,14 @@ module Guilded
222
249
  # it looks for a .pack.js, .min.jsm .compressed.js and chooses one of these over the
223
250
  # development version.
224
251
  #
225
- def add_guilded_js_path( source )
252
+ def add_guilded_js_path( source ) #:nodoc:
226
253
  part = "#{@js_folder}#{GUILDED_NS}#{source.to_s}"
227
254
  ext = 'js'
228
255
 
229
256
  return "#{part}.#{ext}" if development?
230
257
 
258
+ #TODO: switch this to take min, pack or compressed out if in development mode for efficiency in production
259
+
231
260
  possibles = {
232
261
  "#{@js_path}#{part}.pack.#{ext}" => "#{part}.pack.#{ext}",
233
262
  "#{@js_path}#{part}.min.#{ext}" => "#{part}.min.#{ext}",
@@ -242,7 +271,7 @@ module Guilded
242
271
  "" # Should never reach here
243
272
  end
244
273
 
245
- def combine_css_sources( component, skin, styles=[] ) #:doc:
274
+ def combine_css_sources( component, skin, styles=[] ) #:nodoc:
246
275
  # Get all of this components defined external styles
247
276
  styles.each do |style|
248
277
  @combined_css_srcs.push( style ) unless @combined_css_srcs.include?( style )
@@ -257,15 +286,23 @@ module Guilded
257
286
  @combined_css_srcs.push( skin_user_src ) unless @combined_css_srcs.include?( skin_user_src ) || skin_user_src.empty?
258
287
  end
259
288
 
260
- def add_guilded_css_path( source, skin )
289
+ def add_guilded_css_path( source, skin ) #:nodoc:
261
290
  skin = 'default' if skin.nil? || skin.empty?
262
291
  part = "#{@css_folder}#{source.to_s}/#{skin}.css"
263
292
  path = "#{@css_path}#{part}"
264
293
  File.exists?( path ) ? part : ''
265
294
  end
266
295
 
267
- def development?
268
- @env == :development
296
+ def development? #:nodoc:
297
+ @env.to_sym == :development
298
+ end
299
+
300
+ def production? #:nodoc:
301
+ @env.to_sym == :production
302
+ end
303
+
304
+ def test? #:nodoc:
305
+ @env.to_sym == :test
269
306
  end
270
307
 
271
308
  end
@@ -1,8 +1,12 @@
1
+ # While Guilded is framework agnostic, this config file is Rails specific. You can create your own config file based
2
+ # on this one in order to work in different environments.
3
+ #
1
4
  GUILDED_CONFIG = {
2
5
  :js_path => "#{RAILS_ROOT}/public/javascripts/",
3
6
  :js_folder => "", # from the js_path
4
- :jquery_js => "jquery/jquery-1.2.6.min.js", # from the js_path
7
+ :jquery_js => "jquery/jquery-1.3.2.min.js", # from the js_path
5
8
  :css_path => "#{RAILS_ROOT}/public/stylesheets/",
6
9
  :css_folder => "guilded/", # from the css_path
7
- :reset_css => "reset-min.css" # from the css_path
10
+ :reset_css => "reset-min.css", # from the css_path
11
+ :environment => Rails.env
8
12
  }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midas-guilded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
- - midas
7
+ - C. Jason Harrelson (midas)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-03 00:00:00 -08:00
12
+ date: 2009-03-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,9 +32,9 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.8.0
34
34
  version:
35
- description: "Warning: This project just started and there are no releases available yet. 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 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 to do what 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. 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 allow the jQuery 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 in a Gem and have a dependency on the guilded-base gem. The Guilded-Base gem contains the framework to build Guilded components."
35
+ description: "Warning: This project just started and there are no stable releases available yet. 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 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 to do what 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. 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 allow the jQuery 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 in a Gem and have a dependency on the guilded gem. The Guilded-Base gem contains the framework to build Guilded components."
36
36
  email:
37
- - jaosn@lookforwardenterprises.com
37
+ - jason@lookforwardenterprises.com
38
38
  executables: []
39
39
 
40
40
  extensions: []
@@ -103,6 +103,6 @@ rubyforge_project: guilded
103
103
  rubygems_version: 1.2.0
104
104
  signing_key:
105
105
  specification_version: 2
106
- summary: "Warning: This project just started and there are no releases available yet"
106
+ summary: "Warning: This project just started and there are no stable releases available yet"
107
107
  test_files: []
108
108