spree_affiliate_links 1.1.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.
Files changed (35) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +213 -0
  5. data/LICENSE +26 -0
  6. data/README.md +44 -0
  7. data/Rakefile +29 -0
  8. data/Versionfile +11 -0
  9. data/app/assets/javascripts/admin/spree_affiliate_links.js +1 -0
  10. data/app/assets/javascripts/affiliate_links.js +2 -0
  11. data/app/assets/javascripts/store/spree_affiliate_links.js +1 -0
  12. data/app/assets/stylesheets/admin/spree_affiliate_links.css +3 -0
  13. data/app/assets/stylesheets/affiliate_links.css +4 -0
  14. data/app/assets/stylesheets/store/spree_affiliate_links.css +3 -0
  15. data/app/controllers/spree/admin/affiliate_links_controller.rb +9 -0
  16. data/app/helpers/affiliate_links_helper.rb +2 -0
  17. data/app/models/spree/affiliate_link.rb +8 -0
  18. data/app/overrides/admin/affiliate_links_tab.rb +6 -0
  19. data/app/views/spree/admin/affiliate_links/_form.html.erb +24 -0
  20. data/app/views/spree/admin/affiliate_links/edit.html.erb +7 -0
  21. data/app/views/spree/admin/affiliate_links/index.html.erb +38 -0
  22. data/app/views/spree/admin/affiliate_links/new.html.erb +7 -0
  23. data/config/locales/en.yml +11 -0
  24. data/config/routes.rb +7 -0
  25. data/db/migrate/20120907095802_create_affiliate_links.rb +10 -0
  26. data/lib/generators/spree_affiliate_links/install/install_generator.rb +29 -0
  27. data/lib/spree_affiliate_links/engine.rb +22 -0
  28. data/lib/spree_affiliate_links.rb +2 -0
  29. data/script/rails +7 -0
  30. data/spec/controllers/affiliate_links_controller_spec.rb +5 -0
  31. data/spec/helpers/affiliate_links_helper_spec.rb +15 -0
  32. data/spec/models/affiliate_link_spec.rb +5 -0
  33. data/spec/spec_helper.rb +44 -0
  34. data/spree_affiliate_links.gemspec +26 -0
  35. metadata +175 -0
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ tmp
8
+ nbproject
9
+ *.swp
10
+ spec/dummy
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'http://rubygems.org'
2
+
3
+ if RUBY_VERSION < '1.9'
4
+ gem 'ruby-debug'
5
+ else
6
+ gem 'debugger'
7
+ end
8
+
9
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,213 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spree_affiliate_links (1.1.3)
5
+ spree_core (~> 1.1.3)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.8)
11
+ actionpack (= 3.2.8)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.8)
14
+ activemodel (= 3.2.8)
15
+ activesupport (= 3.2.8)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.3)
23
+ active_utils (1.0.4)
24
+ activesupport (>= 2.3.11)
25
+ i18n
26
+ activemerchant (1.20.4)
27
+ active_utils (>= 1.0.2)
28
+ activesupport (>= 2.3.11)
29
+ braintree (>= 2.0.0)
30
+ builder (>= 2.0.0)
31
+ i18n
32
+ json (>= 1.5.1)
33
+ money (<= 3.7.1)
34
+ activemodel (3.2.8)
35
+ activesupport (= 3.2.8)
36
+ builder (~> 3.0.0)
37
+ activerecord (3.2.8)
38
+ activemodel (= 3.2.8)
39
+ activesupport (= 3.2.8)
40
+ arel (~> 3.0.2)
41
+ tzinfo (~> 0.3.29)
42
+ activeresource (3.2.8)
43
+ activemodel (= 3.2.8)
44
+ activesupport (= 3.2.8)
45
+ activesupport (3.2.8)
46
+ i18n (~> 0.6)
47
+ multi_json (~> 1.0)
48
+ acts_as_list (0.1.4)
49
+ addressable (2.3.2)
50
+ arel (3.0.2)
51
+ aws-sdk (1.3.9)
52
+ httparty (~> 0.7)
53
+ json (~> 1.4)
54
+ nokogiri (>= 1.4.4)
55
+ uuidtools (~> 2.1)
56
+ braintree (2.16.0)
57
+ builder (>= 2.0.0)
58
+ builder (3.0.2)
59
+ capybara (1.0.1)
60
+ mime-types (>= 1.16)
61
+ nokogiri (>= 1.3.3)
62
+ rack (>= 1.0.0)
63
+ rack-test (>= 0.5.4)
64
+ selenium-webdriver (~> 2.0)
65
+ xpath (~> 0.1.4)
66
+ childprocess (0.3.5)
67
+ ffi (~> 1.0, >= 1.0.6)
68
+ cocaine (0.3.0)
69
+ columnize (0.3.6)
70
+ debugger (1.2.0)
71
+ columnize (>= 0.3.1)
72
+ debugger-linecache (~> 1.1.1)
73
+ debugger-ruby_core_source (~> 1.1.3)
74
+ debugger-linecache (1.1.2)
75
+ debugger-ruby_core_source (>= 1.1.1)
76
+ debugger-ruby_core_source (1.1.3)
77
+ deface (0.9.1)
78
+ nokogiri (~> 1.5.0)
79
+ rails (~> 3.1)
80
+ diff-lcs (1.1.3)
81
+ erubis (2.7.0)
82
+ factory_girl (2.6.4)
83
+ activesupport (>= 2.3.9)
84
+ ffaker (1.12.1)
85
+ ffi (1.1.5)
86
+ highline (1.6.11)
87
+ hike (1.2.1)
88
+ httparty (0.8.3)
89
+ multi_json (~> 1.0)
90
+ multi_xml
91
+ i18n (0.6.1)
92
+ journey (1.0.4)
93
+ jquery-rails (2.0.3)
94
+ railties (>= 3.1.0, < 5.0)
95
+ thor (~> 0.14)
96
+ json (1.7.5)
97
+ kaminari (0.14.0)
98
+ actionpack (>= 3.0.0)
99
+ activesupport (>= 3.0.0)
100
+ libwebsocket (0.1.5)
101
+ addressable
102
+ mail (2.4.4)
103
+ i18n (>= 0.4.0)
104
+ mime-types (~> 1.16)
105
+ treetop (~> 1.4.8)
106
+ mime-types (1.19)
107
+ money (3.7.1)
108
+ i18n (~> 0.4)
109
+ multi_json (1.3.6)
110
+ multi_xml (0.5.1)
111
+ nested_set (1.7.0)
112
+ activerecord (>= 3.0.0)
113
+ railties (>= 3.0.0)
114
+ nokogiri (1.5.5)
115
+ paperclip (2.7.0)
116
+ activerecord (>= 2.3.0)
117
+ activesupport (>= 2.3.2)
118
+ cocaine (>= 0.0.2)
119
+ mime-types
120
+ polyamorous (0.5.0)
121
+ activerecord (~> 3.0)
122
+ polyglot (0.3.3)
123
+ rack (1.4.1)
124
+ rack-cache (1.2)
125
+ rack (>= 0.4)
126
+ rack-ssl (1.3.2)
127
+ rack
128
+ rack-test (0.6.1)
129
+ rack (>= 1.0)
130
+ rails (3.2.8)
131
+ actionmailer (= 3.2.8)
132
+ actionpack (= 3.2.8)
133
+ activerecord (= 3.2.8)
134
+ activeresource (= 3.2.8)
135
+ activesupport (= 3.2.8)
136
+ bundler (~> 1.0)
137
+ railties (= 3.2.8)
138
+ railties (3.2.8)
139
+ actionpack (= 3.2.8)
140
+ activesupport (= 3.2.8)
141
+ rack-ssl (~> 1.3.2)
142
+ rake (>= 0.8.7)
143
+ rdoc (~> 3.4)
144
+ thor (>= 0.14.6, < 2.0)
145
+ rake (0.9.2.2)
146
+ ransack (0.6.0)
147
+ actionpack (~> 3.0)
148
+ activerecord (~> 3.0)
149
+ polyamorous (~> 0.5.0)
150
+ rdoc (3.12)
151
+ json (~> 1.4)
152
+ rspec (2.11.0)
153
+ rspec-core (~> 2.11.0)
154
+ rspec-expectations (~> 2.11.0)
155
+ rspec-mocks (~> 2.11.0)
156
+ rspec-core (2.11.1)
157
+ rspec-expectations (2.11.3)
158
+ diff-lcs (~> 1.1.3)
159
+ rspec-mocks (2.11.2)
160
+ rspec-rails (2.11.0)
161
+ actionpack (>= 3.0)
162
+ activesupport (>= 3.0)
163
+ railties (>= 3.0)
164
+ rspec (~> 2.11.0)
165
+ rubyzip (0.9.9)
166
+ selenium-webdriver (2.25.0)
167
+ childprocess (>= 0.2.5)
168
+ libwebsocket (~> 0.1.3)
169
+ multi_json (~> 1.0)
170
+ rubyzip
171
+ spree_core (1.1.3)
172
+ activemerchant (= 1.20.4)
173
+ acts_as_list (= 0.1.4)
174
+ aws-sdk (~> 1.3.4)
175
+ deface (>= 0.9.0)
176
+ ffaker (~> 1.12.0)
177
+ highline (= 1.6.11)
178
+ jquery-rails (~> 2.0.0)
179
+ kaminari (>= 0.13.0)
180
+ nested_set (= 1.7.0)
181
+ paperclip (~> 2.7)
182
+ rails (~> 3.2.6)
183
+ ransack (~> 0.6.0)
184
+ state_machine (= 1.1.2)
185
+ stringex (~> 1.3.2)
186
+ sprockets (2.1.3)
187
+ hike (~> 1.2)
188
+ rack (~> 1.0)
189
+ tilt (~> 1.1, != 1.3.0)
190
+ sqlite3 (1.3.6)
191
+ state_machine (1.1.2)
192
+ stringex (1.3.3)
193
+ thor (0.16.0)
194
+ tilt (1.3.3)
195
+ treetop (1.4.10)
196
+ polyglot
197
+ polyglot (>= 0.3.1)
198
+ tzinfo (0.3.33)
199
+ uuidtools (2.1.3)
200
+ xpath (0.1.4)
201
+ nokogiri (~> 1.3)
202
+
203
+ PLATFORMS
204
+ ruby
205
+
206
+ DEPENDENCIES
207
+ capybara (= 1.0.1)
208
+ debugger
209
+ factory_girl (~> 2.6.4)
210
+ ffaker
211
+ rspec-rails (~> 2.9)
212
+ spree_affiliate_links!
213
+ sqlite3
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2012 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ SpreeAffiliateLinks
2
+ ===================
3
+
4
+ I needed a way to give my Spree client a way to add footer affiliate
5
+ images with links, and so I created an extension for that. Simple.
6
+
7
+ You'll find an "Affiliate Links" section in the admin tabs. An example
8
+ on how to display the links in the layout is below.
9
+
10
+ Example
11
+ =======
12
+
13
+ It's not hard to use, but here's a seed to get you started:
14
+
15
+ # app/overrides/footer_affiliate_links.rb
16
+ Deface::Override.new(
17
+ :name => "footer_affiliate_links",
18
+ :virtual_path => "spree/layouts/spree_application",
19
+ :insert_bottom => "#footer",
20
+ :partial => "affiliate_links/footer"
21
+ )
22
+
23
+ # app/views/affiliate_links/_footer.html.erb
24
+ <%= Spree::AffiliateLink.each do |link| %>
25
+ <a href="<%= link.destination_url %>">
26
+ <%= image_tag link.image.attachment.url(:small) %>
27
+ </a>
28
+ <% end %>
29
+
30
+ That'll get you all of the affiliate links in the footer. Currently,
31
+ there's no way to order them, and you'll have to add your own image size
32
+ to the Spree::Image paperclip configuration dynamically if you want
33
+ that.
34
+
35
+ Testing
36
+ -------
37
+
38
+ Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
39
+
40
+ $ bundle
41
+ $ bundle exec rake test_app
42
+ $ bundle exec rspec spec
43
+
44
+ Copyright (c) 2012 Sathya Sekaran, released under the New BSD License
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/packagetask'
4
+ require 'rubygems/package_task'
5
+ require 'rspec/core/rake_task'
6
+ require 'spree/core/testing_support/common_rake'
7
+
8
+ RSpec::Core::RakeTask.new
9
+
10
+ task :default => [:spec]
11
+
12
+ spec = eval(File.read('spree_affiliate_links.gemspec'))
13
+
14
+ Gem::PackageTask.new(spec) do |p|
15
+ p.gem_spec = spec
16
+ end
17
+
18
+ desc 'Release to gemcutter'
19
+ task :release => :package do
20
+ require 'rake/gemcutter'
21
+ Rake::Gemcutter::Tasks.new(spec).define
22
+ Rake::Task['gem:push'].invoke
23
+ end
24
+
25
+ desc 'Generates a dummy app for testing'
26
+ task :test_app do
27
+ ENV['LIB_NAME'] = 'spree_affiliate_links'
28
+ Rake::Task['common:test_app'].invoke
29
+ end
data/Versionfile ADDED
@@ -0,0 +1,11 @@
1
+ # This file is used to designate compatibilty with different versions of Spree
2
+ # Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
3
+
4
+ # Examples
5
+ #
6
+ # '1.2.x' => { :branch => 'master' }
7
+ # '1.1.x' => { :branch => '1-1-stable' }
8
+ # '1.0.x' => { :branch => '1-0-stable' }
9
+ # '0.70.x' => { :branch => '0-70-stable' }
10
+ # '0.40.x' => { :tag => 'v1.0.0', :version => '1.0.0' }
11
+
@@ -0,0 +1 @@
1
+ //= require admin/spree_core
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1 @@
1
+ //= require store/spree_core
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require admin/spree_core
3
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require store/spree_core
3
+ */
@@ -0,0 +1,9 @@
1
+ class Spree::Admin::AffiliateLinksController < Spree::Admin::ResourceController
2
+ def new
3
+ @affiliate_link = @object
4
+ end
5
+
6
+ def edit
7
+ @affiliate_link = @object
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ module AffiliateLinksHelper
2
+ end
@@ -0,0 +1,8 @@
1
+ module Spree
2
+ class AffiliateLink < ActiveRecord::Base
3
+ attr_accessible :destination_url, :name, :image_attributes
4
+
5
+ has_one :image, :class_name => 'Spree::Image', :as => :viewable, :dependent => :destroy, :validate => true
6
+ accepts_nested_attributes_for :image
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ :name => "affiliate_links_tab",
3
+ :virtual_path => "spree/layouts/admin",
4
+ :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
5
+ :text => '<%= tab :affiliate_links %>'
6
+ )
@@ -0,0 +1,24 @@
1
+ <div class="clearfix">
2
+ <%= f.field_container :name do %>
3
+ <%= f.label :name %> <span class="required">*</span><br />
4
+ <%= f.text_field :name, :class => 'fullwidth title' %>
5
+ <%= f.error_message_on :name %>
6
+ <% end %>
7
+
8
+ <%= f.field_container :destination_url do %>
9
+ <%= f.label :destination_url %> <span class="required">*</span><br />
10
+ <%= f.text_field :destination_url, :class => 'fullwidth title' %>
11
+ <%= f.error_message_on :destination_url %>
12
+ <% end %>
13
+
14
+ <%= f.fields_for :image_attributes, @affiliate_link.image || @affiliate_link.build_image do |image| %>
15
+ <%= f.field_container :image do %>
16
+ <%= image.label :attachment, 'Image' %><span class="required">*</span><br />
17
+ <%= image.file_field :attachment %>
18
+ <%= f.error_message_on :image %>
19
+ <% end %>
20
+ <% if image.object.present? %>
21
+ <%= image_tag image.object.attachment.url(:small) %>
22
+ <% end %>
23
+ <% end %>
24
+ </div>
@@ -0,0 +1,7 @@
1
+ <h1><%= t("affiliate_link.edit_link") %></h1>
2
+ <%= render "spree/shared/error_messages", :target => @affiliate_link %>
3
+
4
+ <%= form_for [:admin, @affiliate_link] do |f| %>
5
+ <%= render :partial => 'form', :locals => { :f => f } %>
6
+ <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
7
+ <% end %>
@@ -0,0 +1,38 @@
1
+ <div class='toolbar'>
2
+ <ul class='actions'>
3
+ <li id="new_product_link">
4
+ <%= button_link_to t("affiliate_link.new_link"), new_object_url, {:icon => 'add'} %>
5
+ </li>
6
+ </ul>
7
+ <br class='clear' />
8
+ </div>
9
+
10
+ <h1><%=t("affiliate_link.index_page") %></h1>
11
+
12
+ <table class="index">
13
+ <tr>
14
+ <th><%= t("affiliate_link.name") %></th>
15
+ <th><%= t("affiliate_link.destination_url") %></th>
16
+ <th><%= t("affiliate_link.image") %></th>
17
+ <th><%= t("action") %></th>
18
+ </tr>
19
+ <tbody>
20
+ <% @affiliate_links.each do |affiliate_link| %>
21
+ <tr class="<%= cycle('even', 'odd') %>" id="<%= dom_id affiliate_link %>">
22
+ <td>
23
+ <%= affiliate_link.name %>
24
+ </td>
25
+ <td>
26
+ <%= link_to affiliate_link.destination_url, affiliate_link.destination_url %>
27
+ </td>
28
+ <td>
29
+ <%= image_tag affiliate_link.image.attachment.url(:small) %>
30
+ </td>
31
+ <td>
32
+ <%= link_to_edit affiliate_link %> &nbsp;
33
+ <%= link_to_delete affiliate_link %>
34
+ </td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
@@ -0,0 +1,7 @@
1
+ <h1><%= t("affiliate_link.new_link") %></h1>
2
+ <%= render "spree/shared/error_messages", :target => @page %>
3
+
4
+ <%= form_for [:admin, @affiliate_link], :html => { :multipart => true } do |f| %>
5
+ <%= render :partial => 'form', :locals => { :f => f } %>
6
+ <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
7
+ <% end %>
@@ -0,0 +1,11 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+ ---
4
+ en:
5
+ affiliate_links: Affiliate Links
6
+ affiliate_link:
7
+ new_link: New Link
8
+ index_page: Affiliate Links
9
+ name: Name
10
+ destination_url: Destination Url
11
+ image: Image
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ Spree::Core::Engine.routes.prepend do
2
+ namespace :admin do
3
+ resources :affiliate_links
4
+ end
5
+
6
+ # Add your extension routes here
7
+ end
@@ -0,0 +1,10 @@
1
+ class CreateAffiliateLinks < ActiveRecord::Migration
2
+ def change
3
+ create_table :spree_affiliate_links do |t|
4
+ t.string :name
5
+ t.string :destination_url
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,29 @@
1
+ module SpreeAffiliateLinks
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ def add_javascripts
6
+ append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_affiliate_links\n"
7
+ append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_affiliate_links\n"
8
+ end
9
+
10
+ def add_stylesheets
11
+ inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_affiliate_links\n", :before => /\*\//, :verbose => true
12
+ inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_affiliate_links\n", :before => /\*\//, :verbose => true
13
+ end
14
+
15
+ def add_migrations
16
+ run 'bundle exec rake railties:install:migrations FROM=spree_affiliate_links'
17
+ end
18
+
19
+ def run_migrations
20
+ res = ask 'Would you like to run the migrations now? [Y/n]'
21
+ if res == '' || res.downcase == 'y'
22
+ run 'bundle exec rake db:migrate'
23
+ else
24
+ puts 'Skipping rake db:migrate, don\'t forget to run it!'
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ module SpreeAffiliateLinks
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name 'spree_affiliate_links'
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ # use rspec for tests
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ end
13
+
14
+ def self.activate
15
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
16
+ Rails.configuration.cache_classes ? require(c) : load(c)
17
+ end
18
+ end
19
+
20
+ config.to_prepare &method(:activate).to_proc
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ require 'spree_core'
2
+ require 'spree_affiliate_links/engine'
data/script/rails ADDED
@@ -0,0 +1,7 @@
1
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
2
+
3
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
4
+ ENGINE_PATH = File.expand_path('../../lib/spree_affiliate_links/engine', __FILE__)
5
+
6
+ require 'rails/all'
7
+ require 'rails/engine/commands'
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe AffiliateLinksController do
4
+
5
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ # Specs in this file have access to a helper object that includes
4
+ # the AffiliateLinksHelper. For example:
5
+ #
6
+ # describe AffiliateLinksHelper do
7
+ # describe "string concat" do
8
+ # it "concats two strings with spaces" do
9
+ # helper.concat_strings("this","that").should == "this that"
10
+ # end
11
+ # end
12
+ # end
13
+ describe AffiliateLinksHelper do
14
+ pending "add some examples to (or delete) #{__FILE__}"
15
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe AffiliateLink do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,44 @@
1
+ # Configure Rails Environment
2
+ ENV['RAILS_ENV'] = 'test'
3
+
4
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
5
+
6
+ require 'rspec/rails'
7
+ require 'ffaker'
8
+
9
+ # Requires supporting ruby files with custom matchers and macros, etc,
10
+ # in spec/support/ and its subdirectories.
11
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
12
+
13
+ # Requires factories defined in spree_core
14
+ require 'spree/core/testing_support/factories'
15
+ require 'spree/core/url_helpers'
16
+
17
+ RSpec.configure do |config|
18
+ config.include FactoryGirl::Syntax::Methods
19
+
20
+ # == URL Helpers
21
+ #
22
+ # Allows access to Spree's routes in specs:
23
+ #
24
+ # visit spree.admin_path
25
+ # current_path.should eql(spree.products_path)
26
+ config.include Spree::Core::UrlHelpers
27
+
28
+ # == Mock Framework
29
+ #
30
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
31
+ #
32
+ # config.mock_with :mocha
33
+ # config.mock_with :flexmock
34
+ # config.mock_with :rr
35
+ config.mock_with :rspec
36
+
37
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
38
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
39
+
40
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
41
+ # examples within a transaction, remove the following line or assign false
42
+ # instead of true.
43
+ config.use_transactional_fixtures = true
44
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_affiliate_links'
5
+ s.version = '1.1.3'
6
+ s.summary = 'Affiliate links with images for Spree using Paperclip.'
7
+ # s.description = 'TODO: Add (optional) gem description here'
8
+ s.required_ruby_version = '>= 1.8.7'
9
+
10
+ s.author = 'Sathya Sekaran'
11
+ s.email = 'sfsekaran@gmail.com'
12
+ s.homepage = 'http://sfsekaran.github.com/'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ # s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.require_path = 'lib'
17
+ s.requirements << 'none'
18
+
19
+ s.add_dependency 'spree_core', '~> 1.1.3'
20
+
21
+ s.add_development_dependency 'capybara', '1.0.1'
22
+ s.add_development_dependency 'factory_girl', '~> 2.6.4'
23
+ s.add_development_dependency 'ffaker'
24
+ s.add_development_dependency 'rspec-rails', '~> 2.9'
25
+ s.add_development_dependency 'sqlite3'
26
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_affiliate_links
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sathya Sekaran
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: spree_core
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: capybara
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - '='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.0.1
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: factory_girl
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.6.4
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.6.4
62
+ - !ruby/object:Gem::Dependency
63
+ name: ffaker
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec-rails
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '2.9'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '2.9'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sqlite3
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description:
111
+ email: sfsekaran@gmail.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - .gitignore
117
+ - .rspec
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - LICENSE
121
+ - README.md
122
+ - Rakefile
123
+ - Versionfile
124
+ - app/assets/javascripts/admin/spree_affiliate_links.js
125
+ - app/assets/javascripts/affiliate_links.js
126
+ - app/assets/javascripts/store/spree_affiliate_links.js
127
+ - app/assets/stylesheets/admin/spree_affiliate_links.css
128
+ - app/assets/stylesheets/affiliate_links.css
129
+ - app/assets/stylesheets/store/spree_affiliate_links.css
130
+ - app/controllers/spree/admin/affiliate_links_controller.rb
131
+ - app/helpers/affiliate_links_helper.rb
132
+ - app/models/spree/affiliate_link.rb
133
+ - app/overrides/admin/affiliate_links_tab.rb
134
+ - app/views/spree/admin/affiliate_links/_form.html.erb
135
+ - app/views/spree/admin/affiliate_links/edit.html.erb
136
+ - app/views/spree/admin/affiliate_links/index.html.erb
137
+ - app/views/spree/admin/affiliate_links/new.html.erb
138
+ - config/locales/en.yml
139
+ - config/routes.rb
140
+ - db/migrate/20120907095802_create_affiliate_links.rb
141
+ - lib/generators/spree_affiliate_links/install/install_generator.rb
142
+ - lib/spree_affiliate_links.rb
143
+ - lib/spree_affiliate_links/engine.rb
144
+ - script/rails
145
+ - spec/controllers/affiliate_links_controller_spec.rb
146
+ - spec/helpers/affiliate_links_helper_spec.rb
147
+ - spec/models/affiliate_link_spec.rb
148
+ - spec/spec_helper.rb
149
+ - spree_affiliate_links.gemspec
150
+ homepage: http://sfsekaran.github.com/
151
+ licenses: []
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: 1.8.7
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ! '>='
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements:
169
+ - none
170
+ rubyforge_project:
171
+ rubygems_version: 1.8.24
172
+ signing_key:
173
+ specification_version: 3
174
+ summary: Affiliate links with images for Spree using Paperclip.
175
+ test_files: []