Skip to content
Browse files

Deprecated railsdog/spree location in favor of spree/spree

  • Loading branch information...
1 parent 3a3f8af commit 3ece21530934dba4e4d9752e404caafb2dde35f7 @schof schof committed Feb 1, 2011
Showing with 6 additions and 11,396 deletions.
  1. +0 −38 Gemfile
  2. +0 −23 INSTALL
  3. +6 −126 README.md
  4. +0 −81 Rakefile
  5. +0 −1 SPREE_VERSION
  6. +0 −1 api/.rspec
  7. +0 −26 api/LICENSE
  8. +0 −16 api/README.md
  9. +0 −53 api/Rakefile
  10. +0 −19 api/app/controllers/admin/users_controller_decorator.rb
  11. +0 −101 api/app/controllers/api/base_controller.rb
  12. +0 −4 api/app/controllers/api/countries_controller.rb
  13. +0 −12 api/app/controllers/api/inventory_units_controller.rb
  14. +0 −16 api/app/controllers/api/line_items_controller.rb
  15. +0 −17 api/app/controllers/api/orders_controller.rb
  16. +0 −15 api/app/controllers/api/products_controller.rb
  17. +0 −35 api/app/controllers/api/shipments_controller.rb
  18. +0 −5 api/app/controllers/api/states_controller.rb
  19. +0 −2 api/app/helpers/api/shipments_helper.rb
  20. +0 −7 api/app/models/line_item_decorator.rb
  21. +0 −22 api/app/models/user_decorator.rb
  22. +0 −16 api/app/views/admin/users/_api_fields.html.erb
  23. +0 −10 api/config/cucumber.yml
  24. +0 −16 api/config/locales/en.yml
  25. +0 −36 api/config/routes.rb
  26. +0 −9 api/db/migrate/20100107141738_add_api_key_to_users.rb
  27. +0 −16 api/features/orders_description.feature
  28. +0 −31 api/features/step_definitions/api_steps.rb
  29. +0 −24 api/features/step_definitions/orders_steps.rb
  30. +0 −219 api/features/step_definitions/web_steps.rb
  31. +0 −57 api/features/support/env.rb
  32. +0 −24 api/features/support/factories.rb
  33. 0 api/features/support/hooks.rb
  34. +0 −33 api/features/support/paths.rb
  35. +0 −16 api/lib/spree_api.rb
  36. +0 −3 api/lib/spree_api_hooks.rb
  37. +0 −23 api/lib/tasks/install.rake
  38. +0 −27 api/spec/controllers/admin/users_controller_spec.rb
  39. +0 −51 api/spec/controllers/api/spree_base_controller_spec.rb
  40. +0 −27 api/spec/models/user_spec.rb
  41. +0 −29 api/spec/spec_helper.rb
  42. +0 −21 api/spree_api.gemspec
  43. +0 −1 auth/.gitignore
  44. +0 −1 auth/.rspec
  45. +0 −26 auth/LICENSE
  46. +0 −36 auth/README.md
  47. +0 −55 auth/Rakefile
  48. +0 −7 auth/app/controllers/admin_controller_decorator.rb
  49. +0 −42 auth/app/controllers/checkout_controller_decorator.rb
  50. +0 −17 auth/app/controllers/orders_controller_decorator.rb
  51. +0 −25 auth/app/controllers/resource_controller_decorator.rb
  52. +0 −42 auth/app/controllers/spree/base_controller_decorator.rb
  53. +0 −20 auth/app/controllers/user_passwords_controller.rb
  54. +0 −56 auth/app/controllers/user_registrations_controller.rb
  55. +0 −55 auth/app/controllers/user_sessions_controller.rb
  56. +0 −50 auth/app/controllers/users_controller.rb
  57. +0 −13 auth/app/helpers/users_helper.rb
  58. +0 −64 auth/app/models/ability.rb
  59. +0 −16 auth/app/models/order_decorator.rb
  60. +0 −3 auth/app/models/spree_auth_configuration.rb
  61. +0 −14 auth/app/models/spree_current_order_decorator.rb
  62. +0 −3 auth/app/models/tokenized_permission.rb
  63. +0 −76 auth/app/models/user.rb
  64. +0 −13 auth/app/models/user_mailer.rb
  65. +0 −20 auth/app/views/checkout/registration.html.erb
  66. +0 −8 auth/app/views/layouts/admin/_login_nav.html.erb
  67. +0 −10 auth/app/views/shared/_error_messages.html.erb
  68. +0 −9 auth/app/views/shared/_flashes.html.erb
  69. +0 −20 auth/app/views/shared/_login.html.erb
  70. +0 −6 auth/app/views/shared/_login_bar.html.erb
  71. +0 −17 auth/app/views/shared/_user_form.html.erb
  72. 0 auth/app/views/shared/unauthorized.html.erb
  73. +0 −10 auth/app/views/user_mailer/reset_password_instructions.text.erb
  74. +0 −15 auth/app/views/user_passwords/edit.html.erb
  75. +0 −13 auth/app/views/user_passwords/new.html.erb
  76. +0 −23 auth/app/views/user_registrations/new.html.erb
  77. +0 −4 auth/app/views/user_sessions/authorization_failure.html.erb
  78. +0 −13 auth/app/views/user_sessions/new.html.erb
  79. +0 −11 auth/app/views/users/edit.html.erb
  80. +0 −48 auth/app/views/users/show.html.erb
  81. +0 −4 auth/config.ru
  82. +0 −10 auth/config/cucumber.yml
  83. +0 −136 auth/config/initializers/devise.rb
  84. +0 −46 auth/config/locales/en.yml
  85. +0 −28 auth/config/routes.rb
  86. +0 −38 auth/db/migrate/20101101185116_rename_columns_for_devise.rb
  87. +0 −11 auth/db/migrate/20101214150824_convert_user_remember_field.rb
  88. +0 −18 auth/db/migrate/20101217012656_create_tokenized_permissions.rb
  89. +0 −12 auth/db/migrate/20101219201531_tokens_for_legacy_orders.rb
  90. +0 −53 auth/db/sample/users.rb
  91. +0 −37 auth/features/account.feature
  92. +0 −53 auth/features/checkout.feature
  93. +0 −14 auth/features/order.feature
  94. +0 −19 auth/features/password_reset.feature
  95. +0 −33 auth/features/sign_in.feature
  96. +0 −11 auth/features/sign_out.feature
  97. +0 −20 auth/features/sign_up.feature
  98. +0 −4 auth/features/support/env.rb
  99. +0 −43 auth/features/support/paths.rb
  100. +0 −6 auth/lib/hooks.rb
  101. +0 −22 auth/lib/spree/auth/config.rb
  102. +0 −23 auth/lib/spree/token_resource.rb
  103. +0 −29 auth/lib/spree_auth.rb
  104. +0 −8 auth/lib/tasks/auth.rake
  105. +0 −23 auth/lib/tasks/install.rake
  106. +0 −19 auth/spec/controllers/admin_base_controller_spec.rb
  107. +0 −180 auth/spec/controllers/checkout_controller_spec.rb
  108. +0 −145 auth/spec/controllers/orders_controller_spec.rb
  109. +0 −32 auth/spec/controllers/user_sessions_controller_spec.rb
  110. +0 −32 auth/spec/controllers/users_controller_spec.rb
  111. +0 −34 auth/spec/lib/token_resource_spec.rb
  112. +0 −186 auth/spec/models/ability_spec.rb
  113. +0 −45 auth/spec/models/order_spec.rb
  114. +0 −47 auth/spec/models/user_spec.rb
  115. +0 −29 auth/spec/spec_helper.rb
  116. +0 −23 auth/spree_auth.gemspec
  117. +0 −1 core/.gitignore
  118. +0 −1 core/.rspec
  119. +0 −26 core/LICENSE
  120. +0 −15 core/README.md
  121. +0 −48 core/Rakefile
  122. +0 −9 core/app/controllers/admin/adjustments_controller.rb
  123. +0 −53 core/app/controllers/admin/base_controller.rb
  124. +0 −26 core/app/controllers/admin/configurations_controller.rb
  125. +0 −13 core/app/controllers/admin/general_settings_controller.rb
  126. +0 −64 core/app/controllers/admin/images_controller.rb
  127. +0 −13 core/app/controllers/admin/inventory_settings_controller.rb
  128. +0 −2 core/app/controllers/admin/inventory_units_controller.rb
  129. +0 −46 core/app/controllers/admin/line_items_controller.rb
  130. +0 −13 core/app/controllers/admin/mail_methods_controller.rb
  131. +0 −14 core/app/controllers/admin/mail_settings_controller.rb
  132. +0 −69 core/app/controllers/admin/option_types_controller.rb
  133. +0 −117 core/app/controllers/admin/orders_controller.rb
  134. +0 −14 core/app/controllers/admin/overview_controller.rb
  135. +0 −31 core/app/controllers/admin/payment_methods_controller.rb
  136. +0 −89 core/app/controllers/admin/payments_controller.rb
  137. +0 −47 core/app/controllers/admin/product_groups_controller.rb
  138. +0 −14 core/app/controllers/admin/product_properties_controller.rb
  139. +0 −19 core/app/controllers/admin/product_scopes_controller.rb
  140. +0 −123 core/app/controllers/admin/products_controller.rb
  141. +0 −27 core/app/controllers/admin/properties_controller.rb
  142. +0 −52 core/app/controllers/admin/prototypes_controller.rb
  143. +0 −45 core/app/controllers/admin/reports_controller.rb
  144. +0 −23 core/app/controllers/admin/return_authorizations_controller.rb
  145. +0 −72 core/app/controllers/admin/shipments_controller.rb
  146. +0 −16 core/app/controllers/admin/shipping_categories_controller.rb
  147. +0 −21 core/app/controllers/admin/shipping_methods_controller.rb
  148. +0 −30 core/app/controllers/admin/states_controller.rb
  149. +0 −13 core/app/controllers/admin/tax_categories_controller.rb
  150. +0 −32 core/app/controllers/admin/tax_rates_controller.rb
  151. +0 −13 core/app/controllers/admin/tax_settings_controller.rb
  152. +0 −17 core/app/controllers/admin/taxonomies_controller.rb
  153. +0 −126 core/app/controllers/admin/taxons_controller.rb
  154. +0 −7 core/app/controllers/admin/trackers_controller.rb
  155. +0 −67 core/app/controllers/admin/users_controller.rb
  156. +0 −66 core/app/controllers/admin/variants_controller.rb
  157. +0 −35 core/app/controllers/admin/zones_controller.rb
  158. +0 −93 core/app/controllers/checkout_controller.rb
  159. +0 −22 core/app/controllers/content_controller.rb
  160. +0 −11 core/app/controllers/countries_controller.rb
  161. +0 −14 core/app/controllers/locale_controller.rb
  162. +0 −61 core/app/controllers/orders_controller.rb
  163. +0 −37 core/app/controllers/products_controller.rb
  164. +0 −3 core/app/controllers/spree/base_controller.rb
  165. +0 −16 core/app/controllers/states_controller.rb
  166. +0 −23 core/app/controllers/taxons_controller.rb
  167. +0 −2 core/app/helpers/account_helper.rb
  168. +0 −194 core/app/helpers/admin/base_helper.rb
  169. +0 −5 core/app/helpers/admin/inventory_settings_helper.rb
  170. +0 −141 core/app/helpers/admin/navigation_helper.rb
  171. +0 −22 core/app/helpers/admin/orders_helper.rb
  172. +0 −12 core/app/helpers/admin/overview_helper.rb
  173. +0 −7 core/app/helpers/admin/payments_helper.rb
  174. +0 −11 core/app/helpers/admin/product_groups_helper.rb
  175. +0 −21 core/app/helpers/admin/product_properties_helper.rb
  176. +0 −11 core/app/helpers/admin/products_helper.rb
  177. +0 −5 core/app/helpers/admin/taxons_helper.rb
  178. +0 −5 core/app/helpers/admin/users_helper.rb
  179. +0 −11 core/app/helpers/admin/zones_helper.rb
  180. +0 −27 core/app/helpers/checkout_helper.rb
  181. +0 −20 core/app/helpers/hook_helper.rb
  182. +0 −3 core/app/helpers/orders_helper.rb
  183. +0 −49 core/app/helpers/products_helper.rb
  184. +0 −10 core/app/helpers/search_helper.rb
  185. +0 −91 core/app/helpers/spree/base_helper.rb
  186. +0 −32 core/app/helpers/taxons_helper.rb
  187. +0 −2 core/app/helpers/trackers_helper.rb
  188. +0 −19 core/app/mailers/order_mailer.rb
  189. +0 −11 core/app/mailers/shipment_mailer.rb
  190. +0 −82 core/app/models/address.rb
  191. +0 −47 core/app/models/adjustment.rb
  192. +0 −38 core/app/models/app_configuration.rb
  193. +0 −4 core/app/models/asset.rb
  194. +0 −23 core/app/models/billing_integration.rb
  195. +0 −46 core/app/models/calculator.rb
  196. +0 −19 core/app/models/calculator/flat_percent_item_total.rb
  197. +0 −16 core/app/models/calculator/flat_rate.rb
  198. +0 −32 core/app/models/calculator/flexi_rate.rb
  199. +0 −16 core/app/models/calculator/per_item.rb
  200. +0 −30 core/app/models/calculator/price_bucket.rb
  201. +0 −48 core/app/models/calculator/sales_tax.rb
  202. +0 −63 core/app/models/calculator/vat.rb
  203. +0 −3 core/app/models/configuration.rb
  204. +0 −18 core/app/models/country.rb
  205. +0 −235 core/app/models/creditcard.rb
  206. +0 −48 core/app/models/gateway.rb
  207. +0 −19 core/app/models/gateway/authorize_net.rb
  208. +0 −132 core/app/models/gateway/authorize_net_cim.rb
  209. +0 −187 core/app/models/gateway/beanstream.rb
  210. +0 −80 core/app/models/gateway/bogus.rb
  211. +0 −88 core/app/models/gateway/braintree.rb
  212. +0 −11 core/app/models/gateway/eway.rb
  213. +0 −8 core/app/models/gateway/linkpoint.rb
  214. +0 −11 core/app/models/gateway/pay_pal.rb
  215. +0 −9 core/app/models/gateway/sage_pay.rb
  216. +0 −31 core/app/models/image.rb
  217. +0 −119 core/app/models/inventory_unit.rb
  218. +0 −95 core/app/models/line_item.rb
  219. +0 −3 core/app/models/log_entry.rb
  220. +0 −23 core/app/models/mail_method.rb
  221. +0 −9 core/app/models/option_type.rb
  222. +0 −5 core/app/models/option_value.rb
  223. +0 −439 core/app/models/order.rb
  224. +0 −139 core/app/models/payment.rb
  225. +0 −54 core/app/models/payment_method.rb
  226. +0 −2 core/app/models/payment_method/check.rb
  227. +0 −51 core/app/models/preference.rb
  228. +0 −240 core/app/models/product.rb
  229. +0 −208 core/app/models/product_group.rb
  230. +0 −5 core/app/models/product_option_type.rb
  231. +0 −15 core/app/models/product_property.rb
  232. +0 −58 core/app/models/product_scope.rb
  233. +0 −18 core/app/models/property.rb
  234. +0 −5 core/app/models/prototype.rb
  235. +0 −79 core/app/models/return_authorization.rb
  236. +0 −3 core/app/models/role.rb
  237. +0 −157 core/app/models/shipment.rb
  238. +0 −3 core/app/models/shipping_category.rb
  239. +0 −20 core/app/models/shipping_method.rb
  240. +0 −17 core/app/models/state.rb
  241. +0 −16 core/app/models/state_event.rb
  242. +0 −25 core/app/models/state_monitor.rb
  243. +0 −15 core/app/models/tax_category.rb
  244. +0 −16 core/app/models/tax_rate.rb
  245. +0 −56 core/app/models/taxon.rb
  246. +0 −17 core/app/models/taxonomy.rb
  247. +0 −5 core/app/models/tracker.rb
  248. +0 −20 core/app/models/user.rb
  249. +0 −104 core/app/models/variant.rb
  250. +0 −84 core/app/models/zone.rb
  251. +0 −10 core/app/models/zone_member.rb
  252. +0 −80 core/app/stylesheets/_buttons.less
  253. +0 −24 core/app/stylesheets/_cart.less
  254. +0 −76 core/app/stylesheets/_checkout.less
  255. +0 −62 core/app/stylesheets/_checkout_progress.less
  256. +0 −16 core/app/stylesheets/_colors.less
  257. +0 −50 core/app/stylesheets/_forms.less
  258. +0 −77 core/app/stylesheets/_layout.less
  259. +0 −32 core/app/stylesheets/_messages.less
  260. +0 −71 core/app/stylesheets/_mixins.less
  261. +0 −130 core/app/stylesheets/_navigation.less
  262. +0 −18 core/app/stylesheets/_prices.less
  263. +0 −56 core/app/stylesheets/_product_details.less
  264. +0 −66 core/app/stylesheets/_product_lists.less
  265. +0 −24 core/app/stylesheets/_registration.less
  266. +0 −69 core/app/stylesheets/_reset.less
  267. +0 −158 core/app/stylesheets/_typography.less
  268. +0 −13 core/app/stylesheets/screen.less
  269. +0 −4 core/app/views/account/login.html.erb
  270. +0 −12 core/app/views/admin/adjustments/_form.html.erb
  271. +0 −13 core/app/views/admin/adjustments/edit.html.erb
  272. +0 −4 core/app/views/admin/adjustments/index.html.erb
  273. +0 −13 core/app/views/admin/adjustments/new.html.erb
  274. +0 −66 core/app/views/admin/configurations/index.html.erb
  275. +0 −13 core/app/views/admin/configurations/new.html.erb
  276. +0 −23 core/app/views/admin/extensions/index.html.erb
  277. +0 −35 core/app/views/admin/general_settings/edit.html.erb
  278. +0 −28 core/app/views/admin/general_settings/show.html.erb
  279. +0 −16 core/app/views/admin/images/_form.html.erb
  280. +0 −19 core/app/views/admin/images/edit.html.erb
  281. +0 −66 core/app/views/admin/images/index.html.erb
  282. +0 −22 core/app/views/admin/images/new.html.erb
  283. +0 −27 core/app/views/admin/inventory_settings/edit.html.erb
  284. +0 −9 core/app/views/admin/inventory_settings/show.html.erb
  285. +0 −33 core/app/views/admin/inventory_units/adjust.html.erb
  286. +0 −96 core/app/views/admin/mail_methods/_form.html.erb
  287. +0 −9 core/app/views/admin/mail_methods/edit.html.erb
  288. +0 −41 core/app/views/admin/mail_methods/index.html.erb
  289. +0 −9 core/app/views/admin/mail_methods/new.html.erb
  290. +0 −27 core/app/views/admin/option_types/_available.html.erb
  291. +0 −11 core/app/views/admin/option_types/_form.html.erb
  292. +0 −5 core/app/views/admin/option_types/_option_value_fields.html.erb
  293. +0 −26 core/app/views/admin/option_types/_selected.html.erb
  294. +0 −2 core/app/views/admin/option_types/available.js.erb
  295. +0 −30 core/app/views/admin/option_types/edit.html.erb
  296. +0 −33 core/app/views/admin/option_types/index.html.erb
  297. +0 −11 core/app/views/admin/option_types/new.html.erb
  298. +0 −3 core/app/views/admin/option_types/select.js.erb
  299. +0 −6 core/app/views/admin/option_types/selected.html.erb
  300. +0 −20 core/app/views/admin/orders/_add_product.html.erb
Sorry, we could not display the entire diff because too many files (1,184) changed.
View
38 Gemfile
@@ -1,38 +0,0 @@
-source 'http://rubygems.org'
-
-gem "spree", :path => File.dirname(__FILE__)
-
-# gem 'mysql'
-gem 'sqlite3-ruby'
-gem 'ruby-debug' if RUBY_VERSION.to_f < 1.9
-gem "rdoc", "2.2"
-
-gemspec
-
-group :test do
- gem 'rspec-rails', '= 2.4.1'
- gem 'factory_girl_rails'
- gem 'factory_girl', '= 1.3.3'
- gem 'rcov'
- gem 'shoulda'
- if RUBY_VERSION < "1.9"
- gem "ruby-debug"
- else
- gem "ruby-debug19"
- end
-end
-
-group :cucumber do
- gem 'cucumber-rails'
- gem 'database_cleaner', '~> 0.5.2'
- gem 'nokogiri'
- gem 'capybara'
- gem 'factory_girl_rails'
- gem 'factory_girl', '= 1.3.3'
-
- if RUBY_VERSION < "1.9"
- gem "ruby-debug"
- else
- gem "ruby-debug19"
- end
-end
View
23 INSTALL
@@ -1,23 +0,0 @@
-
-== Installation and Setup
-
-1. Create the MySQL/PostgreSQL/SQLite databases for your Web site. You only
- need to create the "production" database, but you may also want to create
- the "development" and "test" databases if you are developing extensions
- or running tests.
-
-2. Edit config/database.yml to taste.
-
-3. Run the database migrations, seed data and set up the admin user:
-
- $ rake db:bootstrap RAILS_ENV=production
-
- (NOTE: In dev mode you can just run `rake db:bootstrap`.)
-
-4. Start it like a normal Rails application. To test execute:
-
- $ script/server -e production
-
- And open your Web browser on port 3000 (http://localhost:3000). The
- administrative interface is available at /admin/. By default the bootstrap
- rake task creates a user called "spree@example.com" with a password of "spree".
View
132 README.md
@@ -1,130 +1,10 @@
-SUMMARY
--------
+The Official Spree Repository Has Moved
+---------------------------------------
-Spree is a complete open source commerce solution for Ruby on Rails. It was originally developed by Sean Schofield
-and is now maintained by a dedicated [core team](http://spreecommerce.com/core-team). You can find out more about
-by visiting the [Spree e-commerce project page](http://spreecommerce.com).
+The new Github project page can be found at:
-Spree actually consists of several different gems, each of which are maintained in a single repository and documented
-in a single set of [online documentation](http://spreecommerce.com/documentation). By requiring the Spree gem you
-automatically require all of the necessary dependency gems. Those gems are as follows:
+[http://github.com/spree/spree](http://github.com/spree/spree)
-* spree_api
-* spree_auth
-* spree_core
-* spree_dash
-* spree_promo
-* spree_sample
+Please update your Git remote to point to the new official location:
-All of the gems are designed to work together to provide a fully functional e-commerce platform. It is also possible,
-however, to use only the pieces you are interested in. So for example, you could use just the barebones spree\_core gem
-and perhaps combine it with your own custom authorization scheme instead of using spree_auth.
-
-Using the Gem
--------------
-
-Start by adding the gem to your existing Rails 3.x application's Gemfile
-
- gem 'spree'
-
-Update your bundle
-
- bundle install
-
-Then use the install generator to do the basic setup (add Spree to Gemfile, etc.)
-
- rails g spree:site
-
-Now its time to install all of the necessary migrations, assets, etc.
-
- rake spree:install
-
-If you'd like to also install sample data and images you can follow up the above command with:
-
- rake spree_sample:install
-
-Now you just need to run the new migrations
-
- rake db:migrate
- rake db:seed
-
-If you also want some sample products, orders, etc. to play with you can run the appropriate rake task.
-
- rake db:sample
-
-
-Browse Store
-------------
-
-http://localhost:nnnn
-
-Browse Admin Interface
-----------------------
-
-http://localhost:nnnn/admin
-
-
-
-Working with the edge source (latest and greatest features)
------------------------------------------------------------
-
-The source code is essentially a collection of gems. Spree is meant to be run within the context of Rails application. You can easily create a sandbox application inside of your cloned source directory for testing purposes.
-
-
-1. Clone the git repo
-
- git clone git://github.com/railsdog/spree.git spree
- cd spree
-
-2. Install the gem dependencies
-
- bundle install
-
-3. Create a sandbox rails application for testing purposes (and automatically perform all necessary database setup)
-
- rake sandbox
-
-6. Start the server
-
- cd sandbox
- rails server
-
-Running Tests
--------------
-
-If you want to run all the tests across all the gems then
-
- $ cd spree
- $ rake spec #=> 'this will run spec tests for all the gems'
- $ rake cucumber #=> 'this will run cucumber tests for all the gems'
- $ rake #=> 'this will run both spec and cucumber tests for all the gems'
-
-Each gem contains its own series of tests, and for each directory, you need to do a quick one-time
-creation of a test application and then you can use it to run the tests. For example, to run the
-tests for the core project.
-
- $ cd core
- $ rake test_app
- $ rake spec
- $ rake cucumber
- $ rake #=> 'this will run both spec and cucumber tests for the gem'
-
- # If you want to run specs for only a single spec file
- $ bundle exec rspec spec/models/state_spec.rb
-
- # If you want to run a particular line of spec
- $ bundle exec rspec spec/models/state_spec.rb:7
-
- # If you want to run a single cucumber feature
- # bundle exec cucumber features/admin/orders.feature --require features
-
- # If you want to run a particular scenario then include the line number
- # bundle exec cucumber features/admin/orders.feature:3 --require features
-
-
-Contributing
-------------
-
-Spree is an open source project. We encourage contributions. Please see the [contributors guidelines](http://spreecommerce.com/documentation/contributing_to_spree.html) before contributing.
-
-The Github team has also been kind enough to write up some great [documentation](http://help.github.com/pull-requests/) on working with pull requests. Contributions should be performed on [topic branches](http://progit.org/book/ch3-4.html) in your personal forks - just issue your pull requests from there. We're also asking that you continue to log important issues for non-trivial patches in our [lighthouse repository](http://railsdog.lighthouseapp.com/projects/31096-spree). You can just link the pull request in the ticket (and link the ticket in the pull request.)
+`git://github.com/spree/spree.git`
View
81 Rakefile
@@ -1,81 +0,0 @@
-require 'rake'
-require 'rake/gempackagetask'
-require 'thor/group'
-
-spec = eval(File.read('spree.gemspec'))
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
-end
-
-task :default => [:spec, :cucumber ]
-
-desc "run spec test for all gems"
-task :spec do
- %w(api auth core dash promo).each do |gem_name|
- puts "########################### #{gem_name} #########################"
- cmd = "rm #{gem_name}/Gemfile*"; puts cmd; system cmd
- cmd = "cd #{gem_name} && #{$0} test_app"; puts cmd; system cmd
- cmd = "cd #{gem_name} && #{$0} spec"; puts cmd; system cmd
- end
-end
-
-desc "run cucumber test for all gems"
-task :cucumber do
- %w(api auth core promo).each do |gem_name|
- puts "########################### #{gem_name} #########################"
- cmd = "rm #{gem_name}/Gemfile*"; puts cmd; system cmd
- cmd = "cd #{gem_name} && rake test_app"; puts cmd; system cmd
- cmd = "cd #{gem_name} && bundle exec cucumber -p ci"; puts cmd; system cmd
- end
-end
-
-desc "Release all gems to gemcutter. Package rails, package & push components, then push spree"
-task :release => :release_projects do
- require 'rake/gemcutter'
- Rake::Gemcutter::Tasks.new(spec).define
- Rake::Task['gem:push'].invoke
-end
-
-desc "Creates a sandbox application for testing your Spree code"
-task :sandbox do
-
- class SandboxGenerator < Thor::Group
- include Thor::Actions
-
- def generate_app
- remove_directory_if_exists("sandbox")
- run "rails new sandbox -GJT"
- end
-
- def append_gemfile
- inside "sandbox" do
- append_file "Gemfile" do
-<<-gems
- gem 'spree', :path => '../' \n
-gems
- end
- end
- end
-
- def install_generators
- inside "sandbox" do
- run 'rails g spree:site -f'
- run 'rake spree:install'
- run 'rake spree_sample:install'
- end
- end
-
- def run_bootstrap
- inside "sandbox" do
- run 'rake db:bootstrap AUTO_ACCEPT=true'
- end
- end
-
- private
- def remove_directory_if_exists(path)
- run "rm -r #{path}" if File.directory?(path)
- end
- end
-
- SandboxGenerator.start
-end
View
1 SPREE_VERSION
@@ -1 +0,0 @@
-0.50.99
View
1 api/.rspec
@@ -1 +0,0 @@
---colour
View
26 api/LICENSE
@@ -1,26 +0,0 @@
-Copyright (c) 2007-2010, Rails Dog LLC and other contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name Spree nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
16 api/README.md
@@ -1,16 +0,0 @@
-Spree API
-=========
-Manage orders,shipments etc. with a simple REST API
-
-See [RESTful API guide](http://spreecommerce.com/documentation/rest.html) for more details.
-
-Testing
-=======
-
-Create the test site
-
- rake test_app
-
-Run the tests
-
- rake spec
View
53 api/Rakefile
@@ -1,53 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-
-desc "Default Task"
-task :default => [:spec, :cucumber ]
-
-spec = eval(File.read('spree_api.gemspec'))
-
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
-end
-
-desc "Release to gemcutter"
-task :release => :package do
- require 'rake/gemcutter'
- Rake::Gemcutter::Tasks.new(spec).define
- Rake::Task['gem:push'].invoke
-end
-
-desc "Regenerates a rails 3 app for testing"
-task :test_app do
- require '../lib/generators/spree/test_app_generator'
- class ApiTestAppGenerator < Spree::Generators::TestAppGenerator
-
- def install_gems
- inside "test_app" do
- run 'rake spree_core:install'
- run 'rake spree_auth:install'
- run 'rake spree_api:install'
- end
- end
-
- def migrate_db
- run_migrations
- end
-
- protected
- def full_path_for_local_gems
- <<-gems
-gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
-gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\'
-gem 'spree_api', :path => \'#{File.dirname(__FILE__)}\'
- gems
- end
- end
-
- ApiTestAppGenerator.start
-end
-
-ENV['SPREE_GEM_PATH'] = __FILE__
-require File.expand_path("../../core/lib/tasks/common", __FILE__)
View
19 api/app/controllers/admin/users_controller_decorator.rb
@@ -1,19 +0,0 @@
-Admin::UsersController.class_eval do
-
- before_filter :load_roles, :only => [:edit, :new, :update, :create, :generate_api_key, :clear_api_key]
-
- def generate_api_key
- if object.generate_api_key!
- flash.notice = t('api.key_generated')
- end
- redirect_to edit_object_path
- end
-
- def clear_api_key
- if object.clear_api_key!
- flash.notice = t('api.key_cleared')
- end
- redirect_to edit_object_path
- end
-
-end
View
101 api/app/controllers/api/base_controller.rb
@@ -1,101 +0,0 @@
-class Api::BaseController < Spree::BaseController
-
- def self.resource_controller_for_api
- resource_controller
- before_filter :check_http_authorization
- skip_before_filter :verify_authenticity_token, :if => lambda { admin_token_passed_in_headers }
-
- index do
- wants.json { render :json => collection.to_json(collection_serialization_options) }
- end
-
- show do
- wants.json { render :json => object.to_json(object_serialization_options) }
- failure.wants.json { render :text => "Failure\n", :status => 500 }
- end
-
- create do
- wants.json { render :text => "Resource created\n", :status => 201, :location => object_url }
- failure.wants.json { render :text => "Failure\n", :status => 500 }
- end
-
- update do
- wants.json { render :nothing => true }
- failure.wants.json { render :text => "Failure\n", :status => 500 }
- end
-
- define_method :admin_token_passed_in_headers do
- request.headers['HTTP_AUTHORIZATION'].present?
- end
-
- define_method :end_of_association_chain do
- parent? ? parent_association.scoped : model.scoped(:include => eager_load_associations)
- end
-
- define_method :collection do
- @collection ||= search.do_search.limit(100)
- end
- end
-
- def access_denied
- render :text => 'access_denied', :status => 401
- end
-
- # Generic action to handle firing of state events on an object
- def event
- valid_events = model.state_machine.events.map(&:name)
- valid_events_for_object = object.state_transitions.map(&:event)
-
- if params[:e].blank?
- errors = t('api.errors.missing_event')
- elsif valid_events_for_object.include?(params[:e].to_sym)
- object.send("#{params[:e]}!")
- errors = nil
- elsif valid_events.include?(params[:e].to_sym)
- errors = t('api.errors.invalid_event_for_object', :events => valid_events_for_object.join(','))
- else
- errors = t('api.errors.invalid_event', :events => valid_events.join(','))
- end
-
- respond_to do |wants|
- wants.json do
- if errors.blank?
- render :nothing => true
- else
- render :json => errors.to_json, :status => 422
- end
- end
- end
- end
-
- protected
-
- def search
- return @search unless @search.nil?
- @search = end_of_association_chain.searchlogic(params[:search])
- @search.order ||= "descend_by_created_at"
- @search
- end
-
- def collection_serialization_options
- {}
- end
-
- def object_serialization_options
- {}
- end
-
- def eager_load_associations
- nil
- end
-
- def object_errors
- {:errors => object.errors.full_messages}
- end
-
- private
- def check_http_authorization
- render :text => "Access Denied\n", :status => 401 unless request.headers['HTTP_AUTHORIZATION'].present?
- end
-
-end
View
4 api/app/controllers/api/countries_controller.rb
@@ -1,4 +0,0 @@
-class Api::CountriesController < Api::BaseController
- resource_controller_for_api
- actions :index, :show
-end
View
12 api/app/controllers/api/inventory_units_controller.rb
@@ -1,12 +0,0 @@
-class Api::InventoryUnitsController < Api::BaseController
- resource_controller_for_api
- actions :index, :show, :update, :create
- belongs_to :shipment, :order
-
- private
-
- def eager_load_associations
- [:variant]
- end
-
-end
View
16 api/app/controllers/api/line_items_controller.rb
@@ -1,16 +0,0 @@
-class Api::LineItemsController < Api::BaseController
- resource_controller_for_api
- actions :index, :show, :update, :create
- belongs_to :order
-
- private
-
- def collection_serialization_options
- { :include => [:variant], :methods => [:description] }
- end
-
- def object_serialization_options
- collection_serialization_options
- end
-
-end
View
17 api/app/controllers/api/orders_controller.rb
@@ -1,17 +0,0 @@
-class Api::OrdersController < Api::BaseController
- resource_controller_for_api
- actions :index, :show
-
- private
-
- def object_serialization_options
- { :include => {
- :bill_address => {:include => [:country, :state]},
- :ship_address => {:include => [:country, :state]},
- :shipments => {:include => [:shipping_method, :address]},
- :line_items => {:include => [:variant]}
- }
- }
- end
-
-end
View
15 api/app/controllers/api/products_controller.rb
@@ -1,15 +0,0 @@
-class Api::ProductsController < Api::BaseController
- resource_controller_for_api
- actions :index, :show, :create, :update
- include Spree::Search
-
- private
- define_method :collection do
- @searcher = Spree::Config.searcher_class.new(params)
- @collection = @searcher.retrieve_products
- end
-
- def object_serialization_options
- { :include => [:master, :variants, :taxons] }
- end
-end
View
35 api/app/controllers/api/shipments_controller.rb
@@ -1,35 +0,0 @@
-class Api::ShipmentsController < Api::BaseController
- resource_controller_for_api
- actions :index, :show, :update, :create
- belongs_to :order
-
- private
-
- def collection_serialization_options
- { :include => {:shipping_method => {}, :address => {}, :inventory_units => {:include => :variant}},
- :except => [:shipping_method_id, :address_id] }
- end
-
- def object_serialization_options
- { :include => {
- :shipping_method => {},
- :address => {:include => [:country, :state]},
- :inventory_units => {
- :include => {
- :variant => {
- :include => {
- :product => {:only => [:name]}
- }
- }
- }
- }
- },
- :except => [:shipping_method_id, :address_id]
- }
- end
-
- def eager_load_associations
- [:shipping_method, :address, {:inventory_units => [:variant]}]
- end
-
-end
View
5 api/app/controllers/api/states_controller.rb
@@ -1,5 +0,0 @@
-class Api::StatesController < Api::BaseController
- resource_controller_for_api
- actions :index, :show
- belongs_to :country
-end
View
2 api/app/helpers/api/shipments_helper.rb
@@ -1,2 +0,0 @@
-module Api::ShipmentsHelper
-end
View
7 api/app/models/line_item_decorator.rb
@@ -1,7 +0,0 @@
-LineItem.class_eval do
- def description
- d = variant.product.name.clone
- d << " (#{variant.options_text})" unless variant.option_values.empty?
- d
- end
-end
View
22 api/app/models/user_decorator.rb
@@ -1,22 +0,0 @@
-User.class_eval do
-
- def clear_api_key!
- self.update_attribute(:authentication_token, "")
- end
-
- def generate_api_key!
- self.reset_authentication_token!
- end
-
- #def self.authenticate_with_http(username, password)
- # logger.debug(username)
- # self.authenticate_with_token(:auth_token => username)
- #end
-
- private
-
- def secure_digest(*args)
- Digest::SHA1.hexdigest(args.flatten.join('--'))
- end
-
-end
View
16 api/app/views/admin/users/_api_fields.html.erb
@@ -1,16 +0,0 @@
-<h2><%= t('api.access') %></h2>
-
-<% if @user.authentication_token.present? %>
- <p><strong><%= t('api.key') %></strong> <%= @user.authentication_token %></p>
- <%= form_tag clear_api_key_admin_user_path(@user), :method => :put do %>
- <%= button t("api.clear_key") %>
- <% end %>
- <%= form_tag generate_api_key_admin_user_path(@user), :method => :put do %>
- <%= button t("api.regenerate_key") %>
- <% end %>
-<% else %>
- <p><%= t('api.no_key') %></p>
- <%= form_tag generate_api_key_admin_user_path(@user), :method => :put do %>
- <%= button t("api.generate_key") %>
- <% end %>
-<% end %>
View
10 api/config/cucumber.yml
@@ -1,10 +0,0 @@
-<%
-rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
-rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
-ci_opts = "--format progress --strict"
-%>
-default: <%= std_opts %> features
-wip: --tags @wip:3 --wip features
-ci: <%= ci_opts %> features CI=true
-rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
View
16 api/config/locales/en.yml
@@ -1,16 +0,0 @@
----
-en:
- api: "API"
- api:
- access: "API Access"
- clear_key: "Clear API key"
- errors:
- invalid_event: "Invalid event name, valid names are %{events}"
- invalid_event_for_object: "Valid event name but not allowed for this object, valid names are %{events}"
- missing_event: "No event name supplied"
- generate_key: "Generate API key"
- key: "API Key"
- regenerate_key: "Regenerate API key"
- no_key: "No key defined"
- key_generated: "API key generated"
- key_cleared: "API key cleared"
View
36 api/config/routes.rb
@@ -1,36 +0,0 @@
-Rails.application.routes.draw do
- namespace :admin do
- resources :users do
- member do
- put :generate_api_key
- put :clear_api_key
- end
- end
- end
-
- namespace :api do
- resources :shipments, :except => [:new,:edit] do
- put :event, :on => :member
- resources :inventory_units, :except => [:new,:edit] do
- put :event, :on => :member
- end
- end
- resources :orders, :except => [:new,:edit] do
- put :event, :on => :member
- resources :shipments, :except => [:new,:edit]
- resources :line_items, :except => [:new,:edit]
- resources :inventory_units, :except => [:new,:edit] do
- put :event, :on => :member
- end
- end
- resources :inventory_units, :except => [:new,:edit] do
- put :event, :on => :member
- end
- resources :products, :except => [:new,:edit]
- resources :countries, :except => [:new,:edit] do
- resources :states, :except => [:new,:edit]
- end
- resources :states, :except => [:new,:edit]
- end
-
-end
View
9 api/db/migrate/20100107141738_add_api_key_to_users.rb
@@ -1,9 +0,0 @@
-class AddApiKeyToUsers < ActiveRecord::Migration
- def self.up
- add_column "users", "api_key", :string, :limit => 40
- end
-
- def self.down
- remove_column "users", "api_key"
- end
-end
View
16 api/features/orders_description.feature
@@ -1,16 +0,0 @@
-@api
-Feature: Orders api description
- In order to get details on order that have been placed
- As a developer
- I want to see order details placed from my storefront
-
- Background:
- Given I am a valid API user
- And I send and accept json
-
- Scenario: Retrieve a list of my orders
- Given I have 5 orders
- When I send a GET request to "http://example.org/api/orders"
- Then the response status should be "200 OK"
- And the response should be an array with 5 "order" elements
-
View
31 api/features/step_definitions/api_steps.rb
@@ -1,31 +0,0 @@
-World(Rack::Test::Methods)
-
-Given /^I am a valid API user$/ do
- @user = Factory(:user)
- unless admin_role = Role.find_by_name('admin')
- admin_role = Role.create(:name => 'admin')
- end
-
- unless @user.roles(&:name).include?('admin')
- @user.roles << admin_role
- end
-
- authorize @user.authentication_token, "X"
-end
-
-Given /^I send and accept json$/ do
- #header 'AUTHORIZATION', "#{@user.authentication_token}:X"
- header "Content-Type","application/json"
- header "Accept","application/json"
-end
-
-private
-
-def encode_credentials(username, password)
- req = Net::HTTP::Get.new('/api/orders/8567520/shipments')
- req.basic_auth(@user.authentication_token,"x")
- return req['authorization'].gsub(/Basic\w/, "")
- #ActionController::HttpAuthentication::Basic.encode_credentials(username,password)
- #{}"Basic " + Base64.encode64("#{username}:#{password}").gsub(/\r\n/m, "")
-end
-
View
24 api/features/step_definitions/orders_steps.rb
@@ -1,24 +0,0 @@
-Given /^I have (\d+) orders$/ do |o|
- user = Factory(:user)
- Order.delete_all
- Order.create(:email => user.email,:number => 100)
- Order.create(:email => user.email,:number => 101)
- Order.create(:email => user.email,:number => 102)
- Order.create(:email => user.email,:number => 103)
- Order.create(:email => user.email,:number => 104)
- @orders = Order.all
-end
-
-When /^I send a GET request to "([^"]*)"$/ do |path|
- get path
-end
-
-Then /^the response status should be "([^"]*)"$/ do |status|
- last_response.status.should == status.to_i
-end
-
-Then /^the response should be an array with (\d+) "([^"]*)" elements$/ do |num, name|
- page = JSON.parse(last_response.body)
- #puts page.inspect
- page.map { |d| d[name] }.length.should == num.to_i
-end
View
219 api/features/step_definitions/web_steps.rb
@@ -1,219 +0,0 @@
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
-# It is recommended to regenerate this file in the future when you upgrade to a
-# newer version of cucumber-rails. Consider adding your own code to a new file
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
-# files.
-
-
-require 'uri'
-require 'cgi'
-require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
-
-module WithinHelpers
- def with_scope(locator)
- locator ? within(locator) { yield } : yield
- end
-end
-World(WithinHelpers)
-
-Given /^(?:|I )am on (.+)$/ do |page_name|
- visit path_to(page_name)
-end
-
-When /^(?:|I )go to (.+)$/ do |page_name|
- visit path_to(page_name)
-end
-
-When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
- with_scope(selector) do
- click_button(button)
- end
-end
-
-When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
- with_scope(selector) do
- click_link(link)
- end
-end
-
-When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
- with_scope(selector) do
- fill_in(field, :with => value)
- end
-end
-
-When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
- with_scope(selector) do
- fill_in(field, :with => value)
- end
-end
-
-# Use this to fill in an entire form with data from a table. Example:
-#
-# When I fill in the following:
-# | Account Number | 5002 |
-# | Expiry date | 2009-11-01 |
-# | Note | Nice guy |
-# | Wants Email? | |
-#
-# TODO: Add support for checkbox, select og option
-# based on naming conventions.
-#
-When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
- with_scope(selector) do
- fields.rows_hash.each do |name, value|
- When %{I fill in "#{name}" with "#{value}"}
- end
- end
-end
-
-When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
- with_scope(selector) do
- select(value, :from => field)
- end
-end
-
-When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
- with_scope(selector) do
- check(field)
- end
-end
-
-When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
- with_scope(selector) do
- uncheck(field)
- end
-end
-
-When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
- with_scope(selector) do
- choose(field)
- end
-end
-
-When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
- with_scope(selector) do
- attach_file(field, path)
- end
-end
-
-Then /^(?:|I )should see JSON:$/ do |expected_json|
- require 'json'
- expected = JSON.pretty_generate(JSON.parse(expected_json))
- actual = JSON.pretty_generate(JSON.parse(response.body))
- expected.should == actual
-end
-
-Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
- with_scope(selector) do
- if page.respond_to? :should
- page.should have_content(text)
- else
- assert page.has_content?(text)
- end
- end
-end
-
-Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
- regexp = Regexp.new(regexp)
- with_scope(selector) do
- if page.respond_to? :should
- page.should have_xpath('//*', :text => regexp)
- else
- assert page.has_xpath?('//*', :text => regexp)
- end
- end
-end
-
-Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
- with_scope(selector) do
- if page.respond_to? :should
- page.should have_no_content(text)
- else
- assert page.has_no_content?(text)
- end
- end
-end
-
-Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
- regexp = Regexp.new(regexp)
- with_scope(selector) do
- if page.respond_to? :should
- page.should have_no_xpath('//*', :text => regexp)
- else
- assert page.has_no_xpath?('//*', :text => regexp)
- end
- end
-end
-
-Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
- with_scope(selector) do
- field = find_field(field)
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
- if field_value.respond_to? :should
- field_value.should =~ /#{value}/
- else
- assert_match(/#{value}/, field_value)
- end
- end
-end
-
-Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
- with_scope(selector) do
- field = find_field(field)
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
- if field_value.respond_to? :should_not
- field_value.should_not =~ /#{value}/
- else
- assert_no_match(/#{value}/, field_value)
- end
- end
-end
-
-Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
- with_scope(selector) do
- field_checked = find_field(label)['checked']
- if field_checked.respond_to? :should
- field_checked.should be_true
- else
- assert field_checked
- end
- end
-end
-
-Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
- with_scope(selector) do
- field_checked = find_field(label)['checked']
- if field_checked.respond_to? :should
- field_checked.should be_false
- else
- assert !field_checked
- end
- end
-end
-
-Then /^(?:|I )should be on (.+)$/ do |page_name|
- current_path = URI.parse(current_url).path
- if current_path.respond_to? :should
- current_path.should == path_to(page_name)
- else
- assert_equal path_to(page_name), current_path
- end
-end
-
-Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
- query = URI.parse(current_url).query
- actual_params = query ? CGI.parse(query) : {}
- expected_params = {}
- expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
-
- if actual_params.respond_to? :should
- actual_params.should == expected_params
- else
- assert_equal expected_params, actual_params
- end
-end
-
-Then /^show me the page$/ do
- save_and_open_page
-end
View
57 api/features/support/env.rb
@@ -1,57 +0,0 @@
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
-# It is recommended to regenerate this file in the future when you upgrade to a
-# newer version of cucumber-rails. Consider adding your own code to a new file
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
-# files.
-
-ENV["RAILS_ENV"] ||= "test"
-require File.expand_path(File.dirname(__FILE__) + '/../../spec/test_app/config/environment')
-
-require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
-require 'cucumber/rails/world'
-require 'cucumber/rails/active_record'
-require 'cucumber/web/tableish'
-
-require 'capybara/rails'
-require 'capybara/cucumber'
-require 'capybara/session'
-require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
-# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
-# order to ease the transition to Capybara we set the default here. If you'd
-# prefer to use XPath just remove this line and adjust any selectors in your
-# steps to use the XPath syntax.
-Capybara.default_selector = :css
-
-# If you set this to false, any error raised from within your app will bubble
-# up to your step definition and out to cucumber unless you catch it somewhere
-# on the way. You can make Rails rescue errors and render error pages on a
-# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
-#
-# If you set this to true, Rails will rescue all errors and render error
-# pages, more or less in the same way your application would behave in the
-# default production environment. It's not recommended to do this for all
-# of your scenarios, as this makes it hard to discover errors in your application.
-ActionController::Base.allow_rescue = false
-
-# If you set this to true, each scenario will run in a database transaction.
-# You can still turn off transactions on a per-scenario basis, simply tagging
-# a feature or scenario with the @no-txn tag. If you are using Capybara,
-# tagging with @culerity or @javascript will also turn transactions off.
-#
-# If you set this to false, transactions will be off for all scenarios,
-# regardless of whether you use @no-txn or not.
-#
-# Beware that turning transactions off will leave data in your database
-# after each scenario, which can lead to hard-to-debug failures in
-# subsequent scenarios. If you do this, we recommend you create a Before
-# block that will explicitly put your database in a known state.
-Cucumber::Rails::World.use_transactional_fixtures = true
-# How to clean your database when transactions are turned off. See
-# http://github.com/bmabey/database_cleaner for more info.
-if defined?(ActiveRecord::Base)
- begin
- require 'database_cleaner'
- DatabaseCleaner.strategy = :truncation
- rescue LoadError => ignore_if_database_cleaner_not_present
- end
-end
View
24 api/features/support/factories.rb
@@ -1,24 +0,0 @@
-Factory.sequence :email do |n|
- "somebody#{n}@example.com"
-end
-
-Factory.sequence :order_number do |n|
- n
-end
-
-Factory.sequence :user_authentication_token do |n|
- "xxxx#{Time.now.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx"
-end
-
-Factory.define :user do |f|
- f.email { Factory.next(:email) }
- f.login { |u| u.email }
- f.authentication_token { Factory.next(:user_authentication_token) }
- f.password "secret"
- f.password_confirmation "secret"
-end
-
-Factory.define :order do |f|
- f.number { Factory.next(:order_number) }
- f.email { Factory.next(:email) }
-end
View
0 api/features/support/hooks.rb
No changes.
View
33 api/features/support/paths.rb
@@ -1,33 +0,0 @@
-module NavigationHelpers
- # Maps a name to a path. Used by the
- #
- # When /^I go to (.+)$/ do |page_name|
- #
- # step definition in web_steps.rb
- #
- def path_to(page_name)
- case page_name
-
- when /the home\s?page/
- '/'
-
- # Add more mappings here.
- # Here is an example that pulls values out of the Regexp:
- #
- # when /^(.*)'s profile page$/i
- # user_profile_path(User.find_by_login($1))
-
- else
- begin
- page_name =~ /the (.*) page/
- path_components = $1.split(/\s+/)
- self.send(path_components.push('path').join('_').to_sym)
- rescue Object => e
- raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
- "Now, go and add a mapping in #{__FILE__}"
- end
- end
- end
-end
-
-World(NavigationHelpers)
View
16 api/lib/spree_api.rb
@@ -1,16 +0,0 @@
-require 'spree_core'
-require 'spree_api_hooks'
-
-module SpreeApi
- class Engine < Rails::Engine
- def self.activate
-
- Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
- Rails.env.production? ? require(c) : load(c)
- end
-
- end
- config.autoload_paths += %W(#{config.root}/lib)
- config.to_prepare &method(:activate).to_proc
- end
-end
View
3 api/lib/spree_api_hooks.rb
@@ -1,3 +0,0 @@
-class ApiHooks < Spree::ThemeSupport::HookListener
- insert_after :admin_user_edit_form, :partial => "admin/users/api_fields"
-end
View
23 api/lib/tasks/install.rake
@@ -1,23 +0,0 @@
-namespace :spree_api do
- desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
- task :install do
- Rake::Task['spree_api:install:migrations'].invoke
- Rake::Task['spree_api:install:assets'].invoke
- end
-
- namespace :install do
-
- desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
- task :migrations do
- source = File.join(File.dirname(__FILE__), '..', '..', 'db')
- destination = File.join(Rails.root, 'db')
- Spree::FileUtilz.mirror_files(source, destination)
- end
-
- desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
- task :assets do
- # No assets
- end
-
- end
-end
View
27 api/spec/controllers/admin/users_controller_spec.rb
@@ -1,27 +0,0 @@
-require 'spec_helper'
-
-describe Admin::UsersController do
-
- let(:user) { mock_model User }
-
- before do
- controller.stub :current_user => mock_model(User, :has_role? => true)
- User.stub :find => user
- end
-
- context "#generate_api_key" do
- it "should generate a 40 char key" do
- user.should_receive :generate_api_key!
- put :generate_api_key, {:id => 1}
- end
- end
-
- context "#clear_api_key" do
- it "should clear the key" do
- user.stub :key => "FOOFAH"
- user.should_receive :clear_api_key!
- put :clear_api_key, {:id => 1}
- end
- end
-
-end
View
51 api/spec/controllers/api/spree_base_controller_spec.rb
@@ -1,51 +0,0 @@
-require 'spec_helper.rb'
-
-# Its difficult to test the Api::BaseController in the abstract since rspec insists on having legit routes, etc.
-# So we'll test against Api::OrdersController instead as a reprentative controller
-describe Api::OrdersController do
- let(:user) { mock_model(User, :has_role? => true) }
-
- shared_examples_for "access granted" do
- it "should allow index" do
- get :index, :format => :json
- response.should be_success
- end
- it "should allow read" do
- get :show, {:id => 1}, :format => :json
- response.should be_success
- end
- # it "should allow update"
- end
-
- shared_examples_for "access denied" do
- it "should not allow index" do
- get :index, :format => :json
- response.code.should == "401"
- end
- it "should not allow read" do
- get :show, {:id => 1}, :format => :json
- response.code.should == "401"
- end
- # it "should not allow update"
- end
-
- context "when correct HTTP_AUTHORIZATION" do
- before do
- request.env['HTTP_AUTHORIZATION'] = "legit:x"
- controller.stub :current_user => user
- end
- it_should_behave_like "access granted"
- end
-
- context "when authenticated as admin" do
- end
-
- context "when no HTTP_AUTHORIZATION" do
- it_should_behave_like "access denied"
- context "when authenticated as admin" do
- before { controller.stub :current_user => user }
- it_should_behave_like "access denied"
- end
- end
-
-end
View
27 api/spec/models/user_spec.rb
@@ -1,27 +0,0 @@
-require 'spec_helper'
-
-describe User do
-
- let(:user) { User.new }
-
- context "#generate_api_key!" do
- it "should set authentication_token to a 20 char SHA" do
- user.generate_api_key!
- user.authentication_token.to_s.length.should == 20
- end
- end
-
- context "#anonymous?" do
- it "should not be anonymous" do
- user.should_not be_anonymous
- end
- end
-
- context "#clear_api_key!" do
- it "should remove the existing api_key" do
- user.authentication_token = "FOOFAH"
- user.clear_api_key!
- user.authentication_token.should be_blank
- end
- end
-end
View
29 api/spec/spec_helper.rb
@@ -1,29 +0,0 @@
-# This file is copied to ~/spec when you run 'ruby script/generate rspec'
-# from the project root directory.
-ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../test_app/config/environment", __FILE__)
-require 'rspec/rails'
-
-# Requires supporting files with custom matchers and macros, etc,
-# in ./support/ and its subdirectories.
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
-
-RSpec.configure do |config|
- # == Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
- config.mock_with :rspec
-
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
-
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, comment the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
-
- include Devise::TestHelpers
-end
View
21 api/spree_api.gemspec
@@ -1,21 +0,0 @@
-version = File.read(File.expand_path("../../SPREE_VERSION", __FILE__)).strip
-
-Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = 'spree_api'
- s.version = version
- s.summary = 'Provides RESTful access for Spree.'
- s.description = 'Required dependancy for Spree'
-
- s.required_ruby_version = '>= 1.8.7'
- s.author = 'David North'
- s.email = 'david@railsdog.com'
- s.homepage = 'http://spreecommerce.com'
- s.rubyforge_project = 'spree_api'
-
- s.files = Dir['LICENSE', 'README.md', 'app/**/*', 'config/**/*', 'lib/**/*', 'db/**/*']
- s.require_path = 'lib'
- s.requirements << 'none'
-
- s.add_dependency('spree_core', version)
-end
View
1 auth/.gitignore
@@ -1 +0,0 @@
-sandbox
View
1 auth/.rspec
@@ -1 +0,0 @@
---colour
View
26 auth/LICENSE
@@ -1,26 +0,0 @@
-Copyright (c) 2007-2010, Rails Dog LLC and other contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name Spree nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
36 auth/README.md
@@ -1,36 +0,0 @@
-Overview
---------
-
-This gem provides the so-called "core" functionality of Spree and is a requirement for any Spree application or
-store. The basic data models as well as product catalog and admin functionality are all provided by this gem.
-
-
-Security Warning
-----------------
-
-*This gem provides absolutely no authentication and authorization. You are strongly encouraged to install
-and use the spree-auth gem in addition to spree-core in order to restrict access to orders and other admin
-functionality.*
-
-
-Running Tests
--------------
-
-You need to do a quick one-time creation of a test application and then you can use it to run the tests.
-
- rake test_app
-
-Then run the rspec tests
-
- rake spec
-
-Then run the cucumber tests
-
- bundle exec cucumber
-
-Misc
-----
-
-authentication by token example
-
- http://localhost:3000/?auth_token=oWBSN16k6dWx46TtSGcp
View
55 auth/Rakefile
@@ -1,55 +0,0 @@
-require 'rubygems'
-require 'rake'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-
-desc "Default Task"
-task :default => [:spec, :cucumber ]
-
-spec = eval(File.read('spree_auth.gemspec'))
-
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
-end
-
-desc "Release to gemcutter"
-task :release => :package do
- require 'rake/gemcutter'
- Rake::Gemcutter::Tasks.new(spec).define
- Rake::Task['gem:push'].invoke
-end
-
-desc "Default Task"
-task :default => [ :spec ]
-
-desc "Regenerates a rails 3 app for testing"
-task :test_app do
- require '../lib/generators/spree/test_app_generator'
- class AuthTestAppGenerator < Spree::Generators::TestAppGenerator
-
- def install_gems
- inside "test_app" do
- run 'rake spree_auth:install'
- run 'rake spree_core:install'
- end
- end
-
- def migrate_db
- run_migrations
- end
-
- protected
- def full_path_for_local_gems
- <<-gems
-gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
-gem 'spree_auth', :path => \'#{File.dirname(__FILE__)}\'
- gems
- end
-
- end
- AuthTestAppGenerator.start
-end
-
-ENV['SPREE_GEM_PATH'] = __FILE__
-require File.expand_path("../../core/lib/tasks/common", __FILE__)
View
7 auth/app/controllers/admin_controller_decorator.rb
@@ -1,7 +0,0 @@
-Admin::BaseController.class_eval do
- before_filter :authorize_admin
-
- def authorize_admin
- authorize! :admin, Object
- end
-end
View
42 auth/app/controllers/checkout_controller_decorator.rb
@@ -1,42 +0,0 @@
-CheckoutController.class_eval do
- before_filter :check_authorization
- before_filter :check_registration, :except => [:registration, :update_registration]
-
- helper :users
-
- def registration
- @user = User.new
- end
-
- def update_registration
- # hack - temporarily change the state to something other than cart so we can validate the order email address
- current_order.state = "address"
- if current_order.update_attributes(params[:order])
- redirect_to checkout_path
- else
- @user = User.new
- render 'registration'
- end
- end
-
- private
- def check_authorization
- authorize!(:edit, current_order, session[:access_token])
- end
-
- # Introduces a registration step whenever the +registration_step+ preference is true.
- def check_registration
- return unless Spree::Auth::Config[:registration_step]
- return if current_user or current_order.email
- store_location
- redirect_to checkout_registration_path
- end
-
- # Overrides the equivalent method defined in spree_core. This variation of the method will ensure that users
- # are redirected to the tokenized order url unless authenticated as a registered user.
- def completion_route
- return order_path(@order) if current_user
- token_order_path(@order, @order.token)
- end
-
-end
View
17 auth/app/controllers/orders_controller_decorator.rb
@@ -1,17 +0,0 @@
-OrdersController.class_eval do
- before_filter :check_authorization
-
- private
-
- def check_authorization
- session[:access_token] ||= params[:token]
- order = current_order || Order.find_by_number(params[:id])
-
- if order
- authorize! :edit, order, session[:access_token]
- else
- authorize! :create, Order
- end
- end
-
-end
View
25 auth/app/controllers/resource_controller_decorator.rb
@@ -1,25 +0,0 @@
-# This overrides the before method provided by resource_controller so that the current_user is authorized
-# for each action before proceding.
-module ResourceController
- module Helpers
- module Internal
- protected
- # Calls the before block for the action, if one is present.
- def before(action)
-
- resource = case action
- when :index, :new, :create
- model
- else object
- end
-
- if resource.respond_to? :token
- authorize! action, resource, session[:access_token]
- else
- authorize! action, resource
- end
- invoke_callbacks *self.class.send(action).before
- end
- end
- end
-end
View
42 auth/app/controllers/spree/base_controller_decorator.rb
@@ -1,42 +0,0 @@
-Spree::BaseController.class_eval do