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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71640998c57a08a4e6c54a9e4032c8dc6e62103e
4
- data.tar.gz: b3144c8b738791f72078ad47ab5dbc2cec62b887
3
+ metadata.gz: 622d3c7880e461be93cca291589cd92da1563ee3
4
+ data.tar.gz: ca6be4dbc46e8dfea1184435a02e01f819fd1599
5
5
  SHA512:
6
- metadata.gz: ec46011292f1bc4c02917ee9c343d744de91211aa8d73050e8afa102ba6e24f19bb5e3d291c684229be828cbc1c73661a564e088ac651d1cd45d42cbc29297ac
7
- data.tar.gz: ac172e41b8fb44b6eaf62682cf35a07f512de7b988f081ffbbf97956d48062a7a7988fbbb37405bbe4092c4ef72fc26e5e430f47ef95518f4c926b0e2fdb608f
6
+ metadata.gz: b3039fb0c4366a606763c728a3acf7ff02c38ba892bfa38ba9f1edeea8226ccd1f055a0f3dc40beceac7c829029353c94019ac1a429894664baa0698eb017104
7
+ data.tar.gz: 278d533a046092dcd77c140f3453b834a2c26afa7a3db7794a39863b3d6eb4804a9a1691e739dfaa1c314faf95482f1feb50681ff1133a0257ba7ef817d1f347
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.13 - 2014-08-03
4
+
5
+ * Added `favicon` to helpers
6
+ * Change Sinatra::Cigars to class
7
+
3
8
  ## 0.0.12 - 2014-05-05
4
9
 
5
10
  * Change `title` returns always "title" in home
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ gemspec
5
5
  group :test do
6
6
  gem 'capybara'
7
7
  gem 'rake'
8
- gem 'rspec'
8
+ gem 'rspec', '~> 2'
9
9
  end
@@ -0,0 +1,8 @@
1
+ $:.unshift 'lib'
2
+
3
+ require 'sinatra'
4
+ require 'sinatra/cigars'
5
+
6
+ get '/' do
7
+ haml "= home? ? 'Hooray!' : 'Oops.'"
8
+ end
@@ -0,0 +1,9 @@
1
+ $:.unshift 'lib'
2
+
3
+ require 'sinatra/cigars'
4
+
5
+ class App < Sinatra::Cigars
6
+ get '/' do
7
+ haml "= home? ? 'Hooray!' : 'Oops.'"
8
+ end
9
+ end
@@ -1,7 +1,8 @@
1
1
  require 'sinatra/base'
2
+ require 'haml'
2
3
 
3
4
  module Sinatra
4
- module Cigars
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
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
- module Cigars
3
- VERSION = '0.0.12'
2
+ class Cigars
3
+ VERSION = '0.0.13'
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ describe Sinatra::Cigars do
9
9
 
10
10
  context 'Helpers' do
11
11
  it 'included automatically' do
12
- defined?(Sinatra::Cigars::Helpers).should be_true
12
+ defined?(Sinatra::Cigars::Helpers).should be_truthy
13
13
  end
14
14
  end
15
15
  end
@@ -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.12
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-05-05 00:00:00.000000000 Z
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
- - ".editorconfig"
48
- - ".gitignore"
49
- - ".rspec"
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.2.2
82
+ rubygems_version: 2.0.14
81
83
  signing_key:
82
84
  specification_version: 4
83
85
  summary: ''