sinatra-cigars 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/Gemfile +1 -1
- data/examples/classic.rb +8 -0
- data/examples/modular.rb +9 -0
- data/lib/sinatra/cigars/helpers.rb +8 -1
- data/lib/sinatra/cigars/version.rb +2 -2
- data/spec/cigars_spec.rb +1 -1
- data/spec/helpers_spec.rb +37 -2
- metadata +14 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 622d3c7880e461be93cca291589cd92da1563ee3
|
4
|
+
data.tar.gz: ca6be4dbc46e8dfea1184435a02e01f819fd1599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3039fb0c4366a606763c728a3acf7ff02c38ba892bfa38ba9f1edeea8226ccd1f055a0f3dc40beceac7c829029353c94019ac1a429894664baa0698eb017104
|
7
|
+
data.tar.gz: 278d533a046092dcd77c140f3453b834a2c26afa7a3db7794a39863b3d6eb4804a9a1691e739dfaa1c314faf95482f1feb50681ff1133a0257ba7ef817d1f347
|
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
data/examples/classic.rb
ADDED
data/examples/modular.rb
ADDED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'haml'
|
2
3
|
|
3
4
|
module Sinatra
|
4
|
-
|
5
|
+
class Cigars < Base
|
5
6
|
module Helpers
|
6
7
|
def development?
|
7
8
|
ENV['RACK_ENV'] == 'development'
|
@@ -35,6 +36,10 @@ module Sinatra
|
|
35
36
|
render_haml "%script{src: '#{render_tag(src, '.js')}'}"
|
36
37
|
end
|
37
38
|
|
39
|
+
def favicon src = nil
|
40
|
+
render_haml "%link{rel: 'shortcut icon', href: '#{render_tag((src ? src : '/favicon'), (src ? '.png' : '.ico'))}'}"
|
41
|
+
end
|
42
|
+
|
38
43
|
def title str, prefix = "", suffix = false
|
39
44
|
home? ? render_haml("%title= '#{str}'") : render_haml("%title= '#{suffix ? str + prefix : prefix + str}'")
|
40
45
|
end
|
@@ -75,6 +80,8 @@ module Sinatra
|
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
83
|
+
|
84
|
+
helpers Helpers
|
78
85
|
end
|
79
86
|
|
80
87
|
helpers Cigars::Helpers
|
data/spec/cigars_spec.rb
CHANGED
data/spec/helpers_spec.rb
CHANGED
@@ -8,8 +8,6 @@ describe Sinatra::Cigars::Helpers, type: :feature do
|
|
8
8
|
ENV['RACK_ENV'] = 'development'
|
9
9
|
|
10
10
|
mock_app do
|
11
|
-
helpers Sinatra::Cigars::Helpers
|
12
|
-
|
13
11
|
get('/development') { development?.to_s }
|
14
12
|
get('/test') { test?.to_s }
|
15
13
|
get('/staging') { staging?.to_s }
|
@@ -230,6 +228,43 @@ describe Sinatra::Cigars::Helpers, type: :feature do
|
|
230
228
|
end
|
231
229
|
end
|
232
230
|
|
231
|
+
describe 'favicon' do
|
232
|
+
before do
|
233
|
+
@rev = `git rev-parse --short HEAD`.chomp
|
234
|
+
|
235
|
+
mock_app do
|
236
|
+
helpers Sinatra::Cigars::Helpers
|
237
|
+
|
238
|
+
get('/') { haml '= favicon' }
|
239
|
+
get('/path') { haml '= favicon :path' }
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
it do
|
244
|
+
ENV['RACK_ENV'] = 'test'
|
245
|
+
visit '/'
|
246
|
+
body.should == "<link href='/favicon.ico' rel='shortcut icon'>\n"
|
247
|
+
end
|
248
|
+
|
249
|
+
it do
|
250
|
+
ENV['RACK_ENV'] = 'production'
|
251
|
+
visit '/'
|
252
|
+
body.should == "<link href='/favicon.ico?#{@rev}' rel='shortcut icon'>\n"
|
253
|
+
end
|
254
|
+
|
255
|
+
it do
|
256
|
+
ENV['RACK_ENV'] = 'test'
|
257
|
+
visit '/path'
|
258
|
+
body.should == "<link href='/path.png' rel='shortcut icon'>\n"
|
259
|
+
end
|
260
|
+
|
261
|
+
it do
|
262
|
+
ENV['RACK_ENV'] = 'production'
|
263
|
+
visit '/path'
|
264
|
+
body.should == "<link href='/path.png?#{@rev}' rel='shortcut icon'>\n"
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
233
268
|
describe 'livereload' do
|
234
269
|
before do
|
235
270
|
mock_app do
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-cigars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiichi Yonezawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: haml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.0'
|
41
41
|
description: ''
|
@@ -44,13 +44,15 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
47
|
+
- .editorconfig
|
48
|
+
- .gitignore
|
49
|
+
- .rspec
|
50
50
|
- Changelog.md
|
51
51
|
- Gemfile
|
52
52
|
- Rakefile
|
53
53
|
- Readme.md
|
54
|
+
- examples/classic.rb
|
55
|
+
- examples/modular.rb
|
54
56
|
- lib/sinatra/cigars.rb
|
55
57
|
- lib/sinatra/cigars/helpers.rb
|
56
58
|
- lib/sinatra/cigars/version.rb
|
@@ -67,17 +69,17 @@ require_paths:
|
|
67
69
|
- lib
|
68
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
71
|
requirements:
|
70
|
-
- -
|
72
|
+
- - '>='
|
71
73
|
- !ruby/object:Gem::Version
|
72
74
|
version: '0'
|
73
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
76
|
requirements:
|
75
|
-
- -
|
77
|
+
- - '>='
|
76
78
|
- !ruby/object:Gem::Version
|
77
79
|
version: '0'
|
78
80
|
requirements: []
|
79
81
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.0.14
|
81
83
|
signing_key:
|
82
84
|
specification_version: 4
|
83
85
|
summary: ''
|