rails-styleguide 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-styleguide (0.0.1)
4
+ rails-styleguide (0.0.2)
5
5
  kss
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -6,6 +6,7 @@ documentation methodology.
6
6
  ## Installation
7
7
 
8
8
  Add the engine to your `Gemfile`:
9
+
9
10
  ```ruby
10
11
  gem "rails-styleguide"
11
12
  ```
@@ -16,9 +17,9 @@ Configure the route to the engine:
16
17
  mount Styleguide::Engine => "/styleguide"
17
18
  ```
18
19
 
19
- Visit http://localhost:3000/styleguide
20
+ Visit [http://localhost:3000/styleguide](http://localhost:3000/styleguide)
20
21
 
21
- Customize app/views/styleguide/index.html.erb to build your own
22
- styleguide
22
+ Override [`app/views/styleguide/index.html.erb`](https://github.com/cbeer/rails-styleguide/blob/master/app/views/styleguide/index.html.erb) in your local application to build your own
23
+ styleguide.
23
24
 
24
25
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,10 +1,33 @@
1
1
  class StyleguideController < ActionController::Base
2
- helper_method :stylegude
2
+ extend ActiveSupport::Memoizable
3
3
  layout "styleguide"
4
4
 
5
- def index
5
+ def self.initialize_stylesheets_path_config
6
+ self.config.stylesheets_path ||= {}
7
+ self.config.stylesheets_path[:default] ||= File.join(Rails.root, Rails.application.paths["app/assets"], "stylesheets")
8
+ end
9
+ self.initialize_stylesheets_path_config
10
+
11
+ def show
12
+ id = params[:id]
13
+ id ||= :default
14
+
15
+ @styleguide = styleguide(id)
16
+
6
17
  respond_to do |format|
7
- format.html
18
+ format.html { render id.to_s }
8
19
  end
9
20
  end
21
+
22
+ protected
23
+ def stylesheets_path id
24
+ self.class.config.stylesheets_path[id.to_sym]
25
+ end
26
+
27
+ def styleguide id
28
+ path = stylesheets_path(id)
29
+ @styleguide = Kss::Parser.new(path)
30
+ end
31
+ memoize :styleguide
32
+
10
33
  end
@@ -1,11 +1,7 @@
1
1
  module StyleguideHelper
2
- def styleguide_block section, &block
2
+ def styleguide_block section, styleguide = @styleguide, &block
3
3
  section = styleguide.section section
4
4
 
5
5
  render :partial => 'styleguide/block', :locals => { :section => section, :example_html => capture(&block) }
6
6
  end
7
-
8
- def styleguide
9
- @styleguide ||= Kss::Parser.new(File.join(Rails.root, Rails.application.paths["app/assets"], "stylesheets"))
10
- end
11
7
  end
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  Styleguide::Engine.routes.draw do
2
- root :to => "styleguide#index"
2
+ root :to => "styleguide#show"
3
+
4
+ match ":id", :to => "styleguide#show"
3
5
  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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-06 00:00:00.000000000 Z
12
+ date: 2011-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: kss
16
- requirement: &2164417200 !ruby/object:Gem::Requirement
16
+ requirement: &2152077300 !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: *2164417200
24
+ version_requirements: *2152077300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2164415700 !ruby/object:Gem::Requirement
27
+ requirement: &2152087160 !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: *2164415700
35
+ version_requirements: *2152087160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &2164481160 !ruby/object:Gem::Requirement
38
+ requirement: &2152101120 !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: *2164481160
46
+ version_requirements: *2152101120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: capybara
49
- requirement: &2164480460 !ruby/object:Gem::Requirement
49
+ requirement: &2152098040 !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: *2164480460
57
+ version_requirements: *2152098040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rails
60
- requirement: &2164479480 !ruby/object:Gem::Requirement
60
+ requirement: &2152094860 !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: *2164479480
68
+ version_requirements: *2152094860
69
69
  description: Insert Styleguide description.
70
70
  email:
71
71
  executables: []
@@ -86,7 +86,7 @@ files:
86
86
  - app/helpers/styleguide_helper.rb
87
87
  - app/views/layouts/styleguide.html.erb
88
88
  - app/views/styleguide/_block.html.erb
89
- - app/views/styleguide/index.html.erb
89
+ - app/views/styleguide/default.html.erb
90
90
  - config/routes.rb
91
91
  - lib/rails-styleguide.rb
92
92
  - lib/styleguide.rb
@@ -154,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  segments:
156
156
  - 0
157
- hash: -4261689766366464210
157
+ hash: -1655197750271359101
158
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  none: false
160
160
  requirements:
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  segments:
165
165
  - 0
166
- hash: -4261689766366464210
166
+ hash: -1655197750271359101
167
167
  requirements: []
168
168
  rubyforge_project:
169
169
  rubygems_version: 1.8.10