rails-styleguide 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-styleguide (0.0.3)
4
+ rails-styleguide (0.0.4)
5
5
  kss
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -2,12 +2,23 @@ class StyleguideController < ActionController::Base
2
2
  extend ActiveSupport::Memoizable
3
3
  layout "styleguide"
4
4
 
5
+ ##
6
+ # Set up the stylesheets configuration
5
7
  def self.initialize_stylesheets_path_config
6
8
  self.config.stylesheets_path ||= {}
7
9
  self.config.stylesheets_path[:default] ||= File.join(Rails.root, Rails.application.paths["app/assets"], "stylesheets")
8
10
  end
9
11
  self.initialize_stylesheets_path_config
10
12
 
13
+ ##
14
+ # TODO: write an index view for configured styleguides
15
+ #def index
16
+ #
17
+ #end
18
+
19
+ ##
20
+ # Show a styleguide
21
+ #
11
22
  def show
12
23
  id = params[:id]
13
24
  id ||= :default
@@ -20,15 +31,19 @@ class StyleguideController < ActionController::Base
20
31
  end
21
32
 
22
33
  protected
34
+ ##
35
+ # Return the directory path for a given path id
23
36
  def stylesheets_path id
24
37
  config = self.class.config.stylesheets_path[id.to_sym]
25
- raise RoutingError unless config
38
+ raise ActionController::RoutingError.new('Not Found') unless config
26
39
  config
27
40
  end
28
41
 
42
+ ##
43
+ # Get the Kss-parsed styleguide
29
44
  def styleguide id
30
45
  path = stylesheets_path(id)
31
- @styleguide = Kss::Parser.new(path)
46
+ Kss::Parser.new(path)
32
47
  end
33
48
  memoize :styleguide
34
49
 
@@ -1,4 +1,6 @@
1
1
  module StyleguideHelper
2
+ ##
3
+ # Render a styleguide block
2
4
  def styleguide_block section, styleguide = @styleguide, &block
3
5
  section = styleguide.section section
4
6
 
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe StyleguideController do
4
+ before(:each) { @routes = Styleguide::Engine.routes }
5
+ describe ".initialize_stylesheets_path_config" do
6
+ it "should have a configuration key" do
7
+ StyleguideController.config.stylesheets_path.should be_a_kind_of(Hash)
8
+ end
9
+
10
+ it "should have a default key (that corresponds to the rails asset pipeline stylesheets directory)" do
11
+ StyleguideController.config.stylesheets_path[:default].should be_ends_with('dummy/app/assets/stylesheets')
12
+ end
13
+ end
14
+
15
+ describe "#show" do
16
+ it "should raise an error for an unknown styleguide id" do
17
+ expect { get 'show', :id => 'asdf' }.to raise_error(ActionController::RoutingError)
18
+ end
19
+
20
+ end
21
+
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-styleguide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: kss
16
- requirement: &2164338760 !ruby/object:Gem::Requirement
16
+ requirement: &2152205560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164338760
24
+ version_requirements: *2152205560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2164352320 !ruby/object:Gem::Requirement
27
+ requirement: &2152232820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2164352320
35
+ version_requirements: *2152232820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &2164349680 !ruby/object:Gem::Requirement
38
+ requirement: &2152249240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164349680
46
+ version_requirements: *2152249240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: capybara
49
- requirement: &2164362420 !ruby/object:Gem::Requirement
49
+ requirement: &2152246040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164362420
57
+ version_requirements: *2152246040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rails
60
- requirement: &2164358500 !ruby/object:Gem::Requirement
60
+ requirement: &2152242920 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 3.1.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164358500
68
+ version_requirements: *2152242920
69
69
  description: Insert Styleguide description.
70
70
  email:
71
71
  executables: []
@@ -93,6 +93,7 @@ files:
93
93
  - lib/styleguide/engine.rb
94
94
  - lib/styleguide/version.rb
95
95
  - rails-styleguide.gemspec
96
+ - spec/controllers/styleguide_controller_spec.rb
96
97
  - spec/dummy/.gitignore
97
98
  - spec/dummy/Gemfile
98
99
  - spec/dummy/Gemfile.lock
@@ -154,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
155
  version: '0'
155
156
  segments:
156
157
  - 0
157
- hash: 3873801164108943302
158
+ hash: -1627009980639500578
158
159
  required_rubygems_version: !ruby/object:Gem::Requirement
159
160
  none: false
160
161
  requirements:
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
164
  version: '0'
164
165
  segments:
165
166
  - 0
166
- hash: 3873801164108943302
167
+ hash: -1627009980639500578
167
168
  requirements: []
168
169
  rubyforge_project:
169
170
  rubygems_version: 1.8.10