publify_amazon_sidebar 9.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 70153b061e120188cd90b43cb5ff74d9c6f5961d
4
+ data.tar.gz: 83749154210af41d0571126a259868f37463932c
5
+ SHA512:
6
+ metadata.gz: 7a9e934fabb2630b654e9f3c7ac533a9353d547ebe61132a5bfbb6239a83d28fd1a2d2d052fd218aa37d424fb7c83e7bcff9654206a8609bd5c05472d5e899a1
7
+ data.tar.gz: 09a4abc96de7cfd5670f7ba8a353590ee09fa819917339b81b155f15039999c9614c3cdaea1f28b4f8a086a265f3e15542e485a4b220fcc0f13357e6683d1a25
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2005 Tobias Luetke
2
+ Copyright 2016 Matijs van Zuijlen
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = PublifyAmazonSidebar
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
8
+ load 'rails/tasks/engine.rake'
9
+
10
+ load 'rails/tasks/statistics.rake'
11
+
12
+ Bundler::GemHelper.install_tasks
13
+
14
+ require 'rspec/core/rake_task'
15
+
16
+ desc 'Run all specs in spec directory (excluding plugin specs)'
17
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
18
+
19
+ task default: :spec
20
+
21
+ require 'rubocop/rake_task'
22
+ RuboCop::RakeTask.new do |task|
23
+ task.options = ['--config', '.rubocop.yml']
24
+ end
25
+ task default: :rubocop
@@ -0,0 +1,17 @@
1
+ class AmazonSidebar < Sidebar
2
+ description \
3
+ 'Adds sidebar links to any Amazon.com books linked in the body of the page'
4
+ setting :title, 'Cited books'
5
+ setting :associate_id, 'justasummary-20'
6
+ setting :maxlinks, 4
7
+
8
+ attr_accessor :asins
9
+
10
+ def parse_request(contents, _request_params)
11
+ asin_list = contents.to_a.map do |item|
12
+ item.whiteboard[:asins].to_a
13
+ end.flatten
14
+ self.asins = asin_list.uniq.compact[0, maxlinks.to_i]
15
+ end
16
+ end
17
+ SidebarRegistry.register_sidebar AmazonSidebar
@@ -0,0 +1,11 @@
1
+ <% unless sidebar.asins.empty? %>
2
+ <h3 class="sidebar-title"><%= h sidebar.title %></h3>
3
+ <div class="sidebar-body" id="amazon_links">
4
+ <% for asin in sidebar.asins %>
5
+ <% url = "http://rcm.amazon.com/e/cm?t=#{@sidebar.associate_id}&o=1&p=8&l=as1&asins=#{asin}&fc1=000000&IS2=1&lt1=_blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr" %>
6
+ <iframe src="<%= url %>" style="width:120px;height:240px;" scrolling="no"
7
+ marginwidth="0" marginheight="0" frameborder="0">
8
+ </iframe>
9
+ <% end %>
10
+ </div>
11
+ <% end %>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,4 @@
1
+ module PublifyAmazonSidebar
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module PublifyAmazonSidebar
2
+ VERSION = '9.0.0.pre1'.freeze
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'publify_core'
2
+ require 'publify_amazon_sidebar/engine'
3
+ require 'sidebar_registry'
4
+
5
+ module PublifyAmazonSidebar
6
+ SidebarRegistry.register_sidebar 'AmazonSidebar'
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :publify_amazon_sidebar do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: publify_amazon_sidebar
3
+ version: !ruby/object:Gem::Version
4
+ version: 9.0.0.pre1
5
+ platform: ruby
6
+ authors:
7
+ - Matijs van Zuijlen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: publify_core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 9.0.0.pre1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 9.0.0.pre1
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.5.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.5.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.45.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.45.0
83
+ description: Amazon sidebar for the Publify blogging system.
84
+ email:
85
+ - matijs@matijs.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - MIT-LICENSE
91
+ - README.rdoc
92
+ - Rakefile
93
+ - app/models/amazon_sidebar.rb
94
+ - app/views/amazon_sidebar/_content.html.erb
95
+ - config/routes.rb
96
+ - lib/publify_amazon_sidebar.rb
97
+ - lib/publify_amazon_sidebar/engine.rb
98
+ - lib/publify_amazon_sidebar/version.rb
99
+ - lib/tasks/publify_amazon_sidebar_tasks.rake
100
+ homepage: https://publify.co
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.1
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.5.1
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Amazon sidebar for the Publify blogging system.
124
+ test_files: []