pin_it 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pin_it.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Fanzter Inc
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ # PinIt
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'pin_it'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install pin_it
18
+
19
+ ## Usage
20
+
21
+ After adding the gem to your Rails app and running the bundle command,
22
+ you need to add this line to get the small JavaScript component included.
23
+ Put it in application.js
24
+
25
+ //= require pin_it
26
+
27
+ Then, in your views, do something like this:
28
+
29
+ <%= pin_it_button media: image_url(@photo.url)
30
+ description: @photo.description,
31
+ url: photo_url(@photo) %>
32
+
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ require "pin_it/version"
2
+ require "active_support/core_ext/object/to_query"
3
+
4
+ module PinIt
5
+ module Helper
6
+ def pin_it_button(options = {})
7
+ %{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="horizontal">Pin It</a>}
8
+ query_params = options.slice(:page_url, :media, :description)
9
+ content_tag :a, "Pin It", "href" => "http://pinterest.com/pin/create/button?#{query_params.to_query}",
10
+ "class" => "pin-it-button",
11
+ "count-layout" => "horizontal"
12
+ end
13
+ end
14
+
15
+ class Railtie < ::Rails::Railtie
16
+ initializer "pin_it.view_helpers" do |app|
17
+ ::ActionView::Base.send :include, PinIt::Helper
18
+ end
19
+ end
20
+
21
+ module Rails
22
+ class Engine < ::Rails::Engine
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module PinIt
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/pin_it/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Joshua Warchol"]
6
+ gem.email = ["joshua@fanzter.com"]
7
+ gem.description = %q{Rails helpers for adding Pinterest.com "Pin It" buttons to views}
8
+ gem.summary = %q{Rails helpers for "Pin It" buttons}
9
+ gem.homepage = "http://github.com/fanzter/pin_it"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "pin_it"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = PinIt::VERSION
17
+
18
+ gem.add_dependency "rails", ">= 2.3.0"
19
+ gem.add_development_dependency "rspec"
20
+ gem.add_development_dependency "rake"
21
+
22
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe PinIt::Helper do
4
+ before(:each) do
5
+ @view = ActionView::Base.new
6
+ end
7
+
8
+ describe "#pin_it_button" do
9
+ it "should be mixed into ActionView::Base" do
10
+ ActionView::Base.included_modules.include?(PinIt::Helper).should be_true
11
+ end
12
+
13
+ it "should respond to 'pin_it_button' helper" do
14
+ @view.should respond_to(:pin_it_button)
15
+ end
16
+
17
+ it "should return a pin it button" do
18
+ expected = %{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="horizontal">Pin It</a>}
19
+
20
+ @view.pin_it_button(url:"page_url", media: "img_url", description: "description").should_not be_nil
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,23 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ end
12
+
13
+ require 'rubygems'
14
+ require 'rails'
15
+ require 'action_controller'
16
+ require 'action_view'
17
+
18
+ require File.join(File.dirname(__FILE__), "../lib/pin_it")
19
+
20
+ ActionView::Base.class_eval do
21
+ include PinIt::Helper
22
+ end
23
+
@@ -0,0 +1,22 @@
1
+ (function() {
2
+ window.PinIt = window.PinIt || { loaded:false };
3
+ if (window.PinIt.loaded) return;
4
+ window.PinIt.loaded = true;
5
+ function async_load(){
6
+ var s = document.createElement("script");
7
+ s.type = "text/javascript";
8
+ s.async = true;
9
+ if (window.location.protocol == "https:")
10
+ s.src = "https://assets.pinterest.com/js/pinit.js";
11
+ else
12
+ s.src = "http://assets.pinterest.com/js/pinit.js";
13
+
14
+ var x = document.getElementsByTagName("script")[0];
15
+ x.parentNode.insertBefore(s, x);
16
+ }
17
+ if (window.attachEvent)
18
+ window.attachEvent("onload", async_load);
19
+ else
20
+ window.addEventListener("load", async_load, false);
21
+ })();
22
+
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pin_it
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joshua Warchol
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70211000659920 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.3.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70211000659920
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70211000659180 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70211000659180
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &70211000658520 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70211000658520
47
+ description: Rails helpers for adding Pinterest.com "Pin It" buttons to views
48
+ email:
49
+ - joshua@fanzter.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - .rspec
56
+ - Gemfile
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - lib/pin_it.rb
61
+ - lib/pin_it/version.rb
62
+ - pin_it.gemspec
63
+ - spec/pin_it_spec.rb
64
+ - spec/spec_helper.rb
65
+ - vendor/assets/javascripts/pin_it.js
66
+ homepage: http://github.com/fanzter/pin_it
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.15
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: Rails helpers for "Pin It" buttons
90
+ test_files:
91
+ - spec/pin_it_spec.rb
92
+ - spec/spec_helper.rb