brk-fonts-rails 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
@@ -0,0 +1,289 @@
1
+ /*/////////////////////////////////////////////////////////////////////////////
2
+ ///////////////////////////////////////////////////////////////////////////////
3
+ ///
4
+ /// @author: José Antonio Yáñez Jiménez
5
+ /// @created: 31/08/2014
6
+ /// @modified: 21/09/2014
7
+ /// @name: Brk Fonts
8
+ /// @version: 1.0.0 – Altamira Oriole
9
+ /// @site: http://brkfonts.jimenezfrontend.es
10
+ ///
11
+ ///////////////////////////////////////////////////////////////////////////////
12
+ /////////////////////////////////////////////////////////////////////////////*/
13
+ /* FONT PATH
14
+ * -------------------------- */
15
+ //= depend_on_asset "brk-font.eot"
16
+ //= depend_on_asset "brk-font.woff"
17
+ //= depend_on_asset "brk-font.ttf"
18
+ //= depend_on_asset "brk-font.svg"
19
+ <% v = BrkFonts::Rails::VERSION %>
20
+ @font-face {
21
+ font-family: 'brkfont';
22
+ src: url('<%= font_path('brk-font.eot') %>?v=<%= v %>');
23
+ src: url('<%= font_path('brk-font.eot') %>?#iefix&v=<%= v %>') format('embedded-opentype'), url('<%= font_path('brk-font.woff') %>?v=<%= v %>') format('woff'), url('<%= font_path('brk-font.ttf') %>?v=<%= v %>') format('truetype'), url('<%= font_path('brk-font.svg') %>?v=<%= v %>#fontawesomeregular') format('svg');
24
+ font-weight: normal;
25
+ font-style: normal;
26
+ }
27
+ /*
28
+ @media screen and (-webkit-min-device-pixel-ratio:0) {
29
+ @font-face {
30
+ font-family: 'brkfonts';
31
+ src: url('<%= font_path('brk-font.svg') %>?35488543#brkfonts') format('svg');
32
+ }
33
+ }
34
+ */
35
+ [class^="brk-"]:before,
36
+ [class*=" brk-"]:before {
37
+ font-family: "brkfont";
38
+ font-style: normal;
39
+ font-weight: normal;
40
+ speak: none;
41
+ display: inline-block;
42
+ text-decoration: inherit;
43
+ width: 1em;
44
+ font-size: 130%;
45
+ margin-right: .2em;
46
+ text-align: center;
47
+ /* For safety - reset parent styles, that can break glyph codes */
48
+
49
+ font-variant: normal;
50
+ text-transform: none;
51
+ /* fix buttons height, for twitter bootstrap */
52
+
53
+ line-height: 1em;
54
+ /* Animation center compensation - margins should be symmetric */
55
+
56
+ margin-left: .2em;
57
+ -webkit-font-smoothing: antialiased;
58
+ -moz-osx-font-smoothing: grayscale;
59
+ }
60
+ .brk-sm {
61
+ font-size: 100%;
62
+ }
63
+ .brk-md {
64
+ font-size: 150%;
65
+ }
66
+ .brk-lg {
67
+ font-size: 180%;
68
+ }
69
+ .brk-2x {
70
+ font-size: 200%;
71
+ }
72
+ .brk-3x {
73
+ font-size: 300%;
74
+ }
75
+ .brk-4x {
76
+ font-size: 400%;
77
+ }
78
+ .brk-5x {
79
+ font-size: 500%;
80
+ }
81
+ .brk-3d {
82
+ text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3);
83
+ }
84
+ .brk-inverse {
85
+ color: #ffffff;
86
+ }
87
+ .brk-spin {
88
+ -moz-animation: spin 2s infinite linear;
89
+ -o-animation: spin 2s infinite linear;
90
+ -webkit-animation: spin 2s infinite linear;
91
+ animation: spin 2s infinite linear;
92
+ display: inline-block;
93
+ }
94
+ @-moz-keyframes spin {
95
+ 0% {
96
+ -moz-transform: rotate(0deg);
97
+ -o-transform: rotate(0deg);
98
+ -webkit-transform: rotate(0deg);
99
+ transform: rotate(0deg);
100
+ }
101
+ 100% {
102
+ -moz-transform: rotate(359deg);
103
+ -o-transform: rotate(359deg);
104
+ -webkit-transform: rotate(359deg);
105
+ transform: rotate(359deg);
106
+ }
107
+ }
108
+ @-webkit-keyframes spin {
109
+ 0% {
110
+ -moz-transform: rotate(0deg);
111
+ -o-transform: rotate(0deg);
112
+ -webkit-transform: rotate(0deg);
113
+ transform: rotate(0deg);
114
+ }
115
+ 100% {
116
+ -moz-transform: rotate(359deg);
117
+ -o-transform: rotate(359deg);
118
+ -webkit-transform: rotate(359deg);
119
+ transform: rotate(359deg);
120
+ }
121
+ }
122
+ @-o-keyframes spin {
123
+ 0% {
124
+ -moz-transform: rotate(0deg);
125
+ -o-transform: rotate(0deg);
126
+ -webkit-transform: rotate(0deg);
127
+ transform: rotate(0deg);
128
+ }
129
+ 100% {
130
+ -moz-transform: rotate(359deg);
131
+ -o-transform: rotate(359deg);
132
+ -webkit-transform: rotate(359deg);
133
+ transform: rotate(359deg);
134
+ }
135
+ }
136
+ @-ms-keyframes spin {
137
+ 0% {
138
+ -moz-transform: rotate(0deg);
139
+ -o-transform: rotate(0deg);
140
+ -webkit-transform: rotate(0deg);
141
+ transform: rotate(0deg);
142
+ }
143
+ 100% {
144
+ -moz-transform: rotate(359deg);
145
+ -o-transform: rotate(359deg);
146
+ -webkit-transform: rotate(359deg);
147
+ transform: rotate(359deg);
148
+ }
149
+ }
150
+ @keyframes spin {
151
+ 0% {
152
+ -moz-transform: rotate(0deg);
153
+ -o-transform: rotate(0deg);
154
+ -webkit-transform: rotate(0deg);
155
+ transform: rotate(0deg);
156
+ }
157
+ 100% {
158
+ -moz-transform: rotate(359deg);
159
+ -o-transform: rotate(359deg);
160
+ -webkit-transform: rotate(359deg);
161
+ transform: rotate(359deg);
162
+ }
163
+ }
164
+ .brk-postgresql:before {
165
+ content: '\e800';
166
+ }
167
+ .brk-valladolid:before {
168
+ content: '\e801';
169
+ }
170
+ .brk-wordpress-square:before {
171
+ content: '\e802';
172
+ }
173
+ .brk-python-square:before {
174
+ content: '\e803';
175
+ }
176
+ .brk-python:before {
177
+ content: '\e804';
178
+ }
179
+ .brk-mirlodev-square:before {
180
+ content: '\e805';
181
+ }
182
+ .brk-mirlodev:before {
183
+ content: '\e806';
184
+ }
185
+ .brk-valladolid-square:before {
186
+ content: '\e807';
187
+ }
188
+ .brk-miriadax-square:before {
189
+ content: '\e808';
190
+ }
191
+ .brk-juvecyl-square:before {
192
+ content: '\e809';
193
+ }
194
+ .brk-juvecyl:before {
195
+ content: '\e80a';
196
+ }
197
+ .brk-miriadax:before {
198
+ content: '\e80b';
199
+ }
200
+ .brk-gitlab-square:before {
201
+ content: '\e80c';
202
+ }
203
+ .brk-opendraft-square:before {
204
+ content: '\e80d';
205
+ }
206
+ .brk-opendraft:before {
207
+ content: '\e80e';
208
+ }
209
+ .brk-gitlab:before {
210
+ content: '\e80f';
211
+ }
212
+ .brk-cyl-square:before {
213
+ content: '\e810';
214
+ }
215
+ .brk-jquery-square:before {
216
+ content: '\e811';
217
+ }
218
+ .brk-jquery:before {
219
+ content: '\e812';
220
+ }
221
+ .brk-cyl:before {
222
+ content: '\e813';
223
+ }
224
+ .brk-rails-square:before {
225
+ content: '\e814';
226
+ }
227
+ .brk-postgresql-1:before {
228
+ content: '\e815';
229
+ }
230
+ .brk-postgresql-square:before {
231
+ content: '\e816';
232
+ }
233
+ .brk-rails:before {
234
+ content: '\e817';
235
+ }
236
+ .brk-wordpress:before {
237
+ content: '\e818';
238
+ }
239
+ .brk-upvx-square:before {
240
+ content: '\e819';
241
+ }
242
+ .brk-upvx:before {
243
+ content: '\e81a';
244
+ }
245
+ .brk-coffee-square:before {
246
+ content: '\e81b';
247
+ }
248
+ .brk-coffee:before {
249
+ content: '\e81c';
250
+ }
251
+ .brk-jquery-ui:before {
252
+ content: '\e81d';
253
+ }
254
+ .brk-iebs-square:before {
255
+ content: '\e81e';
256
+ }
257
+ .brk-django-square:before {
258
+ content: '\e81f';
259
+ }
260
+ .brk-django:before {
261
+ content: '\e820';
262
+ }
263
+ .brk-iebs:before {
264
+ content: '\e821';
265
+ }
266
+ .brk-pyramid-square:before {
267
+ content: '\e822';
268
+ }
269
+ .brk-java-square:before {
270
+ content: '\e823';
271
+ }
272
+ .brk-java:before {
273
+ content: '\e824';
274
+ }
275
+ .brk-pyramid:before {
276
+ content: '\e825';
277
+ }
278
+ .brk-cisco-square:before {
279
+ content: '\e826';
280
+ }
281
+ .brk-cisco:before {
282
+ content: '\e827';
283
+ }
284
+ .brk-ruby:before {
285
+ content: '\e828';
286
+ }
287
+ .brk-ruby-square:before {
288
+ content: '\e829';
289
+ }
@@ -0,0 +1,34 @@
1
+ module BrkFonts
2
+ module Rails
3
+ module IconHelper
4
+ def brk_icon(names = "flag", options = {})
5
+ classes = [""]
6
+ classes.concat Private.icon_names(names)
7
+ classes.concat Array(options.delete(:class))
8
+ text = options.delete(:text)
9
+ right_icon = options.delete(:right)
10
+ icon = content_tag(:i, nil, options.merge(:class => classes))
11
+ Private.icon_join(icon, text, right_icon)
12
+ end
13
+
14
+ module Private
15
+ extend ActionView::Helpers::OutputSafetyHelper
16
+
17
+ def self.icon_join(icon, text, reverse_order = false)
18
+ return icon if text.blank?
19
+ elements = [icon, ERB::Util.html_escape(text)]
20
+ elements.reverse! if reverse_order
21
+ safe_join(elements, " ")
22
+ end
23
+
24
+ def self.icon_names(names = [])
25
+ array_value(names).map { |n| "brk-#{n}" }
26
+ end
27
+
28
+ def self.array_value(value = [])
29
+ value.is_a?(Array) ? value : value.to_s.split(/\s+/)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,2 @@
1
+ require "brk-fonts-rails/version"
2
+ require "brk-fonts-rails/engine" if defined?(::Rails)
@@ -0,0 +1,6 @@
1
+ module BrkFonts
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module BrkFonts
2
+ module Rails
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,68 @@
1
+ require 'test_helper'
2
+
3
+ class BrkFontsRailsTest < ActionDispatch::IntegrationTest
4
+ teardown { clean_sprockets_cache }
5
+
6
+ test "Load engine" do
7
+ assert_equal ::Rails::Engine, BrkFonts::Rails::Engine.superclass
8
+ end
9
+
10
+ test "Fonts found" do
11
+ get "/assets/brk-font.eot"
12
+ assert_response :success
13
+ get "/assets/brk-font.ttf"
14
+ assert_response :success
15
+ get "/assets/brk-font.woff"
16
+ assert_response :success
17
+ get "/assets/brk-font.svg"
18
+ assert_response :success
19
+ end
20
+
21
+ test "Stylesheet found" do
22
+ get "/assets/brk-fonts.css"
23
+ assert_brk_fonts(response)
24
+ end
25
+
26
+ test "stylesheets have correct references to the fonts" do
27
+ get "/assets/brk-fonts.css"
28
+ v = BrkFonts::Rails::VERSION
29
+ assert_match "/assets/brk-font.eot?v=#{v}", response.body
30
+ assert_match "/assets/brk-font.eot?#iefix&v=#{v}", response.body
31
+ assert_match "/assets/brk-font.woff?v=#{v}", response.body
32
+ assert_match "/assets/brk-font.ttf?v=#{v}", response.body
33
+ assert_match "/assets/brk-font.svg?v=#{v}", response.body
34
+ end
35
+
36
+ test "stylesheet is available in a css sprockets require" do
37
+ get "/assets/sprockets-require.css"
38
+ assert_brk_fonts(response)
39
+ end
40
+
41
+ test "stylesheet is available in a sass import" do
42
+ get "/assets/sass-import.css"
43
+ assert_brk_fonts(response)
44
+ end
45
+
46
+ test "stylesheet is available in a scss import" do
47
+ get "/assets/scss-import.css"
48
+ assert_brk_fonts(response)
49
+ end
50
+
51
+ # test "helpers should be available in the view" do
52
+ # get "/icons"
53
+ # assert_response :success
54
+ # assert_select "i.fa.fa-flag"
55
+ # assert_select "span.fa-stack"
56
+ # end
57
+
58
+ private
59
+
60
+ def clean_sprockets_cache
61
+ FileUtils.rm_rf File.expand_path("../dummy/tmp", __FILE__)
62
+ end
63
+
64
+ def assert_brk_fonts(response)
65
+ assert_response :success
66
+ assert_match(/font-family:\s*'brkfont';/, response.body)
67
+ end
68
+ end
@@ -0,0 +1 @@
1
+ @import brk-fonts
@@ -0,0 +1 @@
1
+ @import "brk-fonts";
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require brk-fonts
3
+ */
@@ -0,0 +1,2 @@
1
+ class PagesController < ActionController::Base
2
+ end
@@ -0,0 +1,3 @@
1
+ <%= brk_icon "ruby" %>
2
+
3
+ <%= brk_icon "rails" %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,18 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # require "rails/all"
4
+ require "sprockets/railtie"
5
+
6
+ Bundler.require(:default, :development)
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ config.encoding = "utf-8"
11
+ config.assets.enabled = true
12
+ config.assets.version = '1.0'
13
+
14
+ # replacement for environments/*.rb
15
+ config.active_support.deprecation = :stderr
16
+ config.eager_load = false
17
+ end
18
+ end