midas-guilded 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2009-02-28
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,22 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ init.rb
7
+ lib/guilded.rb
8
+ lib/guilded/base.rb
9
+ lib/guilded/component_def.rb
10
+ lib/guilded/exceptions.rb
11
+ lib/guilded/guilder.rb
12
+ lib/guilded/rails.rb
13
+ lib/guilded/rails/view_helpers.rb
14
+ script/console
15
+ script/destroy
16
+ script/generate
17
+ spec/guilded/component_def_spec.rb
18
+ spec/guilded/guilder_spec.rb
19
+ spec/guilded_spec.rb
20
+ spec/spec.opts
21
+ spec/spec_helper.rb
22
+ tasks/rspec.rake
data/PostInstall.txt ADDED
@@ -0,0 +1,4 @@
1
+
2
+ For more information on guilded-base, see http://guilded-base.rubyforge.org
3
+
4
+
data/README.rdoc ADDED
@@ -0,0 +1,59 @@
1
+ = guilded-base
2
+
3
+ * http://github.com/midas/guilded-base/tree/master
4
+
5
+ == DESCRIPTION
6
+
7
+ Warning: This project just started and there are no releases available yet.
8
+
9
+ Guilded is a framework for building web based components centered around current web standards and best practices. The current
10
+ framework is written in ruby, but could be ported to other languages.
11
+
12
+ Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is
13
+ filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade and are
14
+ not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability
15
+ and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended.
16
+
17
+ XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript
18
+ through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are
19
+ enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled.
20
+
21
+ Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement
22
+ due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly
23
+ desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will
24
+ allow the jQuery plugin to be used outside of the Guilded project, if desired.
25
+
26
+ Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable.
27
+
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.
30
+
31
+ The Guilded-Base gem contains the framework to build Guilded components.
32
+
33
+
34
+ == FEATURES
35
+
36
+
37
+ == PROBLEMS
38
+
39
+
40
+
41
+ == REQUIREMENTS
42
+
43
+
44
+
45
+ == INSTALL
46
+
47
+
48
+
49
+ == LICENSE
50
+
51
+ Copyright (c) 2009 C. Jason Harrelson
52
+
53
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
54
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
55
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
56
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
57
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
58
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
59
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/guilded'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('guilded', Guilded::VERSION) do |p|
7
+ p.developer('midas', 'jaosn@lookforwardenterprises.com')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
+ p.rubyforge_name = p.name # TODO this is default value
11
+ # p.extra_deps = [
12
+ # ['activesupport','>= 2.0.2'],
13
+ # ]
14
+ p.extra_dev_deps = [
15
+ ['newgem', ">= #{::Newgem::VERSION}"]
16
+ ]
17
+
18
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
19
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
20
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
21
+ p.rsync_args = '-av --delete --ignore-errors'
22
+ end
23
+
24
+ require 'newgem/tasks' # load /tasks/*.rake
25
+ Dir['tasks/**/*.rake'].each { |t| load t }
26
+
27
+ # TODO - want other tests/tasks run by default? Add them to the list
28
+ # task :default => [:spec, :features]
data/init.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'guilded'
2
+
3
+ ActionView::Base.send( :include, Guilded::Rails::ViewHelpers )
data/lib/guilded.rb ADDED
@@ -0,0 +1,12 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'guilded/base'
5
+ require 'guilded/component_def'
6
+ require 'guilded/guilder'
7
+ require 'guilded/exceptions'
8
+ require 'guilded/rails/view_helpers'
9
+
10
+ module Guilded
11
+ VERSION = '0.0.1'
12
+ end
@@ -0,0 +1,17 @@
1
+ module Guilded
2
+ module Base
3
+
4
+ # A place to define common stylesheets for all guilded components
5
+ #COMMON_CSS = []
6
+
7
+ # A place to define common stylesheets for all guilded components
8
+ #COMMON_JS = []
9
+
10
+ JQUERY_JS = 'jquery/jquery-1.2.6.min.js'
11
+ GUILDED_JS = 'guilded/guilded.min.js'
12
+
13
+ # The reset stylesheet guilded will use.
14
+ RESET_CSS = 'guilded/reset-min.css'
15
+
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ module Guilded
2
+
3
+ class ComponentDef
4
+
5
+ attr_reader :kind, :options, :libs, :styles
6
+ attr_accessor :additional_js
7
+
8
+ def initialize( kind, options={}, libs=[], styles=[], additional_js='' )
9
+ @kind = kind
10
+ @options = options
11
+ @libs = libs
12
+ @styles = styles
13
+ @additional_js = additional_js
14
+ end
15
+
16
+ def exclude_css?
17
+ options.include?( :exclude_css ) && ( options[:exclude_css] == 'true' || options[:exclude_css] == true )
18
+ end
19
+
20
+ def exclude_js?
21
+ options.include?( :exclude_js ) && ( options[:exclude_js] == 'true' || options[:exclude_js] == true )
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,23 @@
1
+ module Guilded
2
+ module Exceptions
3
+
4
+ class GuildedException < RuntimeError
5
+ def initialize( msg="" ) #:nodoc:
6
+ @msg = msg
7
+ end
8
+ end
9
+
10
+ class IdMissing < GuildedException
11
+ def initialize #:nodoc:
12
+ @msg = ":id for element must be present in the options hash"
13
+ end
14
+ end
15
+
16
+ class DuplicateElementId < GuildedException
17
+ def initialize( id='' ) #:nodoc:
18
+ @msg = ":id #{id} for element is already in use on current page"
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,234 @@
1
+ require 'digest'
2
+ require 'singleton'
3
+
4
+ module Guilded
5
+ class Guilder
6
+ include Singleton
7
+
8
+ # The folder name for guilded JavaScript files. Must include trailing '/'.
9
+ GUILDED_JS_FOLDER = "guilded/"
10
+ # The folder name for guilded css files. Must include trailing '/'.
11
+ GUILDED_CSS_FOLDER = "guilded/"
12
+ GUILDED_NS = "guilded."
13
+
14
+ attr_reader :combined_js_srcs, :combined_css_srcs, :initialized_at
15
+
16
+ def initialize( options={} ) #:nodoc:
17
+ @initialized_at = Time.now
18
+ @env = options[:env].to_sym if options[:env]
19
+ @env ||= :production
20
+ @g_elements = Hash.new #unless @g_elements
21
+ @combined_js_srcs = Array.new #if @combined_js_srcs.nil?
22
+ @combined_css_srcs = Array.new #if @combined_css_srcs.nil?
23
+ @assets_combined = false
24
+ # Make sure that the css reset file is first so that other files can override the reset,
25
+ # unless the user specified no reset to be included.
26
+ init_sources
27
+ end
28
+
29
+ # Adds an element with its options to the @g_elements hash to be used later.
30
+ #
31
+ def add( element, options={}, libs=[], styles=[] )
32
+ raise Guilded::Exceptions::IdMissing unless options.has_key?( :id )
33
+ raise Guilded::Exceptions::DuplicateElementId( options[:id] ) if @g_elements.has_key?( options[:id] )
34
+ @g_elements[ options[:id] ] = Guilded::ComponentDef.new( element, options, libs, styles )
35
+ end
36
+
37
+ def count
38
+ @g_elements.size
39
+ end
40
+
41
+ def component_count
42
+ count
43
+ end
44
+
45
+ def style_count
46
+ @combined_css_srcs.size
47
+ end
48
+
49
+ def script_count
50
+ @combined_js_srcs.size
51
+ end
52
+
53
+ # Clears out all but the reset CSS and the base JavaScripts
54
+ #
55
+ def reset!
56
+ @combined_css_srcs.clear
57
+ @combined_js_srcs.clear
58
+ @g_elements.clear
59
+ init_sources
60
+ end
61
+
62
+ # Generates the markup required to include all the assets necessary for the Guilded compoents in
63
+ # @g_elements collection. Use this if you are not interested in caching asset files.
64
+ #
65
+ def apply
66
+ to_init = ""
67
+ generate_asset_lists unless @assets_combined
68
+ @combined_css_srcs.each { |css| to_init << "<link href=\"/stylesheets/#{css}\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />" }
69
+ @combined_js_srcs.each { |js| to_init << "<script type=\"text/javascript\" src=\"/javascripts/#{js}\"></script>" }
70
+ to_init << generate_javascript_init
71
+ end
72
+
73
+ # Writes an initialization method that calls each Guilded components initialization method. This
74
+ # method will exceute on document load finish.
75
+ #
76
+ def generate_javascript_init
77
+ code = "<script type=\"text/javascript\">"
78
+ code << "var initGuildedElements = function(){"
79
+ @g_elements.each_value do |guilded_def|
80
+ to_init << "g.#{guilded_def.kind.to_s.camelize( :lower )}Init( #{guilded_def.options.to_json} );" unless guilded_def.exclude_js?
81
+ end
82
+ to_init << "};jQuery('document').ready( initGuildedElements );</script>"
83
+ end
84
+
85
+ def js_cache_name
86
+ generate_js_cache_name( @combined_js_srcs )
87
+ end
88
+
89
+ def css_cache_name
90
+ generate_css_cache_name( @combined_css_srcs )
91
+ end
92
+
93
+ def generate_js_cache_name( sources )
94
+ generate_asset_lists unless @assets_combined
95
+ #return"#{controller.class.to_s.underscore}_#{controller.action_name}" if development?
96
+ sorted_srcs = sources.sort
97
+ stripped_srcs = sorted_srcs.map { |src| src.gsub( /.js/, '' ).gsub( /\//, '_') }
98
+ joined = stripped_srcs.join( "+" )
99
+ "#{Digest::MD5.hexdigest( joined )}"
100
+ end
101
+
102
+ def generate_css_cache_name( sources )
103
+ generate_asset_lists unless @assets_combined
104
+ #return "#{controller.class.to_s.underscore}_#{controller.action_name}" if development?
105
+ sorted_srcs = sources.sort
106
+ stripped_srcs = sorted_srcs.map { |src| src.gsub( /.css/, '' ).gsub( /\//, '_') }
107
+ joined = stripped_srcs.join( "+" )
108
+ "#{Digest::MD5.hexdigest( joined )}"
109
+ end
110
+
111
+ protected
112
+
113
+ # Adds the Guilded reset CSS file and the guilded.js and jQuery files to the respective sources
114
+ # collections.
115
+ #
116
+ def init_sources
117
+ @combined_css_srcs << Guilded::Base::RESET_CSS #unless options[:reset] == false
118
+ @combined_js_srcs << Guilded::Base::GUILDED_JS << Guilded::Base::JQUERY_JS
119
+ end
120
+
121
+ # Combines all JavaScript and CSS files into lists to include based on what Guilded components are on
122
+ # the current page.
123
+ #
124
+ def generate_asset_lists
125
+ @assets_combined = true
126
+ @g_elements.each_value do |defi|
127
+ #TODO get stylesheet (skin) stuff using rails caching
128
+ combine_css_sources( defi.kind, defi.options[:skin], defi.styles ) unless defi.exclude_css?
129
+
130
+ # Combine all JavaScript sources so that the caching option can be used on
131
+ # the javascript_incldue_tag helper.
132
+ combine_js_sources( defi.kind, defi.libs ) unless defi.exclude_js?
133
+ end
134
+ end
135
+
136
+ # Helper method that takes the libs and component specific js files and puts them
137
+ # into one array so that the javascript_include_tag can correctly cache them. Automatically
138
+ # ignores files that have already been inlcuded.
139
+ #
140
+ # *parameters*
141
+ # combined_src (required) An array of the combined sorces for the page being renderred.
142
+ # component (required) The name of a guilded component.
143
+ # libs An array of JavaScript libraries that this component depends on. More than likely
144
+ # a jQuery plugin, etc.
145
+ #
146
+ def combine_js_sources( component, libs=[] ) #:doc:
147
+ resolve_js_libs( libs )
148
+
149
+ comp_src = add_guilded_js_path( component )
150
+ @combined_js_srcs.push( comp_src ) unless @combined_js_srcs.include?( comp_src )
151
+ end
152
+
153
+ # Helper method that adds the aditional JavaScript library icludes to the include set.
154
+ #
155
+ # If running development mode, it will try to remove any .pack, .min, or.compressed
156
+ # parts fo the name to try and get the debug version of the library. If it cannot
157
+ # find the debug version of the file, it will just remain what was initially provded.
158
+ #
159
+ def resolve_js_libs( libs )
160
+ if development?
161
+ # Try to use an unpacked or unminimized version
162
+ libs.each do |lib|
163
+ debug_lib = lib.gsub( /.pack/, '' ).gsub( /.min/, '' ).gsub( /.compressed/, '' )
164
+ path = "#{RAILS_ROOT}/public/javascripts/#{debug_lib}"
165
+ if File.exist?( path )
166
+ @combined_js_srcs.push( debug_lib ) unless @combined_js_srcs.include?( debug_lib )
167
+ else
168
+ @combined_js_srcs.push( lib ) unless @combined_js_srcs.include?( lib )
169
+ end
170
+ end
171
+ else
172
+ libs.each do |lib|
173
+ @combined_js_srcs.push( lib ) unless @combined_js_srcs.include?( lib )
174
+ end
175
+ end
176
+ end
177
+
178
+ # Helper method that takes an array of js sources and adds the correct guilded
179
+ # path to them. Returns an array with the new path resolved sources.
180
+ #
181
+ def map_guilded_js_paths( *sources )
182
+ sources.map { |source| add_guilded_js_path( source ) }
183
+ end
184
+
185
+ # Adds the guilded JS path to the the source name passed in. When not in development mode,
186
+ # it looks for a .pack.js, .min.jsm .compressed.js and chooses one of these over the
187
+ # development version.
188
+ #
189
+ def add_guilded_js_path( source )
190
+ part = "#{GUILDED_JS_FOLDER}#{GUILDED_NS}#{source.to_s}"
191
+ ext = 'js'
192
+
193
+ return "#{part}.#{ext}" if development?
194
+
195
+ possibles = {
196
+ "#{RAILS_ROOT}/public/javascripts/#{part}.pack.#{ext}" => "#{part}.pack.#{ext}",
197
+ "#{RAILS_ROOT}/public/javascripts/#{part}.min.#{ext}" => "#{part}.min.#{ext}",
198
+ "#{RAILS_ROOT}/public/javascripts/#{part}.compressed.#{ext}" => "#{part}.compressed.#{ext}",
199
+ "#{RAILS_ROOT}/public/javascripts/#{part}.#{ext}" => "#{part}.#{ext}"
200
+ }
201
+
202
+ possibles.each do |full_path, part_path|
203
+ return part_path if File.exists?( full_path )
204
+ end
205
+ end
206
+
207
+ def combine_css_sources( component, skin, styles=[] ) #:doc:
208
+ # Get all of this components defined external styles
209
+ styles.each do |style|
210
+ @combined_css_srcs.push( style ) unless @combined_css_srcs.include?( style )
211
+ end
212
+
213
+ #Get the default or guilded skin styles for this component
214
+ comp_src = add_guilded_css_path( component, skin )
215
+ @combined_css_srcs.push( comp_src ) unless @combined_css_srcs.include?( comp_src ) || comp_src.empty?
216
+ user_src = add_guilded_css_path( component, "user" )
217
+ @combined_css_srcs.push( user_src ) unless @combined_css_srcs.include?( user_src ) || user_src.empty?
218
+ skin_user_src = add_guilded_css_path( component, "#{skin || 'default'}_user" )
219
+ @combined_css_srcs.push( skin_user_src ) unless @combined_css_srcs.include?( skin_user_src ) || skin_user_src.empty?
220
+ end
221
+
222
+ def add_guilded_css_path( source, skin )
223
+ skin = 'default' if skin.nil? || skin.empty?
224
+ part = "#{GUILDED_CSS_FOLDER}#{source.to_s}/#{skin}.css"
225
+ path = "#{RAILS_ROOT}/public/stylesheets/#{part}"
226
+ File.exists?( path ) ? part : ''
227
+ end
228
+
229
+ def development?
230
+ @env == :development
231
+ end
232
+
233
+ end
234
+ end
@@ -0,0 +1,4 @@
1
+ module Guilded
2
+ module Rails
3
+ end
4
+ end
@@ -0,0 +1,22 @@
1
+ module Guilded
2
+ module Rails
3
+ module ViewHelpers
4
+
5
+ # Generates the JavaScript includes for each Guilded element that is used. Also
6
+ # generates the initGuildedElements function and includes a call to each GUIlded
7
+ # elements Init method.
8
+ #
9
+ # Must be called once per rendered page. You can include it just before the closing body
10
+ # tag of your application layout. If no Guilded elements were called in the template, the
11
+ # call to g_apply_behavior will not output anything.
12
+ #
13
+ def g_apply_behavior
14
+ g = Guilded::Guilder.instance
15
+ html = stylesheet_link_tag( g.combined_css_srcs, :cache => "cache/#{g.css_cache_name}" )
16
+ html << javascript_include_tag( g.combined_js_srcs, :cache => "cache/#{g.js_cache_name}" )
17
+ html << g.generate_javascript_init
18
+ end
19
+
20
+ end
21
+ end
22
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/guilded.rb'}"
9
+ puts "Loading guilded gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "ComponentDef" do
4
+
5
+ before(:each) do
6
+ @cd = Guilded::ComponentDef.new( 'grid' )
7
+ @cd_exclude = Guilded::ComponentDef.new( 'grid', { :exclude_css => true, :exclude_js => true } )
8
+ end
9
+
10
+ it "should exclude css if specified" do
11
+ @cd_exclude.should be_exclude_css
12
+ end
13
+
14
+ it "should exclude js if specified" do
15
+ @cd_exclude.should be_exclude_js
16
+ end
17
+
18
+ it "should not exclude css unless specified" do
19
+ @cd.should_not be_exclude_css
20
+ end
21
+
22
+ it "should not exclude js unless specified" do
23
+ @cd.should_not be_exclude_js
24
+ end
25
+
26
+ end
@@ -0,0 +1,79 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "Guilder" do
4
+
5
+ before(:each) do
6
+ @g = Guilded::Guilder.instance
7
+ end
8
+
9
+ it "should return an instance" do
10
+ @g.should_not be_nil
11
+ end
12
+
13
+ it "should be a singleton" do
14
+ @g.initialized_at.should eql Guilded::Guilder.instance.initialized_at
15
+ end
16
+
17
+ it "should have 1 css source after init" do
18
+ @g.combined_css_srcs.size.should eql 1
19
+ end
20
+
21
+ it "should have 2 js sources after init" do
22
+ @g.combined_js_srcs.size.should eql 2
23
+ end
24
+
25
+ it "should increase count by one when you add a component" do
26
+ count = @g.count
27
+ @g.add( 'grid', { :id => 'grid' } )
28
+ @g.count.should eql( count + 1 )
29
+ end
30
+
31
+ it "should respond to add" do
32
+ @g.should respond_to :add
33
+ end
34
+
35
+ it "should respond to count" do
36
+ @g.should respond_to :count
37
+ end
38
+
39
+ it "should respond to reset!" do
40
+ @g.should respond_to :reset!
41
+ end
42
+
43
+ it "should respond to apply" do
44
+ @g.should respond_to :apply
45
+ end
46
+
47
+ it "should respond to generate_javascript_init" do
48
+ @g.should respond_to :generate_javascript_init
49
+ end
50
+
51
+ it "should respond_to js_cache_name" do
52
+ @g.should respond_to :js_cache_name
53
+ end
54
+
55
+ it "should respond_to css_cache_name" do
56
+ @g.should respond_to :css_cache_name
57
+ end
58
+
59
+ it "should respond_to generate_js_cache_name" do
60
+ @g.should respond_to :generate_js_cache_name
61
+ end
62
+
63
+ it "should respond_to generate_css_cache_name" do
64
+ @g.should respond_to :generate_css_cache_name
65
+ end
66
+
67
+ it "should respond_to combined_css_srcs" do
68
+ @g.should respond_to :combined_css_srcs
69
+ end
70
+
71
+ it "should respond_to combined_js_srcs" do
72
+ @g.should respond_to :combined_js_srcs
73
+ end
74
+
75
+ it "should respond_to initialized_at" do
76
+ @g.should respond_to :initialized_at
77
+ end
78
+
79
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe "Guilded" do
4
+
5
+ before(:each) do
6
+ @g = Guilded::Guilder.instance
7
+ end
8
+
9
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'guilded'
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: midas-guilded
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - midas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-01 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
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."
36
+ email:
37
+ - jaosn@lookforwardenterprises.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - History.txt
44
+ - Manifest.txt
45
+ - PostInstall.txt
46
+ - README.rdoc
47
+ files:
48
+ - History.txt
49
+ - Manifest.txt
50
+ - PostInstall.txt
51
+ - README.rdoc
52
+ - Rakefile
53
+ - init.rb
54
+ - lib/guilded.rb
55
+ - lib/guilded/base.rb
56
+ - lib/guilded/component_def.rb
57
+ - lib/guilded/exceptions.rb
58
+ - lib/guilded/guilder.rb
59
+ - lib/guilded/rails.rb
60
+ - lib/guilded/rails/view_helpers.rb
61
+ - script/console
62
+ - script/destroy
63
+ - script/generate
64
+ - spec/guilded/component_def_spec.rb
65
+ - spec/guilded/guilder_spec.rb
66
+ - spec/guilded_spec.rb
67
+ - spec/spec.opts
68
+ - spec/spec_helper.rb
69
+ - tasks/rspec.rake
70
+ has_rdoc: true
71
+ homepage: http://github.com/midas/guilded-base/tree/master
72
+ post_install_message: PostInstall.txt
73
+ rdoc_options:
74
+ - --main
75
+ - README.rdoc
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
83
+ version:
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ version:
90
+ requirements: []
91
+
92
+ rubyforge_project: guilded
93
+ rubygems_version: 1.2.0
94
+ signing_key:
95
+ specification_version: 2
96
+ summary: "Warning: This project just started and there are no releases available yet"
97
+ test_files: []
98
+