sinatra-exstatic-assets 2.0.1 → 2.0.3
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.
- checksums.yaml +7 -0
- data/.gitignore +18 -2
- data/CHANGES.md +16 -0
- data/Gemfile +2 -1
- data/README.md +46 -29
- data/Rakefile +1 -1
- data/examples/app2/main.rb +4 -0
- data/lib/sinatra/exstatic_assets/version.rb +1 -1
- data/sinatra-exstatic-assets.gemspec +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/static_assets_spec.rb +27 -5
- metadata +15 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 286d711fd92e8d6f21dad9140800ae159ca7034f
|
4
|
+
data.tar.gz: 84871e7eed752ffc134a1b754a310d6ea0c2d962
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6eeeab23f334c5e93e3adb777d6290dab02e4705c4673bfe9e578caee90748e3191eca51fc5b9d183bae4ca5312cb329463f44b8609cb6a71b0b7b39e25a203f
|
7
|
+
data.tar.gz: 4080428996d8929d16240e0094d6e67fa5c56eb0be4ea36ce21df544a7e02b0ce7510871bde7a4da3dd8390167e950e8eff3089a80118ee4a2332aa7b6b226fd
|
data/.gitignore
CHANGED
@@ -1,5 +1,21 @@
|
|
1
|
+
.DS_Store
|
2
|
+
.rvmrc
|
3
|
+
*.tmproj
|
4
|
+
key
|
5
|
+
log/
|
6
|
+
files/
|
7
|
+
thin/
|
8
|
+
.sass-cache/
|
9
|
+
run/
|
10
|
+
app/.sass-cache/
|
1
11
|
*.gem
|
2
|
-
.bundle
|
12
|
+
.bundle/
|
3
13
|
Gemfile.lock
|
4
|
-
|
14
|
+
vendor/
|
15
|
+
.yardoc/
|
16
|
+
bin/
|
17
|
+
doc/
|
18
|
+
docs/
|
19
|
+
coverage/
|
20
|
+
.rbx/
|
5
21
|
.rspec
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# CH CH CH CHANGES! #
|
2
2
|
|
3
|
+
## Friday the 2nd of January 2015, v2.0.3 ##
|
4
|
+
|
5
|
+
* Just small changes to the gemspec to kill some boring warnings.
|
6
|
+
|
7
|
+
----
|
8
|
+
|
9
|
+
|
10
|
+
## Friday the 2nd of January 2015, v2.0.2 ##
|
11
|
+
|
12
|
+
* Fixed a problem with the markdown that meant the main code example wasn't output on Rubydoc.
|
13
|
+
* Had a little bit of wrong info in the README, fixed that.
|
14
|
+
* Added some more specs for option passing.
|
15
|
+
|
16
|
+
----
|
17
|
+
|
18
|
+
|
3
19
|
## Friday the 18th of April 2014, v2.0.1 ##
|
4
20
|
|
5
21
|
* Bug fix, remote urls were sometimes being prepended with the public folder, fixed.
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in sinatra-static-assets.gemspec
|
4
4
|
gemspec
|
@@ -9,6 +9,7 @@ end
|
|
9
9
|
|
10
10
|
group :test do
|
11
11
|
gem "rspec"
|
12
|
+
gem "rspec-its"
|
12
13
|
gem "rack-test"
|
13
14
|
gem "simplecov"
|
14
15
|
gem 'turn', :require => false
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ It's a Sinatra extension that has some handy helpers for dealing with static ass
|
|
17
17
|
* There's no `link_to` method (it doesn't handle assets so it was cut).
|
18
18
|
* There was a mutex in the library to handle timestamps and race conditions around that. That's gone.
|
19
19
|
* The helpers now look at the timestamp for the file they're linking to, and add that as a querystring parameter to the link displayed in the view. This will help client browsers cache the file (add something like Rack Cache to aid with this).
|
20
|
-
* There are some new options to give more control over whether the script_tag environment variable is prepended.
|
20
|
+
* There are some new options to give more control over whether the `script_tag` environment variable is prepended.
|
21
21
|
* More aliases, and shorter aliases.
|
22
22
|
* The tests are now a mixture of integration and unit test, but written using RSpec. There's also test coverage via SimpleCov, which is close to 100%.
|
23
23
|
* More API docs via Yardoc.
|
@@ -26,41 +26,58 @@ It's a Sinatra extension that has some handy helpers for dealing with static ass
|
|
26
26
|
|
27
27
|
This library uses [semver](http://semver.org/) to version the **library**. That means the library version is ***not*** an indicator of quality but a way to manage changes.
|
28
28
|
|
29
|
-
|
30
29
|
### Installation ###
|
31
30
|
|
32
|
-
|
31
|
+
#### via Rubygems ####
|
32
|
+
|
33
|
+
gem install sinatra-exstatic-assets
|
34
|
+
|
35
|
+
and in your code:
|
36
|
+
|
37
|
+
require 'sinatra/exstatic_assets'
|
38
|
+
|
39
|
+
#### via Bundler ####
|
40
|
+
|
41
|
+
Put this in your Gemfile:
|
33
42
|
|
34
|
-
gem "sinatra-exstatic-assets", :require => "sinatra/exstatic_assets"
|
43
|
+
gem "sinatra-exstatic-assets", :require => "sinatra/exstatic_assets"
|
35
44
|
|
36
45
|
### Usage ###
|
37
46
|
|
38
47
|
Here's a quick example, but there are more in the `examples` directory:
|
39
48
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
%
|
62
|
-
|
63
|
-
|
49
|
+
|
50
|
+
require 'sinatra'
|
51
|
+
require 'haml' # the lib doesn't rely on Haml, it's engine agnostic:)
|
52
|
+
require 'sinatra/exstatic_assets'
|
53
|
+
|
54
|
+
enable :inline_templates # the interesting bit below
|
55
|
+
|
56
|
+
get "/" do
|
57
|
+
haml :index
|
58
|
+
end
|
59
|
+
|
60
|
+
__END__
|
61
|
+
|
62
|
+
@@layout
|
63
|
+
|
64
|
+
!!!
|
65
|
+
%title Example
|
66
|
+
= favicon
|
67
|
+
= css_tag "/css/screen.css"
|
68
|
+
= js_tag "/js/helpers.js"
|
69
|
+
= js_tag "http://code.jquery.com/jquery-1.9.1.min.js"
|
70
|
+
%body
|
71
|
+
= yield
|
72
|
+
|
73
|
+
@@index
|
74
|
+
|
75
|
+
%dt
|
76
|
+
%dd This is an interesting photo
|
77
|
+
%dl
|
78
|
+
%a{ href: "http://www.flickr.com/photos/redfernneil/1317915651/" }
|
79
|
+
= img "http://www.flickr.com/photos/redfernneil/1317915651/" width: 500, height: 250, alt: "Something about the photo"
|
80
|
+
|
64
81
|
|
65
82
|
There is also more detailed documentation on each helper in the {Sinatra::Exstatic::Helpers} API docs.
|
66
83
|
|
@@ -69,7 +86,7 @@ There is also more detailed documentation on each helper in the {Sinatra::Exstat
|
|
69
86
|
* Make it easy to pass in caching options.
|
70
87
|
* Default dirs set up for things like /css, /images etc.
|
71
88
|
* An image link tag.
|
72
|
-
* Caching of the timestamps (but I'm not sure it's needed or worth it).
|
89
|
+
* Caching of the timestamps (but I'm not sure it's needed or worth it).
|
73
90
|
|
74
91
|
### Licence ###
|
75
92
|
|
data/Rakefile
CHANGED
data/examples/app2/main.rb
CHANGED
@@ -12,9 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{A Sinatra extension of helpers for static assets.}
|
13
13
|
s.description = %q{Helpers for writing the HTML and caching of static assets. A fork of Sinatra Static Assets.}
|
14
14
|
|
15
|
-
s.
|
15
|
+
s.add_runtime_dependency 'sinatra', '~>1'
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.require_paths = ["lib"]
|
20
|
+
s.license = "LICENCE.txt"
|
20
21
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/static_assets_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Asset, :time_sensitive do
|
|
19
19
|
it { should == expected }
|
20
20
|
its(:fullpath) { should == fullpath }
|
21
21
|
its(:timestamp) { should == Time.now.to_i }
|
22
|
-
its(:"is_uri?") { should
|
22
|
+
its(:"is_uri?") { should be_falsy }
|
23
23
|
its(:querystring) { should == "?ts=#{Time.now.to_i}" }
|
24
24
|
end
|
25
25
|
context "Given a url" do
|
@@ -29,7 +29,7 @@ describe Asset, :time_sensitive do
|
|
29
29
|
it { should == expected }
|
30
30
|
its(:fullpath) { should be_nil }
|
31
31
|
its(:timestamp) { should == false }
|
32
|
-
its(:"is_uri?") { should
|
32
|
+
its(:"is_uri?") { should be_truthy }
|
33
33
|
its(:querystring) { should be_nil }
|
34
34
|
end
|
35
35
|
end
|
@@ -98,10 +98,21 @@ describe "Private methods", :time_sensitive do
|
|
98
98
|
context "Stylesheets" do
|
99
99
|
let(:url) { "/stylesheets/winter.css" }
|
100
100
|
let(:filename) { "/stylesheets/winter.css" }
|
101
|
-
|
102
|
-
|
101
|
+
context "Given a filename" do
|
102
|
+
context "But no options" do
|
103
|
+
let(:expected) { %Q!<link charset="utf-8" href="/bar/stylesheets/winter.css?ts=#{time}" media="screen" rel="stylesheet" />! }
|
104
|
+
subject { o.send :sss_stylesheet_tag, url }
|
105
|
+
it { should == expected }
|
106
|
+
end
|
107
|
+
context "with options" do
|
108
|
+
context "media=print" do
|
109
|
+
let(:expected) { %Q!<link charset="utf-8" href="/bar/stylesheets/winter.css?ts=#{time}" media="print" rel="stylesheet" />! }
|
110
|
+
subject { o.send :sss_stylesheet_tag, url, media: "print" }
|
111
|
+
it { should == expected }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
103
115
|
it { should_not be_nil }
|
104
|
-
it { should == expected }
|
105
116
|
end
|
106
117
|
context "Javascripts" do
|
107
118
|
let(:url) { "/js/get_stuff.js" }
|
@@ -131,6 +142,17 @@ describe "Private methods", :time_sensitive do
|
|
131
142
|
it { should_not be_nil }
|
132
143
|
it { should == expected }
|
133
144
|
end
|
145
|
+
context "Remote and secure" do
|
146
|
+
let(:url) { "https://example.org/images/foo.png" }
|
147
|
+
let(:filename) { "/images/foo.png" }
|
148
|
+
let(:expected) { %Q!<img src="#{url}" />! }
|
149
|
+
subject {
|
150
|
+
o.send :sss_image_tag,
|
151
|
+
url
|
152
|
+
}
|
153
|
+
it { should_not be_nil }
|
154
|
+
it { should == expected }
|
155
|
+
end
|
134
156
|
end
|
135
157
|
end
|
136
158
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-exstatic-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Włodek Bzyl
|
@@ -10,24 +9,22 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: sinatra
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
20
|
+
version: '1'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - "~>"
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version: '
|
27
|
+
version: '1'
|
31
28
|
description: Helpers for writing the HTML and caching of static assets. A fork of
|
32
29
|
Sinatra Static Assets.
|
33
30
|
email:
|
@@ -36,8 +33,8 @@ executables: []
|
|
36
33
|
extensions: []
|
37
34
|
extra_rdoc_files: []
|
38
35
|
files:
|
39
|
-
- .gitignore
|
40
|
-
- .travis.yml
|
36
|
+
- ".gitignore"
|
37
|
+
- ".travis.yml"
|
41
38
|
- CHANGES.md
|
42
39
|
- Gemfile
|
43
40
|
- LICENCE
|
@@ -72,28 +69,28 @@ files:
|
|
72
69
|
- spec/support/fixtures/main.txt
|
73
70
|
- spec/support/shared/all_routes.rb
|
74
71
|
homepage: https://github.com/yb66/sinatra-exstatic-assets
|
75
|
-
licenses:
|
72
|
+
licenses:
|
73
|
+
- LICENCE.txt
|
74
|
+
metadata: {}
|
76
75
|
post_install_message:
|
77
76
|
rdoc_options: []
|
78
77
|
require_paths:
|
79
78
|
- lib
|
80
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
80
|
requirements:
|
83
|
-
- -
|
81
|
+
- - ">="
|
84
82
|
- !ruby/object:Gem::Version
|
85
83
|
version: '0'
|
86
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
85
|
requirements:
|
89
|
-
- -
|
86
|
+
- - ">="
|
90
87
|
- !ruby/object:Gem::Version
|
91
88
|
version: '0'
|
92
89
|
requirements: []
|
93
90
|
rubyforge_project:
|
94
|
-
rubygems_version:
|
91
|
+
rubygems_version: 2.4.5
|
95
92
|
signing_key:
|
96
|
-
specification_version:
|
93
|
+
specification_version: 4
|
97
94
|
summary: A Sinatra extension of helpers for static assets.
|
98
95
|
test_files:
|
99
96
|
- spec/spec_helper.rb
|