rails-styleguide 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +153 -0
- data/MIT-LICENSE +20 -0
- data/README.md +24 -0
- data/Rakefile +27 -0
- data/VERSION +1 -0
- data/app/assets/javascripts/kss.js +40 -0
- data/app/assets/javascripts/styleguide.js +1 -0
- data/app/assets/stylesheets/styleguide.css +140 -0
- data/app/controllers/styleguide_controller.rb +10 -0
- data/app/helpers/styleguide_helper.rb +11 -0
- data/app/views/layouts/styleguide.html.erb +24 -0
- data/app/views/styleguide/_block.html.erb +24 -0
- data/app/views/styleguide/index.html.erb +13 -0
- data/config/routes.rb +3 -0
- data/lib/rails-styleguide.rb +3 -0
- data/lib/styleguide.rb +5 -0
- data/lib/styleguide/engine.rb +5 -0
- data/lib/styleguide/version.rb +11 -0
- data/rails-styleguide.gemspec +21 -0
- data/spec/dummy/.gitignore +15 -0
- data/spec/dummy/Gemfile +31 -0
- data/spec/dummy/Gemfile.lock +117 -0
- data/spec/dummy/README +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +8 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/assets/stylesheets/buttons.css +50 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +54 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +10 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/doc/README_FOR_APP +2 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +241 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/dummy/vendor/plugins/.gitkeep +0 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/integration/styleguide_spec.rb +31 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/styleguide_spec.rb +7 -0
- metadata +173 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'rails', '3.1.2'
|
6
|
+
|
7
|
+
# Gems used only for assets and not required
|
8
|
+
# in production environments by default.
|
9
|
+
group :assets do
|
10
|
+
gem 'sass-rails', '~> 3.1.5.rc.2'
|
11
|
+
gem 'coffee-rails', '~> 3.1.1'
|
12
|
+
gem 'uglifier', '>= 1.0.3'
|
13
|
+
end
|
14
|
+
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails-styleguide (0.0.1)
|
5
|
+
kss
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.1.2)
|
11
|
+
actionpack (= 3.1.2)
|
12
|
+
mail (~> 2.3.0)
|
13
|
+
actionpack (3.1.2)
|
14
|
+
activemodel (= 3.1.2)
|
15
|
+
activesupport (= 3.1.2)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
rack (~> 1.3.5)
|
20
|
+
rack-cache (~> 1.1)
|
21
|
+
rack-mount (~> 0.8.2)
|
22
|
+
rack-test (~> 0.6.1)
|
23
|
+
sprockets (~> 2.1.0)
|
24
|
+
activemodel (3.1.2)
|
25
|
+
activesupport (= 3.1.2)
|
26
|
+
builder (~> 3.0.0)
|
27
|
+
i18n (~> 0.6)
|
28
|
+
activerecord (3.1.2)
|
29
|
+
activemodel (= 3.1.2)
|
30
|
+
activesupport (= 3.1.2)
|
31
|
+
arel (~> 2.2.1)
|
32
|
+
tzinfo (~> 0.3.29)
|
33
|
+
activeresource (3.1.2)
|
34
|
+
activemodel (= 3.1.2)
|
35
|
+
activesupport (= 3.1.2)
|
36
|
+
activesupport (3.1.2)
|
37
|
+
multi_json (~> 1.0)
|
38
|
+
arel (2.2.1)
|
39
|
+
builder (3.0.0)
|
40
|
+
capybara (1.1.2)
|
41
|
+
mime-types (>= 1.16)
|
42
|
+
nokogiri (>= 1.3.3)
|
43
|
+
rack (>= 1.0.0)
|
44
|
+
rack-test (>= 0.5.4)
|
45
|
+
selenium-webdriver (~> 2.0)
|
46
|
+
xpath (~> 0.1.4)
|
47
|
+
childprocess (0.2.3)
|
48
|
+
ffi (~> 1.0.6)
|
49
|
+
coffee-rails (3.1.1)
|
50
|
+
coffee-script (>= 2.2.0)
|
51
|
+
railties (~> 3.1.0)
|
52
|
+
coffee-script (2.2.0)
|
53
|
+
coffee-script-source
|
54
|
+
execjs
|
55
|
+
coffee-script-source (1.1.3)
|
56
|
+
diff-lcs (1.1.3)
|
57
|
+
erubis (2.7.0)
|
58
|
+
execjs (1.2.11)
|
59
|
+
multi_json (~> 1.0)
|
60
|
+
ffi (1.0.11)
|
61
|
+
hike (1.2.1)
|
62
|
+
i18n (0.6.0)
|
63
|
+
json (1.6.3)
|
64
|
+
kss (0.1.1)
|
65
|
+
sass (>= 3.1)
|
66
|
+
mail (2.3.0)
|
67
|
+
i18n (>= 0.4.0)
|
68
|
+
mime-types (~> 1.16)
|
69
|
+
treetop (~> 1.4.8)
|
70
|
+
mime-types (1.17.2)
|
71
|
+
multi_json (1.0.4)
|
72
|
+
nokogiri (1.5.0)
|
73
|
+
polyglot (0.3.3)
|
74
|
+
rack (1.3.5)
|
75
|
+
rack-cache (1.1)
|
76
|
+
rack (>= 0.4)
|
77
|
+
rack-mount (0.8.3)
|
78
|
+
rack (>= 1.0.0)
|
79
|
+
rack-ssl (1.3.2)
|
80
|
+
rack
|
81
|
+
rack-test (0.6.1)
|
82
|
+
rack (>= 1.0)
|
83
|
+
rails (3.1.2)
|
84
|
+
actionmailer (= 3.1.2)
|
85
|
+
actionpack (= 3.1.2)
|
86
|
+
activerecord (= 3.1.2)
|
87
|
+
activeresource (= 3.1.2)
|
88
|
+
activesupport (= 3.1.2)
|
89
|
+
bundler (~> 1.0)
|
90
|
+
railties (= 3.1.2)
|
91
|
+
railties (3.1.2)
|
92
|
+
actionpack (= 3.1.2)
|
93
|
+
activesupport (= 3.1.2)
|
94
|
+
rack-ssl (~> 1.3.2)
|
95
|
+
rake (>= 0.8.7)
|
96
|
+
rdoc (~> 3.4)
|
97
|
+
thor (~> 0.14.6)
|
98
|
+
rake (0.9.2.2)
|
99
|
+
rdoc (3.11)
|
100
|
+
json (~> 1.4)
|
101
|
+
rspec (2.7.0)
|
102
|
+
rspec-core (~> 2.7.0)
|
103
|
+
rspec-expectations (~> 2.7.0)
|
104
|
+
rspec-mocks (~> 2.7.0)
|
105
|
+
rspec-core (2.7.1)
|
106
|
+
rspec-expectations (2.7.0)
|
107
|
+
diff-lcs (~> 1.1.2)
|
108
|
+
rspec-mocks (2.7.0)
|
109
|
+
rspec-rails (2.7.0)
|
110
|
+
actionpack (~> 3.0)
|
111
|
+
activesupport (~> 3.0)
|
112
|
+
railties (~> 3.0)
|
113
|
+
rspec (~> 2.7.0)
|
114
|
+
rubyzip (0.9.5)
|
115
|
+
sass (3.1.11)
|
116
|
+
sass-rails (3.1.5)
|
117
|
+
actionpack (~> 3.1.0)
|
118
|
+
railties (~> 3.1.0)
|
119
|
+
sass (~> 3.1.10)
|
120
|
+
tilt (~> 1.3.2)
|
121
|
+
selenium-webdriver (2.14.0)
|
122
|
+
childprocess (>= 0.2.1)
|
123
|
+
ffi (~> 1.0.9)
|
124
|
+
multi_json (~> 1.0.4)
|
125
|
+
rubyzip
|
126
|
+
sprockets (2.1.2)
|
127
|
+
hike (~> 1.2)
|
128
|
+
rack (~> 1.0)
|
129
|
+
tilt (~> 1.1, != 1.3.0)
|
130
|
+
thor (0.14.6)
|
131
|
+
tilt (1.3.3)
|
132
|
+
treetop (1.4.10)
|
133
|
+
polyglot
|
134
|
+
polyglot (>= 0.3.1)
|
135
|
+
tzinfo (0.3.31)
|
136
|
+
uglifier (1.1.0)
|
137
|
+
execjs (>= 0.3.0)
|
138
|
+
multi_json (>= 1.0.2)
|
139
|
+
xpath (0.1.4)
|
140
|
+
nokogiri (~> 1.3)
|
141
|
+
|
142
|
+
PLATFORMS
|
143
|
+
ruby
|
144
|
+
|
145
|
+
DEPENDENCIES
|
146
|
+
capybara
|
147
|
+
coffee-rails (~> 3.1.1)
|
148
|
+
rails (= 3.1.2)
|
149
|
+
rails-styleguide!
|
150
|
+
rspec
|
151
|
+
rspec-rails
|
152
|
+
sass-rails (~> 3.1.5.rc.2)
|
153
|
+
uglifier (>= 1.0.3)
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Rails-Styleguide
|
2
|
+
|
3
|
+
This is a Rails 3.1 mountable Engine version of kneath/kss, a CSS
|
4
|
+
documentation methodology.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add the engine to your `Gemfile`:
|
9
|
+
```ruby
|
10
|
+
gem "rails-styleguide"
|
11
|
+
```
|
12
|
+
|
13
|
+
Configure the route to the engine:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
mount Styleguide::Engine => "/styleguide"
|
17
|
+
```
|
18
|
+
|
19
|
+
Visit http://localhost:3000/styleguide
|
20
|
+
|
21
|
+
Customize app/views/styleguide/index.html.erb to build your own
|
22
|
+
styleguide
|
23
|
+
|
24
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'bundler/setup'
|
6
|
+
rescue LoadError
|
7
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
8
|
+
end
|
9
|
+
Bundler::GemHelper.install_tasks
|
10
|
+
|
11
|
+
require 'rake'
|
12
|
+
require 'rdoc/task'
|
13
|
+
|
14
|
+
require 'rspec/core'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
|
17
|
+
RSpec::Core::RakeTask.new(:spec)
|
18
|
+
|
19
|
+
task :default => :spec
|
20
|
+
|
21
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
22
|
+
rdoc.rdoc_dir = 'rdoc'
|
23
|
+
rdoc.title = 'Styleguide'
|
24
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
25
|
+
rdoc.rdoc_files.include('README.rdoc')
|
26
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
27
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,40 @@
|
|
1
|
+
// Generated from lib/kss.coffee
|
2
|
+
(function() {
|
3
|
+
var KssStateGenerator;
|
4
|
+
KssStateGenerator = (function() {
|
5
|
+
function KssStateGenerator() {
|
6
|
+
var disabled, hover, idx, idxs, rule, stylesheet, _i, _len, _len2, _ref, _ref2;
|
7
|
+
hover = /:hover/;
|
8
|
+
disabled = /:disabled/;
|
9
|
+
try {
|
10
|
+
_ref = document.styleSheets;
|
11
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
12
|
+
stylesheet = _ref[_i];
|
13
|
+
idxs = [];
|
14
|
+
_ref2 = stylesheet.cssRules;
|
15
|
+
for (idx = 0, _len2 = _ref2.length; idx < _len2; idx++) {
|
16
|
+
rule = _ref2[idx];
|
17
|
+
if (rule.type === CSSRule.STYLE_RULE && (hover.test(rule.selectorText) || disabled.test(rule.selectorText))) {
|
18
|
+
this.insertRule(rule.cssText.replace(':', '.pseudo-class-'));
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
} catch (_e) {}
|
23
|
+
}
|
24
|
+
KssStateGenerator.prototype.insertRule = function(rule) {
|
25
|
+
var headEl, styleEl;
|
26
|
+
headEl = document.getElementsByTagName('head')[0];
|
27
|
+
styleEl = document.createElement('style');
|
28
|
+
styleEl.type = 'text/css';
|
29
|
+
if (styleEl.styleSheet) {
|
30
|
+
styleEl.styleSheet.cssText = rule;
|
31
|
+
} else {
|
32
|
+
styleEl.appendChild(document.createTextNode(rule));
|
33
|
+
}
|
34
|
+
return headEl.appendChild(styleEl);
|
35
|
+
};
|
36
|
+
return KssStateGenerator;
|
37
|
+
})();
|
38
|
+
new KssStateGenerator;
|
39
|
+
}).call(this);
|
40
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/*----------------------------------------------------------------------------
|
2
|
+
@group Global Reset
|
3
|
+
----------------------------------------------------------------------------*/
|
4
|
+
* {
|
5
|
+
padding:0;
|
6
|
+
margin:0;
|
7
|
+
}
|
8
|
+
h1, h2, h3, h4, h5, h6, p, pre, blockquote, label, ul, ol, dl, fieldset, address { margin:1em 0; }
|
9
|
+
li, dd { margin-left:5%; }
|
10
|
+
fieldset { padding: .5em; }
|
11
|
+
select option{ padding:0 5px; }
|
12
|
+
|
13
|
+
.access{ display:none; } /* For accessibility related elements */
|
14
|
+
.clear{ clear:both; height:0px; font-size:0px; line-height:0px; overflow:hidden; }
|
15
|
+
a{ outline:none; }
|
16
|
+
a img{ border:none; }
|
17
|
+
|
18
|
+
.clearfix:after {
|
19
|
+
content: ".";
|
20
|
+
display: block;
|
21
|
+
height: 0;
|
22
|
+
clear: both;
|
23
|
+
visibility: hidden;
|
24
|
+
}
|
25
|
+
* html .clearfix {height: 1%;}
|
26
|
+
.clearfix {display:inline-block;}
|
27
|
+
.clearfix {display: block;}
|
28
|
+
|
29
|
+
/* @end */
|
30
|
+
|
31
|
+
body{
|
32
|
+
font-family:Helvetica, Arial, sans-serif;
|
33
|
+
font-size:14px;
|
34
|
+
}
|
35
|
+
|
36
|
+
header{
|
37
|
+
padding:10px;
|
38
|
+
|
39
|
+
font-size:16px;
|
40
|
+
color:#666;
|
41
|
+
|
42
|
+
background:#f1f1f1;
|
43
|
+
border-bottom:1px solid #ddd;
|
44
|
+
}
|
45
|
+
|
46
|
+
#wrapper{
|
47
|
+
width:600px;
|
48
|
+
padding-left:200px;
|
49
|
+
}
|
50
|
+
|
51
|
+
nav[role=main]{
|
52
|
+
float:left;
|
53
|
+
margin-left:-200px;
|
54
|
+
width:160px;
|
55
|
+
}
|
56
|
+
nav ul{
|
57
|
+
margin-left:10px;
|
58
|
+
}
|
59
|
+
nav li{
|
60
|
+
list-style-type:none;
|
61
|
+
margin:10px 0;
|
62
|
+
}
|
63
|
+
nav li a{
|
64
|
+
text-decoration:none;
|
65
|
+
color:#666;
|
66
|
+
}
|
67
|
+
|
68
|
+
/*----------------------------------------------------------------------------
|
69
|
+
@group Styleguide Styles
|
70
|
+
----------------------------------------------------------------------------*/
|
71
|
+
|
72
|
+
h1.styleguide {
|
73
|
+
margin: 0 0 -5px 0;
|
74
|
+
font-size: 24px;
|
75
|
+
color: #000; }
|
76
|
+
|
77
|
+
.styleguide-example {
|
78
|
+
margin: 15px 0;
|
79
|
+
background: rgba(255, 255, 255, 0.5);
|
80
|
+
border: 1px solid #ddd;
|
81
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); }
|
82
|
+
.styleguide-example > h3 {
|
83
|
+
margin: 0;
|
84
|
+
padding: 5px;
|
85
|
+
color: #fff;
|
86
|
+
font-size: 12px;
|
87
|
+
text-transform: uppercase;
|
88
|
+
background: #333;
|
89
|
+
border-top: 1px solid #000; }
|
90
|
+
.styleguide-example > h3 em {
|
91
|
+
float: right;
|
92
|
+
text-transform: none;
|
93
|
+
font-style: normal;
|
94
|
+
font-weight: normal;
|
95
|
+
color: #999; }
|
96
|
+
.styleguide-example .styleguide-description {
|
97
|
+
padding: 10px 5px;
|
98
|
+
background: #f1f1f1;
|
99
|
+
border-bottom: 1px solid #ddd; }
|
100
|
+
.styleguide-example .styleguide-description p:first-child {
|
101
|
+
margin-top: 0; }
|
102
|
+
.styleguide-example .styleguide-description p:last-child {
|
103
|
+
margin-bottom: 0; }
|
104
|
+
.styleguide-example .styleguide-element {
|
105
|
+
position: relative;
|
106
|
+
padding: 20px; }
|
107
|
+
.styleguide-example .styleguide-element + .styleguide-element {
|
108
|
+
margin-top: -5px;
|
109
|
+
padding-top: 15px;
|
110
|
+
border-top: 1px solid #eee; }
|
111
|
+
.styleguide-example .styleguide-element .styleguide-modifier-name {
|
112
|
+
display: block;
|
113
|
+
position: absolute;
|
114
|
+
top: 0;
|
115
|
+
right: 0;
|
116
|
+
padding: 5px 8px;
|
117
|
+
font-size: 11px;
|
118
|
+
color: #999;
|
119
|
+
background: #f9f9f9;
|
120
|
+
border: 1px solid #eee;
|
121
|
+
border-top: none; }
|
122
|
+
.styleguide-example .styleguide-html {
|
123
|
+
padding: 5px 10px;
|
124
|
+
background: #edf6f8;
|
125
|
+
border-top: 1px solid #dde7ea;
|
126
|
+
overflow: auto; }
|
127
|
+
.styleguide-example .styleguide-html .highlight {
|
128
|
+
background: none; }
|
129
|
+
.styleguide-example ul.styleguide-modifiers {
|
130
|
+
margin: 0 0 0 10px; }
|
131
|
+
.styleguide-example ul.styleguide-modifiers li {
|
132
|
+
list-style-type: none;
|
133
|
+
margin-left: 0; }
|
134
|
+
.styleguide-example ul.styleguide-modifiers li strong {
|
135
|
+
font-family: Monaco, monospace;
|
136
|
+
font-size: 12px;
|
137
|
+
font-weight: normal;
|
138
|
+
color: #222; }
|
139
|
+
|
140
|
+
/* @end */
|