google-webfonts 0.1.1 → 0.1.2
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.
- data/README.md +61 -13
- data/google-webfonts.gemspec +11 -7
- data/lib/google-webfonts.rb +2 -0
- data/lib/google-webfonts/sinatra.rb +3 -0
- data/lib/google-webfonts/version.rb +1 -1
- data/spec/google-webfonts/sinatra_spec.rb +23 -0
- data/spec/google-webfonts/version_spec.rb +2 -2
- data/spec/google-webfonts_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +28 -13
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Google::Webfonts
|
2
2
|
|
3
|
-
Provides a helper for using Google Webfonts in
|
4
|
-
|
3
|
+
Provides a helper for using [Google Webfonts](http://www.google.com/webfonts) in
|
4
|
+
Rails or Sinatra, although it can be used outside of those frameworks as well.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -17,24 +17,71 @@ Or install it yourself as:
|
|
17
17
|
|
18
18
|
$ gem install google-webfonts
|
19
19
|
|
20
|
-
|
21
20
|
## Usage
|
22
21
|
|
23
|
-
|
22
|
+
### Syntax
|
23
|
+
|
24
|
+
google_webfonts_link_tag :font_name => [sizes], ...
|
24
25
|
|
25
26
|
### Examples
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
Basic usage:
|
29
|
+
|
30
|
+
google_webfonts_link_tag :droid_sans => [400, 700],
|
31
|
+
:yanone_kaffeesatz => [300, 400]
|
32
|
+
|
33
|
+
The sizes are optional, and do not have to be in an Array if you are only
|
34
|
+
including one size. For example:
|
35
|
+
|
36
|
+
google_webfonts_link_tag :droid_sans
|
37
|
+
# => generates a tag for Droid+Sans without specifying the font weight
|
38
|
+
|
39
|
+
google_webfonts_link_tag :droid_sans => 400
|
40
|
+
# => generates a tag for Droid+Sans with 400 weight
|
41
|
+
|
42
|
+
google_webfonts_link_tag :droid_sans => [400, 700]
|
43
|
+
# => generates a tag for Droid+Sans with 400 and 700 weights
|
44
|
+
|
45
|
+
You can also use a String instead of a Symbol if you'd prefer. For example:
|
46
|
+
|
47
|
+
google_webfonts_link_tag "Droid Sans", "Yanone Kaffeesatz" => 400
|
48
|
+
# includes Droid+Sans without a specified weight
|
49
|
+
# and Yanone+Kaffeesatz with weight 400
|
50
|
+
|
51
|
+
### Using in Rails
|
52
|
+
|
53
|
+
No additional work required to use this gem in a Rails application. Just add
|
54
|
+
it to your application's Gemfile, and it is automatically available in your
|
55
|
+
views.
|
56
|
+
|
57
|
+
You will, however, need to `include Google::Webfonts::Helper` if you want to use
|
58
|
+
it outside of a view.
|
59
|
+
|
60
|
+
### Using in Sinatra
|
61
|
+
|
62
|
+
Here is a simple "Hello World" example for using Google::Webfonts in a Sinatra
|
63
|
+
app:
|
30
64
|
|
31
|
-
#
|
32
|
-
|
65
|
+
# app.rb
|
66
|
+
require 'rubygems'
|
67
|
+
require 'sinatra'
|
68
|
+
require 'google-webfonts' # <= this must be required after 'sinatra'
|
33
69
|
|
34
|
-
|
35
|
-
|
36
|
-
|
70
|
+
get '/' do
|
71
|
+
erb :index
|
72
|
+
end
|
37
73
|
|
74
|
+
# views/index.erb
|
75
|
+
<html>
|
76
|
+
<head>
|
77
|
+
<%= google_webfonts_link_tag "Droid Sans" %>
|
78
|
+
</head>
|
79
|
+
<body>
|
80
|
+
<p style="font-family: 'Droid+Sans', sans-serif;">
|
81
|
+
Hello World!
|
82
|
+
</p>
|
83
|
+
</body>
|
84
|
+
</html>
|
38
85
|
|
39
86
|
## Contributing
|
40
87
|
|
@@ -42,4 +89,5 @@ Or install it yourself as:
|
|
42
89
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
90
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
44
91
|
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
-
5.
|
92
|
+
5. Ensure what your code is well tested, and all the tests pass. (`rspec spec`)
|
93
|
+
6. Create new Pull Request
|
data/google-webfonts.gemspec
CHANGED
@@ -4,19 +4,23 @@ require File.expand_path('../lib/google-webfonts/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Travis Haynes"]
|
6
6
|
gem.email = ["travis.j.haynes@gmail.com"]
|
7
|
-
|
8
|
-
gem.
|
9
|
-
gem.
|
7
|
+
|
8
|
+
gem.description = "Google Webfonts helper for Rails or Sinatra applications."
|
9
|
+
gem.summary = %q{Provides a helper for using Google Webfonts in Rails or
|
10
|
+
Sinatra, although it can be used outside of those frameworks as well.}
|
11
|
+
|
12
|
+
gem.homepage = "https://github.com/travishaynes/Google-Webfonts-Helper"
|
10
13
|
|
11
14
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
15
|
gem.files = `git ls-files`.split("\n")
|
13
|
-
gem.test_files = `git ls-files -- {
|
16
|
+
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
14
17
|
gem.name = "google-webfonts"
|
15
18
|
gem.require_paths = ["lib"]
|
16
19
|
gem.version = Google::Webfonts::VERSION
|
17
20
|
|
18
|
-
gem.add_runtime_dependency 'actionpack',
|
21
|
+
gem.add_runtime_dependency 'actionpack', '>= 3.0.0'
|
19
22
|
|
20
|
-
gem.add_development_dependency 'rspec',
|
21
|
-
gem.add_development_dependency 'tomdoc',
|
23
|
+
gem.add_development_dependency 'rspec', '~> 2.8.0'
|
24
|
+
gem.add_development_dependency 'yard-tomdoc', '~> 0.4.0'
|
25
|
+
gem.add_development_dependency 'sinatra', '~> 1.3.2'
|
22
26
|
end
|
data/lib/google-webfonts.rb
CHANGED
@@ -10,5 +10,7 @@ end
|
|
10
10
|
require "google-webfonts/version"
|
11
11
|
require "google-webfonts/helper"
|
12
12
|
|
13
|
+
require 'google-webfonts/sinatra' if defined? Sinatra
|
14
|
+
|
13
15
|
# include the webfonts helper methods in the Rails view helpers
|
14
16
|
ActionView::Base.send :include, Google::Webfonts::Helper
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# set up a Sinatra route to test
|
2
|
+
get("/") { google_webfonts_link_tag "Droid Sans" }
|
3
|
+
|
4
|
+
describe "Sinatra" do
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
def app
|
8
|
+
Sinatra::Application
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should include Google::Webfonts::Helper in Sinatra::Application" do
|
12
|
+
Sinatra::Application.ancestors.should include Google::Webfonts::Helper
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should respond to google_webfonts_link_tag" do
|
16
|
+
tag = "<link href=\"http://fonts.googleapis.com/css?family=Droid+Sans\" rel=\"stylesheet\" type=\"text/css\" />"
|
17
|
+
|
18
|
+
get "/"
|
19
|
+
|
20
|
+
last_response.should be_ok
|
21
|
+
last_response.body.should eq tag
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-webfonts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &17626300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *17626300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &17625580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,19 +32,30 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *17625580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name: tomdoc
|
38
|
-
requirement: &
|
37
|
+
name: yard-tomdoc
|
38
|
+
requirement: &17624820 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.
|
43
|
+
version: 0.4.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
|
46
|
+
version_requirements: *17624820
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sinatra
|
49
|
+
requirement: &17624100 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.2
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *17624100
|
58
|
+
description: Google Webfonts helper for Rails or Sinatra applications.
|
48
59
|
email:
|
49
60
|
- travis.j.haynes@gmail.com
|
50
61
|
executables: []
|
@@ -60,12 +71,14 @@ files:
|
|
60
71
|
- google-webfonts.gemspec
|
61
72
|
- lib/google-webfonts.rb
|
62
73
|
- lib/google-webfonts/helper.rb
|
74
|
+
- lib/google-webfonts/sinatra.rb
|
63
75
|
- lib/google-webfonts/version.rb
|
64
76
|
- spec/google-webfonts/helper_spec.rb
|
77
|
+
- spec/google-webfonts/sinatra_spec.rb
|
65
78
|
- spec/google-webfonts/version_spec.rb
|
66
79
|
- spec/google-webfonts_spec.rb
|
67
80
|
- spec/spec_helper.rb
|
68
|
-
homepage:
|
81
|
+
homepage: https://github.com/travishaynes/Google-Webfonts-Helper
|
69
82
|
licenses: []
|
70
83
|
post_install_message:
|
71
84
|
rdoc_options: []
|
@@ -88,5 +101,7 @@ rubyforge_project:
|
|
88
101
|
rubygems_version: 1.8.10
|
89
102
|
signing_key:
|
90
103
|
specification_version: 3
|
91
|
-
summary: Provides a helper for using Google Webfonts in
|
104
|
+
summary: Provides a helper for using Google Webfonts in Rails or Sinatra, although
|
105
|
+
it can be used outside of those frameworks as well.
|
92
106
|
test_files: []
|
107
|
+
has_rdoc:
|