piggybak 0.3.1 → 0.3.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.
Files changed (73) hide show
  1. data/Gemfile +10 -3
  2. data/Gemfile.lock +85 -2
  3. data/README.md +4 -0
  4. data/Rakefile +10 -24
  5. data/VERSION +1 -1
  6. data/app/assets/javascripts/piggybak.js +1 -1
  7. data/app/controllers/piggybak/orders_controller.rb +24 -30
  8. data/app/helpers/piggybak_helper.rb +1 -1
  9. data/app/mailers/piggybak/notifier.rb +2 -0
  10. data/app/models/piggybak/cart.rb +11 -3
  11. data/app/models/piggybak/tax_calculator/percent.rb +2 -2
  12. data/app/views/piggybak/orders/{show.html.erb → submit.html.erb} +1 -1
  13. data/app/views/rails_admin/main/_no_edit_form_filtering_select.html.haml +2 -1
  14. data/config/routes.rb +1 -2
  15. data/lib/piggybak/config.rb +3 -0
  16. data/piggybak.gemspec +101 -8
  17. data/spec/TODO +5 -0
  18. data/spec/database_helpers.rb +15 -0
  19. data/spec/dummy_app/.gitignore +15 -0
  20. data/spec/dummy_app/Gemfile +17 -0
  21. data/spec/dummy_app/Gemfile.lock +190 -0
  22. data/spec/dummy_app/Rakefile +7 -0
  23. data/spec/dummy_app/app/assets/images/rails.png +0 -0
  24. data/spec/dummy_app/app/assets/javascripts/application.js +9 -0
  25. data/spec/dummy_app/app/assets/javascripts/images.js.coffee +3 -0
  26. data/spec/dummy_app/app/assets/stylesheets/application.css +7 -0
  27. data/spec/dummy_app/app/assets/stylesheets/images.css.scss +3 -0
  28. data/spec/dummy_app/app/controllers/application_controller.rb +3 -0
  29. data/spec/dummy_app/app/controllers/images_controller.rb +9 -0
  30. data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
  31. data/spec/dummy_app/app/helpers/images_helper.rb +2 -0
  32. data/spec/dummy_app/app/mailers/.gitkeep +0 -0
  33. data/spec/dummy_app/app/models/.gitkeep +0 -0
  34. data/spec/dummy_app/app/models/image.rb +3 -0
  35. data/spec/dummy_app/app/models/user.rb +9 -0
  36. data/spec/dummy_app/app/views/images/index.html +3 -0
  37. data/spec/dummy_app/app/views/layouts/application.html.erb +14 -0
  38. data/spec/dummy_app/config.ru +4 -0
  39. data/spec/dummy_app/config/application.rb +49 -0
  40. data/spec/dummy_app/config/boot.rb +6 -0
  41. data/spec/dummy_app/config/database.yml +25 -0
  42. data/spec/dummy_app/config/environment.rb +5 -0
  43. data/spec/dummy_app/config/environments/development.rb +30 -0
  44. data/spec/dummy_app/config/environments/production.rb +60 -0
  45. data/spec/dummy_app/config/environments/test.rb +39 -0
  46. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/dummy_app/config/initializers/devise.rb +209 -0
  48. data/spec/dummy_app/config/initializers/inflections.rb +10 -0
  49. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  50. data/spec/dummy_app/config/initializers/quiet_assets.rb +10 -0
  51. data/spec/dummy_app/config/initializers/secret_token.rb +7 -0
  52. data/spec/dummy_app/config/initializers/session_store.rb +8 -0
  53. data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
  54. data/spec/dummy_app/config/locales/devise.en.yml +58 -0
  55. data/spec/dummy_app/config/locales/en.yml +5 -0
  56. data/spec/dummy_app/config/routes.rb +9 -0
  57. data/spec/dummy_app/db/migrate/20120119002503_create_images.rb +9 -0
  58. data/spec/dummy_app/db/migrate/20120119003643_devise_create_users.rb +25 -0
  59. data/spec/dummy_app/db/schema.rb +40 -0
  60. data/spec/dummy_app/db/seeds.rb +7 -0
  61. data/spec/dummy_app/lib/assets/.gitkeep +0 -0
  62. data/spec/dummy_app/lib/tasks/.gitkeep +0 -0
  63. data/spec/dummy_app/public/404.html +26 -0
  64. data/spec/dummy_app/public/422.html +26 -0
  65. data/spec/dummy_app/public/500.html +26 -0
  66. data/spec/dummy_app/public/favicon.ico +0 -0
  67. data/spec/dummy_app/public/robots.txt +5 -0
  68. data/spec/dummy_app/script/rails +6 -0
  69. data/spec/factories.rb +16 -0
  70. data/spec/models/line_item_spec.rb +5 -0
  71. data/spec/models/order_spec.rb +8 -0
  72. data/spec/spec_helper.rb +48 -0
  73. metadata +321 -84
@@ -0,0 +1,5 @@
1
+ # Test shipping returns rates
2
+ # Test tax returns rate
3
+ # Test checkout with logged in, logged out user
4
+ # Test create, delete, update of line items and quantities
5
+ # Test various validations on order
@@ -0,0 +1,15 @@
1
+ module DatabaseHelpers
2
+
3
+ def migrate_database
4
+ silence_stream(STDOUT) do
5
+ ActiveRecord::Migrator.migrate File.expand_path('../dummy_app/db/migrate/', __FILE__)
6
+ end
7
+ end
8
+
9
+ def drop_all_tables
10
+ ActiveRecord::Base.connection.tables.each do |table|
11
+ ActiveRecord::Base.connection.drop_table(table)
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,15 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+
13
+ # Ignore all logfiles and tempfiles.
14
+ /log/*.log
15
+ /tmp
@@ -0,0 +1,17 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '3.1.3'
4
+ gem 'sqlite3'
5
+ gem 'json'
6
+ gem 'devise'
7
+ gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
8
+ gem 'piggybak', :path => '../../'
9
+ gem 'jquery-rails'
10
+ gem 'execjs'
11
+ gem 'therubyracer'
12
+
13
+ group :assets do
14
+ gem 'sass-rails', '~> 3.1.5'
15
+ gem 'coffee-rails', '~> 3.1.1'
16
+ gem 'uglifier', '>= 1.0.3'
17
+ end
@@ -0,0 +1,190 @@
1
+ GIT
2
+ remote: git://github.com/sferik/rails_admin.git
3
+ revision: 9bd785a9c9ab8b5f09d2a0233d70bb1f10e59cc5
4
+ specs:
5
+ rails_admin (0.0.1)
6
+ bbenezech-nested_form (~> 0.0)
7
+ bootstrap-sass (~> 1.4, >= 1.4.1)
8
+ builder (~> 3.0)
9
+ coffee-rails (~> 3.1)
10
+ haml (~> 3.1)
11
+ jquery-rails (>= 1.0)
12
+ kaminari (~> 0.12)
13
+ rack-pjax (~> 0.5)
14
+ rails (~> 3.1)
15
+ remotipart (~> 1.0)
16
+
17
+ PATH
18
+ remote: ../../
19
+ specs:
20
+ piggybak (0.3.1)
21
+ activemerchant
22
+ countries
23
+ countries
24
+ devise
25
+ rails_admin
26
+
27
+ GEM
28
+ remote: http://rubygems.org/
29
+ specs:
30
+ actionmailer (3.1.3)
31
+ actionpack (= 3.1.3)
32
+ mail (~> 2.3.0)
33
+ actionpack (3.1.3)
34
+ activemodel (= 3.1.3)
35
+ activesupport (= 3.1.3)
36
+ builder (~> 3.0.0)
37
+ erubis (~> 2.7.0)
38
+ i18n (~> 0.6)
39
+ rack (~> 1.3.5)
40
+ rack-cache (~> 1.1)
41
+ rack-mount (~> 0.8.2)
42
+ rack-test (~> 0.6.1)
43
+ sprockets (~> 2.0.3)
44
+ active_utils (1.0.2)
45
+ activesupport (>= 2.3.11)
46
+ i18n
47
+ activemerchant (1.20.2)
48
+ active_utils (>= 1.0.2)
49
+ activesupport (>= 2.3.11)
50
+ braintree (>= 2.0.0)
51
+ builder (>= 2.0.0)
52
+ i18n
53
+ json (>= 1.5.1)
54
+ money (<= 3.7.1)
55
+ activemodel (3.1.3)
56
+ activesupport (= 3.1.3)
57
+ builder (~> 3.0.0)
58
+ i18n (~> 0.6)
59
+ activerecord (3.1.3)
60
+ activemodel (= 3.1.3)
61
+ activesupport (= 3.1.3)
62
+ arel (~> 2.2.1)
63
+ tzinfo (~> 0.3.29)
64
+ activeresource (3.1.3)
65
+ activemodel (= 3.1.3)
66
+ activesupport (= 3.1.3)
67
+ activesupport (3.1.3)
68
+ multi_json (~> 1.0)
69
+ arel (2.2.1)
70
+ bbenezech-nested_form (0.0.2)
71
+ bcrypt-ruby (3.0.1)
72
+ bootstrap-sass (1.4.4)
73
+ sass-rails (~> 3.1)
74
+ braintree (2.13.2)
75
+ builder (>= 2.0.0)
76
+ builder (3.0.0)
77
+ coffee-rails (3.1.1)
78
+ coffee-script (>= 2.2.0)
79
+ railties (~> 3.1.0)
80
+ coffee-script (2.2.0)
81
+ coffee-script-source
82
+ execjs
83
+ coffee-script-source (1.2.0)
84
+ countries (0.8.1)
85
+ currencies (= 0.4.0)
86
+ currencies (>= 0.2.0)
87
+ currencies (0.4.0)
88
+ devise (1.5.3)
89
+ bcrypt-ruby (~> 3.0)
90
+ orm_adapter (~> 0.0.3)
91
+ warden (~> 1.1)
92
+ erubis (2.7.0)
93
+ execjs (1.2.13)
94
+ multi_json (~> 1.0)
95
+ haml (3.1.4)
96
+ hike (1.2.1)
97
+ hpricot (0.8.6)
98
+ i18n (0.6.0)
99
+ jquery-rails (1.0.19)
100
+ railties (~> 3.0)
101
+ thor (~> 0.14)
102
+ json (1.6.5)
103
+ kaminari (0.13.0)
104
+ actionpack (>= 3.0.0)
105
+ activesupport (>= 3.0.0)
106
+ railties (>= 3.0.0)
107
+ libv8 (3.3.10.4)
108
+ mail (2.3.0)
109
+ i18n (>= 0.4.0)
110
+ mime-types (~> 1.16)
111
+ treetop (~> 1.4.8)
112
+ mime-types (1.17.2)
113
+ money (3.7.1)
114
+ i18n (~> 0.4)
115
+ multi_json (1.0.4)
116
+ orm_adapter (0.0.6)
117
+ polyglot (0.3.3)
118
+ rack (1.3.6)
119
+ rack-cache (1.1)
120
+ rack (>= 0.4)
121
+ rack-mount (0.8.3)
122
+ rack (>= 1.0.0)
123
+ rack-pjax (0.5.5)
124
+ hpricot (~> 0.8.4)
125
+ rack (~> 1.3)
126
+ rack-ssl (1.3.2)
127
+ rack
128
+ rack-test (0.6.1)
129
+ rack (>= 1.0)
130
+ rails (3.1.3)
131
+ actionmailer (= 3.1.3)
132
+ actionpack (= 3.1.3)
133
+ activerecord (= 3.1.3)
134
+ activeresource (= 3.1.3)
135
+ activesupport (= 3.1.3)
136
+ bundler (~> 1.0)
137
+ railties (= 3.1.3)
138
+ railties (3.1.3)
139
+ actionpack (= 3.1.3)
140
+ activesupport (= 3.1.3)
141
+ rack-ssl (~> 1.3.2)
142
+ rake (>= 0.8.7)
143
+ rdoc (~> 3.4)
144
+ thor (~> 0.14.6)
145
+ rake (0.9.2.2)
146
+ rdoc (3.12)
147
+ json (~> 1.4)
148
+ remotipart (1.0.1)
149
+ sass (3.1.12)
150
+ sass-rails (3.1.5)
151
+ actionpack (~> 3.1.0)
152
+ railties (~> 3.1.0)
153
+ sass (~> 3.1.10)
154
+ tilt (~> 1.3.2)
155
+ sprockets (2.0.3)
156
+ hike (~> 1.2)
157
+ rack (~> 1.0)
158
+ tilt (~> 1.1, != 1.3.0)
159
+ sqlite3 (1.3.5)
160
+ therubyracer (0.9.9)
161
+ libv8 (~> 3.3.10)
162
+ thor (0.14.6)
163
+ tilt (1.3.3)
164
+ treetop (1.4.10)
165
+ polyglot
166
+ polyglot (>= 0.3.1)
167
+ tzinfo (0.3.31)
168
+ uglifier (1.2.2)
169
+ execjs (>= 0.3.0)
170
+ multi_json (>= 1.0.2)
171
+ warden (1.1.0)
172
+ rack (>= 1.0)
173
+
174
+ PLATFORMS
175
+ ruby
176
+
177
+ DEPENDENCIES
178
+ coffee-rails (~> 3.1.1)
179
+ devise
180
+ execjs
181
+ jquery-rails
182
+ json
183
+ piggybak!
184
+ rails (= 3.1.3)
185
+ rails_admin!
186
+ sass-rails (~> 3.1.5)
187
+ sqlite3
188
+ therubyracer
189
+ tzinfo
190
+ uglifier (>= 1.0.3)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ DummyApp::Application.load_tasks
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Images controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,9 @@
1
+ class ImagesController < ApplicationController
2
+ def index
3
+ @images = Image.all
4
+ end
5
+
6
+ def show
7
+ @image = Image.find(params[:id])
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module ImagesHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ class Image < ActiveRecord::Base
2
+ acts_as_variant
3
+ end
@@ -0,0 +1,9 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
+ devise :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :trackable, :validatable
6
+
7
+ # Setup accessible (or protected) attributes for your model
8
+ attr_accessible :email, :password, :password_confirmation, :remember_me
9
+ end
@@ -0,0 +1,3 @@
1
+ <% @images.each do |image| -%>
2
+ <%= link_to image.title, image_url(image.id) %>
3
+ <% end -%>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>DummyApp</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run DummyApp::Application
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+ require 'devise'
5
+
6
+ if defined?(Bundler)
7
+ # If you precompile assets before deploying to production, use this line
8
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
9
+ # If you want your assets lazily compiled in production, use this line
10
+ # Bundler.require(:default, :assets, Rails.env)
11
+ end
12
+
13
+ module DummyApp
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Custom directories with classes and modules you want to be autoloadable.
20
+ # config.autoload_paths += %W(#{config.root}/extras)
21
+
22
+ # Only load the plugins named here, in the order given (default is alphabetical).
23
+ # :all can be used as a placeholder for all plugins not explicitly named.
24
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
+
26
+ # Activate observers that should always be running.
27
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28
+
29
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
30
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
31
+ # config.time_zone = 'Central Time (US & Canada)'
32
+
33
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
34
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
35
+ # config.i18n.default_locale = :de
36
+
37
+ # Configure the default encoding used in templates for Ruby 1.9.
38
+ config.encoding = "utf-8"
39
+
40
+ # Configure sensitive parameters which will be filtered from the log file.
41
+ config.filter_parameters += [:password]
42
+
43
+ # Enable the asset pipeline
44
+ config.assets.enabled = true
45
+
46
+ # Version of your assets, change this if you want to expire all your assets
47
+ config.assets.version = '1.0'
48
+ end
49
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ DummyApp::Application.initialize!