guilded 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ = 1.0.7 2010-02-19
2
+
3
+ * Updated view helpers and Guilder to adapt to usage in Rails 3.
4
+
5
+
1
6
  = 1.0.6 2010-02-18
2
7
 
3
8
  * Added Rails 3 compliant generators.
@@ -10,7 +10,7 @@ framework is written in ruby, but could be ported to other languages.
10
10
 
11
11
  Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is
12
12
  filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and
13
- are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability
13
+ are not accessible. Guilded seeks to provide the same level of componentization and ease of use without sacrificing degradability
14
14
  and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do
15
15
  as it was intended.
16
16
 
@@ -21,7 +21,7 @@ enabled in their browser, but will still be able to use the component when CSS a
21
21
  Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement
22
22
  due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly
23
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.
24
+ allow the jQuery or MooTools plugin to be used outside of the Guilded project, if desired.
25
25
 
26
26
  Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable.
27
27
 
@@ -117,13 +117,13 @@ have decided to include support for it in Guilded as of release 0.3.0.
117
117
 
118
118
  == INSTALL FOR RAILS
119
119
 
120
- Add to environment file:
120
+ Add to Gemfile file:
121
121
 
122
- config.gem "guilded", :version => '1.0.5', :source => 'http://gemcutter.org'
122
+ gem 'guilded', '1.0.7'
123
123
 
124
124
  Run:
125
125
 
126
- sudo rake:gems:install
126
+ bundle install
127
127
 
128
128
  Generate:
129
129
 
@@ -140,14 +140,18 @@ the respective file(s).
140
140
 
141
141
  === COMPONENT FRAMEWORK
142
142
 
143
- You must make a call to the view helper to apply the CSS It should be placed in your layout:
143
+ 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
144
+ escapes strings. It should be placed in your layout:
144
145
 
145
- <%= g_apply_style %>
146
+ <%= raw g_apply_style %>
146
147
 
147
- There is also a view helper to apply the JavaScript. You can place this at the bottom of your layout(s) (so you
148
+ There is also two view helpers to apply the JavaScript. You can place this at the bottom of your layout(s) (so you
148
149
  do not have to include it in every template):
149
150
 
150
- <%= g_apply_behavior %>
151
+ <%= raw g_apply_includes %>
152
+ <script type="text/javascript">
153
+ <%= raw g_apply_behavior %>
154
+ </script>
151
155
 
152
156
  A before filter is automatically set up in your application controller to reset the Guilded singleton that manages
153
157
  everything after each rendering. The code looks like this:
data/Rakefile CHANGED
@@ -18,13 +18,22 @@ rescue LoadError
18
18
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
19
19
  end
20
20
 
21
- require 'rake/testtask'
22
- Rake::TestTask.new(:test) do |test|
23
- test.libs << 'lib' << 'test'
24
- test.pattern = 'test/**/*_test.rb'
25
- test.verbose = true
21
+ require 'spec/rake/spectask'
22
+ Spec::Rake::SpecTask.new(:spec) do |spec|
23
+ spec.libs << 'lib' << 'spec'
24
+ spec.spec_files = FileList['spec/**/*_spec.rb']
26
25
  end
27
26
 
27
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
28
+ spec.libs << 'lib' << 'spec'
29
+ spec.pattern = 'spec/**/*_spec.rb'
30
+ spec.rcov = true
31
+ end
32
+
33
+ task :spec => :check_dependencies
34
+
35
+ task :default => :spec
36
+
28
37
  begin
29
38
  require 'rcov/rcovtask'
30
39
  Rcov::RcovTask.new do |test|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.6
1
+ 1.0.7
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{guilded}
8
- s.version = "1.0.6"
8
+ s.version = "1.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["C. Jason Harrelson (midas)"]
12
- s.date = %q{2010-02-18}
12
+ s.date = %q{2010-02-19}
13
13
  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.}
14
14
  s.email = %q{jason@lookforwardenterprises.com}
15
15
  s.extra_rdoc_files = [
@@ -50,13 +50,14 @@ Gem::Specification.new do |s|
50
50
  "script/console",
51
51
  "script/destroy",
52
52
  "script/generate",
53
+ "spec/guilded/component_def_spec.rb",
54
+ "spec/guilded/guilder_spec.rb",
55
+ "spec/guilded_spec.rb",
56
+ "spec/spec.opts",
57
+ "spec/spec_helper.rb",
53
58
  "tasks/rails.rake",
54
59
  "tasks/rspec.rake",
55
- "test/guilded/component_def_test.rb",
56
- "test/guilded/guilder_test.rb",
57
60
  "test/guilded/rails/helpers_test.rb",
58
- "test/guilded/rails/view_helpers_test.rb",
59
- "test/guilded_test.rb",
60
61
  "test/test_helper.rb"
61
62
  ]
62
63
  s.homepage = %q{http://github.com/midas/guilded}
@@ -65,11 +66,11 @@ Gem::Specification.new do |s|
65
66
  s.rubygems_version = %q{1.3.5}
66
67
  s.summary = %q{A framework for building web based components centered around current web standards and best practices.}
67
68
  s.test_files = [
68
- "test/guilded/component_def_test.rb",
69
- "test/guilded/guilder_test.rb",
69
+ "spec/guilded/component_def_spec.rb",
70
+ "spec/guilded/guilder_spec.rb",
71
+ "spec/guilded_spec.rb",
72
+ "spec/spec_helper.rb",
70
73
  "test/guilded/rails/helpers_test.rb",
71
- "test/guilded/rails/view_helpers_test.rb",
72
- "test/guilded_test.rb",
73
74
  "test/test_helper.rb"
74
75
  ]
75
76
 
@@ -73,7 +73,7 @@ require 'guilded/rails/inactive_record/human_attribute_hint'
73
73
  # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %>
74
74
  #
75
75
  module Guilded
76
- VERSION = '1.0.6'
76
+ VERSION = '1.0.7'
77
77
  end
78
78
 
79
79
  ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -158,15 +158,14 @@ module Guilded
158
158
  # method will exceute on document load finish.
159
159
  #
160
160
  def generate_javascript_init #:nodoc:
161
- code = "<script type=\"text/javascript\">"
162
- code << "var initGuildedElements = function(){"
161
+ code = "var initGuildedElements = function(){"
163
162
  @g_data_elements.each do |name, data|
164
163
  code << "g.#{name} = #{data.to_json};"
165
164
  end
166
165
  @g_elements.each_value do |guilded_def|
167
166
  code << "g.#{guilded_def.kind.to_s.camelize( :lower )}Init(#{guilded_def.options.to_json});" unless guilded_def.exclude_js?
168
167
  end
169
- code << "jQuery('body').trigger('guildedInitialized');};jQuery('document').ready(initGuildedElements);</script>"
168
+ code << "jQuery('body').trigger('guildedInitialized');};jQuery('document').ready(initGuildedElements);"
170
169
  end
171
170
 
172
171
  # Generates a name to use when caching the current set of Guilded component JavaScript assets. Sorts and concatenates
@@ -2,35 +2,33 @@ module Guilded
2
2
  module Rails
3
3
  module ViewHelpers
4
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.
5
+ # Generates the initGuildedElements function and includes a call to each GUIlded
6
+ # element(s) Init method.
8
7
  #
9
8
  # Must be called once per rendered page. You can include it just before the closing body
10
9
  # tag of your application layout. If no Guilded elements were called in the template, the
11
10
  # call to g_apply_behavior will not output anything.
12
11
  #
13
12
  def g_apply_behavior
13
+ Guilded::Guilder.instance.generate_javascript_init
14
+ end
15
+
16
+ # Generates the JavaScript include(s) for each Guilded element that is used.
17
+ #
18
+ # Must be called once per rendered page. You can include it just before the closing body
19
+ # tag of your application layout. If no Guilded elements were called in the template, the
20
+ # call to g_apply_includes will not output anything.
21
+ #
22
+ def g_apply_includes
14
23
  g = Guilded::Guilder.instance
15
24
  g.generate_asset_lists
16
25
  self.output_buffer.sub!( /<!-- guilded.styles -->/, stylesheet_link_tag( g.combined_css_srcs, :cache => "cache/#{g.css_cache_name}" ) )
17
- html = javascript_include_tag( g.combined_js_srcs, :cache => "cache/#{g.js_cache_name}" )
18
- html << g.generate_javascript_init
19
- html
26
+ javascript_include_tag( g.combined_js_srcs, :cache => "cache/#{g.js_cache_name}" )
20
27
  end
21
28
 
22
29
  def g_apply_style
23
30
  "<!-- guilded.styles -->"
24
31
  end
25
-
26
- # Generates the base javascript includes, if they have not alreay been included.
27
- #
28
- # def g_includes
29
- # return "" if @base_included
30
- # @base_included = true
31
- # javascript_include_tag( 'jquery/jquery-1.2.6.min.js' ) +
32
- # "<script type=\"text/javascript\">$j = jQuery.noConflict(); g={};</script>"
33
- # end
34
32
 
35
33
  # Creates a javascript include tag for a Guilded specific file. The only difference
36
34
  # being that it adds the file to a sources array to be concatenated and included at the
@@ -0,0 +1,24 @@
1
+ require File.expand_path( File.join( File.dirname(__FILE__), '..', 'spec_helper' ) )
2
+
3
+ describe Guilded::ComponentDef do
4
+ before :each do
5
+ @cd = Guilded::ComponentDef.new( 'grid' )
6
+ @cd_exclude = Guilded::ComponentDef.new( 'grid', { :exclude_css => true, :exclude_js => true } )
7
+ end
8
+
9
+ it "should exclude css if specified" do
10
+ @cd_exclude.exclude_css?.should be_true
11
+ end
12
+
13
+ it "should exclude js if specified" do
14
+ @cd_exclude.exclude_js?.should be_true
15
+ end
16
+
17
+ it "should not exclude css unless specified" do
18
+ @cd.exclude_css?.should be_false
19
+ end
20
+
21
+ it "should not exclude js unless specified" do
22
+ @cd.exclude_js?.should be_false
23
+ end
24
+ end
@@ -0,0 +1,77 @@
1
+ require File.expand_path( File.join( File.dirname(__FILE__), '..', 'spec_helper' ) )
2
+
3
+ describe Guilded::Guilder do
4
+ before :each do
5
+ @g = Guilded::Guilder.instance
6
+ end
7
+
8
+ it "should return an instance" do
9
+ @g.should_not be_nil
10
+ end
11
+
12
+ it "should be a singleton" do
13
+ @g.initialized_at.should eql( Guilded::Guilder.instance.initialized_at )
14
+ end
15
+
16
+ it "should have 1 css source after init" do
17
+ @g.combined_css_srcs.size.should eql( 1 )
18
+ end
19
+
20
+ it "should have 3 js sources after init" do
21
+ @g.combined_js_srcs.size.should eql( 3 )
22
+ end
23
+
24
+ it "should increase count by one when you add a component" do
25
+ count = @g.count
26
+ @g.add( 'grid', { :id => 'grid' } )
27
+ @g.count.should eql( count + 1 )
28
+ end
29
+
30
+ it "should respond to add" do
31
+ @g.respond_to?( :add ).should be_true
32
+ end
33
+
34
+ it "should respond to count" do
35
+ @g.respond_to?( :count ).should be_true
36
+ end
37
+
38
+ it "should respond to reset!" do
39
+ @g.respond_to?( :reset! ).should be_true
40
+ end
41
+
42
+ it "should respond to apply" do
43
+ @g.respond_to?( :apply ).should be_true
44
+ end
45
+
46
+ it "should respond to generate_javascript_init" do
47
+ @g.respond_to?( :generate_javascript_init ).should be_true
48
+ end
49
+
50
+ it "should respond_to js_cache_name" do
51
+ @g.respond_to?( :js_cache_name ).should be_true
52
+ end
53
+
54
+ it "should respond_to css_cache_name" do
55
+ @g.respond_to?( :css_cache_name ).should be_true
56
+ end
57
+
58
+ it "should respond_to generate_js_cache_name" do
59
+ @g.respond_to?( :generate_js_cache_name ).should be_true
60
+ end
61
+
62
+ it "should respond_to generate_css_cache_name" do
63
+ @g.respond_to?( :generate_css_cache_name ).should be_true
64
+ end
65
+
66
+ it "should respond_to combined_css_srcs" do
67
+ @g.respond_to?( :combined_css_srcs ).should be_true
68
+ end
69
+
70
+ it "should respond_to combined_js_srcs" do
71
+ @g.respond_to?( :combined_js_srcs ).should be_true
72
+ end
73
+
74
+ it "should respond_to initialized_at" do
75
+ @g.respond_to?( :initialized_at ).should be_true
76
+ end
77
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path( File.dirname(__FILE__) + '/spec_helper' )
2
+
3
+ describe Guilded do
4
+ it "should be true" do
5
+ true.should be_true
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.unshift( File.dirname(__FILE__) )
2
+ $LOAD_PATH.unshift( File.join( File.dirname(__FILE__), '..', 'lib' ) )
3
+ require 'rubygems'
4
+ require 'guilded'
5
+ require 'spec'
6
+ require 'spec/autorun'
7
+
8
+ Spec::Runner.configure do |config|
9
+
10
+ end
11
+
12
+ RAILS_ROOT = ''
13
+ GUILDED_CONFIG = {
14
+ :js_path => "#{RAILS_ROOT}/public/javascripts/",
15
+ :js_folder => "", # from the js_path
16
+ :jquery_js => "jquery/jquery-1.3.2.min.js", # from the js_path
17
+ :css_path => "#{RAILS_ROOT}/public/stylesheets/",
18
+ :css_folder => "guilded/", # from the css_path
19
+ :reset_css => "reset-min.css", # from the css_path
20
+ :environment => 'development'
21
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guilded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas)
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-18 00:00:00 -06:00
12
+ date: 2010-02-19 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -75,13 +75,14 @@ files:
75
75
  - script/console
76
76
  - script/destroy
77
77
  - script/generate
78
+ - spec/guilded/component_def_spec.rb
79
+ - spec/guilded/guilder_spec.rb
80
+ - spec/guilded_spec.rb
81
+ - spec/spec.opts
82
+ - spec/spec_helper.rb
78
83
  - tasks/rails.rake
79
84
  - tasks/rspec.rake
80
- - test/guilded/component_def_test.rb
81
- - test/guilded/guilder_test.rb
82
85
  - test/guilded/rails/helpers_test.rb
83
- - test/guilded/rails/view_helpers_test.rb
84
- - test/guilded_test.rb
85
86
  - test/test_helper.rb
86
87
  has_rdoc: true
87
88
  homepage: http://github.com/midas/guilded
@@ -112,9 +113,9 @@ signing_key:
112
113
  specification_version: 3
113
114
  summary: A framework for building web based components centered around current web standards and best practices.
114
115
  test_files:
115
- - test/guilded/component_def_test.rb
116
- - test/guilded/guilder_test.rb
116
+ - spec/guilded/component_def_spec.rb
117
+ - spec/guilded/guilder_spec.rb
118
+ - spec/guilded_spec.rb
119
+ - spec/spec_helper.rb
117
120
  - test/guilded/rails/helpers_test.rb
118
- - test/guilded/rails/view_helpers_test.rb
119
- - test/guilded_test.rb
120
121
  - test/test_helper.rb
@@ -1,26 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ComponentDefTest < Test::Unit::TestCase
4
- context "The ComponentDef" do
5
- setup do
6
- @cd = Guilded::ComponentDef.new( 'grid' )
7
- @cd_exclude = Guilded::ComponentDef.new( 'grid', { :exclude_css => true, :exclude_js => true } )
8
- end
9
-
10
- should "exclude css if specified" do
11
- assert @cd_exclude.exclude_css?
12
- end
13
-
14
- should "exclude js if specified" do
15
- assert @cd_exclude.exclude_js?
16
- end
17
-
18
- should "not exclude css unless specified" do
19
- assert !@cd.exclude_css?
20
- end
21
-
22
- should "not exclude js unless specified" do
23
- assert !@cd.exclude_js?
24
- end
25
- end
26
- end
@@ -1,79 +0,0 @@
1
- require 'test_helper'
2
-
3
- class GuilderTest < Test::Unit::TestCase
4
- context "The Guilder" do
5
- setup do
6
- @g = Guilded::Guilder.instance
7
- end
8
-
9
- should "return an instance" do
10
- assert_not_nil @g
11
- end
12
-
13
- should "be a singleton" do
14
- assert_equal @g.initialized_at, Guilded::Guilder.instance.initialized_at
15
- end
16
-
17
- should "have 1 css source after init" do
18
- assert_equal @g.combined_css_srcs.size, 1
19
- end
20
-
21
- should "have 3 js sources after init" do
22
- assert_equal @g.combined_js_srcs.size, 3
23
- end
24
-
25
- should "increase count by one when you add a component" do
26
- count = @g.count
27
- @g.add( 'grid', { :id => 'grid' } )
28
- assert_equal @g.count, count + 1
29
- end
30
-
31
- should "respond to add" do
32
- assert @g.respond_to? :add
33
- end
34
-
35
- should "respond to count" do
36
- assert @g.respond_to? :count
37
- end
38
-
39
- should "respond to reset!" do
40
- assert @g.respond_to? :reset!
41
- end
42
-
43
- should "respond to apply" do
44
- assert @g.respond_to? :apply
45
- end
46
-
47
- should "respond to generate_javascript_init" do
48
- assert @g.respond_to? :generate_javascript_init
49
- end
50
-
51
- should "respond_to js_cache_name" do
52
- assert @g.respond_to? :js_cache_name
53
- end
54
-
55
- should "respond_to css_cache_name" do
56
- assert @g.respond_to? :css_cache_name
57
- end
58
-
59
- should "respond_to generate_js_cache_name" do
60
- assert @g.respond_to? :generate_js_cache_name
61
- end
62
-
63
- should "respond_to generate_css_cache_name" do
64
- assert @g.respond_to? :generate_css_cache_name
65
- end
66
-
67
- should "respond_to combined_css_srcs" do
68
- assert @g.respond_to? :combined_css_srcs
69
- end
70
-
71
- should "respond_to combined_js_srcs" do
72
- assert @g.respond_to? :combined_js_srcs
73
- end
74
-
75
- should "respond_to initialized_at" do
76
- assert @g.respond_to? :initialized_at
77
- end
78
- end
79
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ViewHelpersTest < Test::Unit::TestCase
4
-
5
- should "be true" do
6
- assert true
7
- end
8
-
9
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class GuildedTest < Test::Unit::TestCase
4
- should "be true" do
5
- assert true
6
- end
7
- end