google-webfonts 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Google::Webfonts
2
2
 
3
- Provides a helper for using Google Webfonts in a Rails application.
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
- webfonts_link_tag :font => [sizes], ...
22
+ ### Syntax
23
+
24
+ google_webfonts_link_tag :font_name => [sizes], ...
24
25
 
25
26
  ### Examples
26
27
 
27
- # generate a tag for Dosis and Revalia fonts
28
- # without a specified font weights
29
- webfonts_link_tag :dosis, :revalia
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
- # generate a tag for Droid+Sans in weights 400 and 700
32
- webfonts_link_tag :droid_sans => [400, 700]
65
+ # app.rb
66
+ require 'rubygems'
67
+ require 'sinatra'
68
+ require 'google-webfonts' # <= this must be required after 'sinatra'
33
69
 
34
- # generate a tag for the above font and
35
- # Yanone+Kaffeesatz in weights 300 and 400
36
- webfonts_link_tag :droid_sans => [400, 700], :yanone_kaffeesatz => [300, 400]
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. Create new Pull Request
92
+ 5. Ensure what your code is well tested, and all the tests pass. (`rspec spec`)
93
+ 6. Create new Pull Request
@@ -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
- gem.description = %q{Provides a helper for using Google Webfonts in a Rails application.}
8
- gem.summary = %q{Provides a helper for using Google Webfonts in a Rails application.}
9
- gem.homepage = ""
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 -- {test,spec,features}/*`.split("\n")
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', '>= 3.0.0'
21
+ gem.add_runtime_dependency 'actionpack', '>= 3.0.0'
19
22
 
20
- gem.add_development_dependency 'rspec', '~> 2.8.0'
21
- gem.add_development_dependency 'tomdoc', '~> 0.2.5'
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
@@ -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,3 @@
1
+ module Sinatra
2
+ helpers Google::Webfonts::Helper
3
+ end
@@ -1,6 +1,6 @@
1
1
  module Google
2
2
  module Webfonts
3
3
  # Public: Current version of the gem
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
@@ -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
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Google::Webfonts::VERSION do
4
- it "should be version 0.1.1" do
5
- Google::Webfonts::VERSION.should eq "0.1.1"
4
+ it "should be version 0.1.2" do
5
+ Google::Webfonts::VERSION.should eq "0.1.2"
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Google::Webfonts do
4
- it "should include Helper in ActionView" do
4
+ it "should include Helper in ActionView::Base" do
5
5
  ActionView::Base.ancestors.should include Google::Webfonts::Helper
6
6
  end
7
7
  end
@@ -1 +1,3 @@
1
+ require 'rubygems'
2
+ require 'sinatra'
1
3
  require "google-webfonts"
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.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-24 00:00:00.000000000 Z
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: &19610360 !ruby/object:Gem::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: *19610360
24
+ version_requirements: *17626300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &19609060 !ruby/object:Gem::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: *19609060
35
+ version_requirements: *17625580
36
36
  - !ruby/object:Gem::Dependency
37
- name: tomdoc
38
- requirement: &19608400 !ruby/object:Gem::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.2.5
43
+ version: 0.4.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *19608400
47
- description: Provides a helper for using Google Webfonts in a Rails application.
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 a Rails application.
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: