rack-less 2.0.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +15 -19
- data/README.rdoc +9 -7
- data/Rakefile +3 -3
- data/lib/rack/less/base.rb +1 -1
- data/lib/rack/less/config.rb +1 -1
- data/lib/rack/less/response.rb +4 -4
- data/lib/rack/less/source.rb +6 -1
- data/lib/rack/less/version.rb +2 -2
- data/rack-less.gemspec +4 -3
- data/test/app_helper.rb +3 -3
- data/test/bootstrap_test.rb +26 -0
- data/test/config_test.rb +112 -150
- data/test/fixtures/bootstrap_v1.1.0/bootstrap-1.1.0.css +1894 -0
- data/test/fixtures/bootstrap_v1.1.0/bootstrap.less +23 -0
- data/test/fixtures/bootstrap_v1.1.0/forms.less +369 -0
- data/test/fixtures/bootstrap_v1.1.0/patterns.less +683 -0
- data/test/fixtures/bootstrap_v1.1.0/preboot.less +267 -0
- data/test/fixtures/bootstrap_v1.1.0/reset.less +21 -0
- data/test/fixtures/bootstrap_v1.1.0/scaffolding.less +174 -0
- data/test/fixtures/bootstrap_v1.1.0/tables.less +148 -0
- data/test/fixtures/bootstrap_v1.1.0/type.less +185 -0
- data/test/fixtures/sinatra/app/stylesheets/all_compiled.css +7 -3
- data/test/fixtures/sinatra/app/stylesheets/nested/file_compiled.css +6 -2
- data/test/fixtures/sinatra/app/stylesheets/nested/nested_import.less +3 -0
- data/test/fixtures/sinatra/app/stylesheets/nested/really/really.less +5 -3
- data/test/fixtures/sinatra/app/stylesheets/nested/really/really_compiled.css +7 -2
- data/test/fixtures/sinatra/app/stylesheets/nested/really/really_nested_import.less +4 -0
- data/test/fixtures/sinatra/app/stylesheets/normal.less +1 -1
- data/test/fixtures/sinatra/app/stylesheets/normal_compiled.css +6 -2
- data/test/helper.rb +35 -38
- data/test/irb.rb +9 -0
- data/test/options_test.rb +25 -22
- data/test/request_test.rb +86 -74
- data/test/response_test.rb +6 -4
- data/test/sinatra_test.rb +38 -37
- data/test/source_test.rb +128 -114
- metadata +57 -34
- data/.bundle/config +0 -2
- data/test/env.rb +0 -9
@@ -0,0 +1,148 @@
|
|
1
|
+
/*
|
2
|
+
* Tables.less
|
3
|
+
* Tables for, you guessed it, tabular data
|
4
|
+
* ---------------------------------------- */
|
5
|
+
|
6
|
+
|
7
|
+
// BASELINE STYLES
|
8
|
+
// ---------------
|
9
|
+
|
10
|
+
table {
|
11
|
+
width: 100%;
|
12
|
+
margin-bottom: @baseline;
|
13
|
+
padding: 0;
|
14
|
+
border-collapse: separate;
|
15
|
+
font-size: 13px;
|
16
|
+
th, td {
|
17
|
+
padding: 10px 10px 9px;
|
18
|
+
line-height: @baseline * .75;
|
19
|
+
text-align: left;
|
20
|
+
vertical-align: middle;
|
21
|
+
border-bottom: 1px solid #ddd;
|
22
|
+
}
|
23
|
+
th {
|
24
|
+
padding-top: 9px;
|
25
|
+
font-weight: bold;
|
26
|
+
border-bottom-width: 2px;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
// ZEBRA-STRIPING
|
32
|
+
// --------------
|
33
|
+
|
34
|
+
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
|
35
|
+
.zebra-striped {
|
36
|
+
tbody {
|
37
|
+
tr:nth-child(odd) td {
|
38
|
+
background-color: #f9f9f9;
|
39
|
+
}
|
40
|
+
tr:hover td {
|
41
|
+
background-color: #f5f5f5;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// Tablesorting styles w/ jQuery plugin
|
46
|
+
.header {
|
47
|
+
cursor: pointer;
|
48
|
+
&:after {
|
49
|
+
content: "";
|
50
|
+
float: right;
|
51
|
+
margin-top: 7px;
|
52
|
+
border-width: 0 4px 4px;
|
53
|
+
border-style: solid;
|
54
|
+
border-color: #000 transparent;
|
55
|
+
visibility: hidden;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
// Style the sorted column headers (THs)
|
59
|
+
.headerSortUp,
|
60
|
+
.headerSortDown {
|
61
|
+
background-color: rgba(141,192,219,.25);
|
62
|
+
text-shadow: 0 1px 1px rgba(255,255,255,.75);
|
63
|
+
.border-radius(3px 3px 0 0);
|
64
|
+
}
|
65
|
+
// Style the ascending (reverse alphabetical) column header
|
66
|
+
.header:hover {
|
67
|
+
&:after {
|
68
|
+
visibility:visible;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
// Style the descending (alphabetical) column header
|
72
|
+
.headerSortDown,
|
73
|
+
.headerSortDown:hover {
|
74
|
+
&:after {
|
75
|
+
visibility:visible;
|
76
|
+
.opacity(60);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
// Style the ascending (reverse alphabetical) column header
|
80
|
+
.headerSortUp {
|
81
|
+
&:after {
|
82
|
+
border-bottom: none;
|
83
|
+
border-left: 4px solid transparent;
|
84
|
+
border-right: 4px solid transparent;
|
85
|
+
border-top: 4px solid #000;
|
86
|
+
visibility:visible;
|
87
|
+
.box-shadow(none); //can't add boxshadow to downward facing arrow :(
|
88
|
+
.opacity(60);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
table {
|
94
|
+
// Blue Table Headings
|
95
|
+
.blue {
|
96
|
+
color: @blue;
|
97
|
+
border-bottom-color: @blue;
|
98
|
+
}
|
99
|
+
.headerSortUp.blue,
|
100
|
+
.headerSortDown.blue {
|
101
|
+
background-color: lighten(@blue, 40%);
|
102
|
+
}
|
103
|
+
// Green Table Headings
|
104
|
+
.green {
|
105
|
+
color: @green;
|
106
|
+
border-bottom-color: @green;
|
107
|
+
}
|
108
|
+
.headerSortUp.green,
|
109
|
+
.headerSortDown.green {
|
110
|
+
background-color: lighten(@green, 40%);
|
111
|
+
}
|
112
|
+
// Red Table Headings
|
113
|
+
.red {
|
114
|
+
color: @red;
|
115
|
+
border-bottom-color: @red;
|
116
|
+
}
|
117
|
+
.headerSortUp.red,
|
118
|
+
.headerSortDown.red {
|
119
|
+
background-color: lighten(@red, 50%);
|
120
|
+
}
|
121
|
+
// Yellow Table Headings
|
122
|
+
.yellow {
|
123
|
+
color: @yellow;
|
124
|
+
border-bottom-color: @yellow;
|
125
|
+
}
|
126
|
+
.headerSortUp.yellow,
|
127
|
+
.headerSortDown.yellow {
|
128
|
+
background-color: lighten(@yellow, 40%);
|
129
|
+
}
|
130
|
+
// Orange Table Headings
|
131
|
+
.orange {
|
132
|
+
color: @orange;
|
133
|
+
border-bottom-color: @orange;
|
134
|
+
}
|
135
|
+
.headerSortUp.orange,
|
136
|
+
.headerSortDown.orange {
|
137
|
+
background-color: lighten(@orange, 40%);
|
138
|
+
}
|
139
|
+
// Purple Table Headings
|
140
|
+
.purple {
|
141
|
+
color: @purple;
|
142
|
+
border-bottom-color: @purple;
|
143
|
+
}
|
144
|
+
.headerSortUp.purple,
|
145
|
+
.headerSortDown.purple {
|
146
|
+
background-color: lighten(@purple, 40%);
|
147
|
+
}
|
148
|
+
}
|
@@ -0,0 +1,185 @@
|
|
1
|
+
/* Typography.less
|
2
|
+
* Headings, body text, lists, code, and more for a versatile and durable typography system
|
3
|
+
* ---------------------------------------------------------------------------------------- */
|
4
|
+
|
5
|
+
|
6
|
+
// BODY TEXT
|
7
|
+
// ---------
|
8
|
+
|
9
|
+
p {
|
10
|
+
#font > .shorthand(normal,@basefont,@baseline);
|
11
|
+
margin-bottom: @baseline / 2;
|
12
|
+
small {
|
13
|
+
font-size: @basefont - 2;
|
14
|
+
color: @grayLight;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
// HEADINGS
|
20
|
+
// --------
|
21
|
+
|
22
|
+
h1, h2, h3, h4, h5, h6 {
|
23
|
+
font-weight: bold;
|
24
|
+
color: @grayDark;
|
25
|
+
small {
|
26
|
+
color: @grayLight;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
h1 {
|
30
|
+
margin-bottom: @baseline;
|
31
|
+
font-size: 30px;
|
32
|
+
line-height: @baseline * 2;
|
33
|
+
small {
|
34
|
+
font-size: 18px;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
h2 {
|
38
|
+
font-size: 24px;
|
39
|
+
line-height: @baseline * 2;
|
40
|
+
small {
|
41
|
+
font-size: 14px;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
h3, h4, h5, h6 {
|
45
|
+
line-height: @baseline * 2;
|
46
|
+
}
|
47
|
+
h3 {
|
48
|
+
font-size: 18px;
|
49
|
+
small {
|
50
|
+
font-size: 14px;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
h4 {
|
54
|
+
font-size: 16px;
|
55
|
+
small {
|
56
|
+
font-size: 12px;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
h5 {
|
60
|
+
font-size: 14px;
|
61
|
+
}
|
62
|
+
h6 {
|
63
|
+
font-size: 13px;
|
64
|
+
color: @grayLight;
|
65
|
+
text-transform: uppercase;
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
// COLORS
|
70
|
+
// ------
|
71
|
+
|
72
|
+
// Unordered and Ordered lists
|
73
|
+
ul, ol {
|
74
|
+
margin: 0 0 @baseline 25px;
|
75
|
+
}
|
76
|
+
ul ul,
|
77
|
+
ul ol,
|
78
|
+
ol ol,
|
79
|
+
ol ul {
|
80
|
+
margin-bottom: 0;
|
81
|
+
}
|
82
|
+
ul {
|
83
|
+
list-style: disc;
|
84
|
+
}
|
85
|
+
ol {
|
86
|
+
list-style: decimal;
|
87
|
+
}
|
88
|
+
li {
|
89
|
+
line-height: @baseline;
|
90
|
+
color: @gray;
|
91
|
+
}
|
92
|
+
ul.unstyled {
|
93
|
+
list-style: none;
|
94
|
+
margin-left: 0;
|
95
|
+
}
|
96
|
+
|
97
|
+
// Description Lists
|
98
|
+
dl {
|
99
|
+
margin-bottom: @baseline;
|
100
|
+
dt, dd {
|
101
|
+
line-height: @baseline;
|
102
|
+
}
|
103
|
+
dt {
|
104
|
+
font-weight: bold;
|
105
|
+
}
|
106
|
+
dd {
|
107
|
+
margin-left: @baseline / 2;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
// MISC
|
112
|
+
// ----
|
113
|
+
|
114
|
+
// Horizontal rules
|
115
|
+
hr {
|
116
|
+
margin: 0 0 19px;
|
117
|
+
border: 0;
|
118
|
+
border-bottom: 1px solid #eee;
|
119
|
+
}
|
120
|
+
|
121
|
+
// Emphasis
|
122
|
+
strong {
|
123
|
+
font-style: inherit;
|
124
|
+
font-weight: bold;
|
125
|
+
line-height: inherit;
|
126
|
+
}
|
127
|
+
em {
|
128
|
+
font-style: italic;
|
129
|
+
font-weight: inherit;
|
130
|
+
line-height: inherit;
|
131
|
+
}
|
132
|
+
.muted {
|
133
|
+
color: @grayLighter;
|
134
|
+
}
|
135
|
+
|
136
|
+
// Blockquotes
|
137
|
+
blockquote {
|
138
|
+
margin-bottom: @baseline;
|
139
|
+
border-left: 5px solid #eee;
|
140
|
+
padding-left: 15px;
|
141
|
+
p {
|
142
|
+
#font > .shorthand(300,14px,@baseline);
|
143
|
+
margin-bottom: 0;
|
144
|
+
}
|
145
|
+
small {
|
146
|
+
display: block;
|
147
|
+
#font > .shorthand(300,12px,@baseline);
|
148
|
+
color: @grayLight;
|
149
|
+
&:before {
|
150
|
+
content: '\2014 \00A0';
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
// Addresses
|
156
|
+
address {
|
157
|
+
display: block;
|
158
|
+
line-height: @baseline;
|
159
|
+
margin-bottom: @baseline;
|
160
|
+
}
|
161
|
+
|
162
|
+
// Inline and block code styles
|
163
|
+
code, pre {
|
164
|
+
padding: 0 3px 2px;
|
165
|
+
font-family: Monaco, Andale Mono, Courier New, monospace;
|
166
|
+
font-size: 12px;
|
167
|
+
.border-radius(3px);
|
168
|
+
}
|
169
|
+
code {
|
170
|
+
background-color: lighten(@orange, 40%);
|
171
|
+
color: rgba(0,0,0,.75);
|
172
|
+
padding: 1px 3px;
|
173
|
+
}
|
174
|
+
pre {
|
175
|
+
background-color: #f5f5f5;
|
176
|
+
display: block;
|
177
|
+
padding: @baseline - 1;
|
178
|
+
margin: 0 0 @baseline;
|
179
|
+
line-height: @baseline;
|
180
|
+
font-size: 12px;
|
181
|
+
border: 1px solid #ccc;
|
182
|
+
border: 1px solid rgba(0,0,0,.15);
|
183
|
+
.border-radius(3px);
|
184
|
+
white-space: pre-wrap;
|
185
|
+
}
|
data/test/helper.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
Bundler.setup
|
1
|
+
# this file is automatically required in when you require 'assert' in your tests
|
2
|
+
# put test helpers here
|
4
3
|
|
5
|
-
|
6
|
-
|
4
|
+
# add root dir to the load path
|
5
|
+
$LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
|
6
|
+
require 'rack/less'
|
7
7
|
|
8
|
-
class
|
8
|
+
class Assert::Context
|
9
9
|
|
10
10
|
def file_path(*segments)
|
11
11
|
segs = segments.unshift([File.dirname(__FILE__), '..']).flatten
|
@@ -13,17 +13,15 @@ class Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.should_compile_source(name, desc)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
16
|
+
setup do
|
17
|
+
@compiled = File.read(File.join(@source_folder, "#{name}_compiled.css"))
|
18
|
+
@source = Rack::Less::Source.new(name, :folder => @source_folder)
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
21
|
+
should "compile LESS" do
|
22
|
+
assert_equal @compiled.strip, @source.compiled.strip, '.compiled is incorrect'
|
23
|
+
assert_equal @compiled.strip, @source.to_css.strip, '.to_css is incorrect'
|
24
|
+
assert_equal @compiled.strip, @source.css.strip, '.css is incorrect'
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
@@ -45,33 +43,32 @@ class Test::Unit::TestCase
|
|
45
43
|
end
|
46
44
|
|
47
45
|
def self.should_not_be_a_valid_rack_less_request(args)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
desc "to #{args[:method].upcase} #{args[:resource]} (#{args[:description]})"
|
47
|
+
setup do
|
48
|
+
@request = less_request(args[:method], args[:resource])
|
49
|
+
end
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
51
|
+
should "not be a valid endpoint for Rack::Less" do
|
52
|
+
not_valid = !@request.get?
|
53
|
+
not_valid ||= !@request.for_css?
|
54
|
+
not_valid ||= @request.source.files.empty?
|
55
|
+
assert not_valid, 'request is a GET for .css format and has source'
|
56
|
+
assert !@request.for_less?, 'the request is for less'
|
60
57
|
end
|
61
58
|
end
|
59
|
+
|
62
60
|
def self.should_be_a_valid_rack_less_request(args)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
desc "to #{args[:method].upcase} #{args[:resource]} (#{args[:description]})"
|
62
|
+
setup do
|
63
|
+
@request = less_request(args[:method], args[:resource])
|
64
|
+
end
|
67
65
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
66
|
+
should "be a valid endpoint for Rack::Less" do
|
67
|
+
assert @request.get?, 'the request is not a GET'
|
68
|
+
assert @request.for_css?, 'the request is not for css'
|
69
|
+
assert !@request.source.files.empty?, 'the request resource has no source'
|
70
|
+
assert @request.for_less?, 'the request is not for less'
|
74
71
|
end
|
75
72
|
end
|
76
73
|
|
77
|
-
end
|
74
|
+
end
|