Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Deprecated railsdog/spree location in favor of spree/spree

  • Loading branch information...
commit 3ece21530934dba4e4d9752e404caafb2dde35f7 1 parent 3a3f8af
Sean Schofield schof authored

Showing 1,184 changed files with 6 additions and 11,480 deletions. Show diff stats Hide diff stats

  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
  301. +0 68 core/app/views/admin/orders/_form.html.erb
  302. +0 16 core/app/views/admin/orders/_line_item.html.erb
Sorry, we could not display the entire diff because too many files (1,184) changed.
38 Gemfile
... ... @@ -1,38 +0,0 @@
1   -source 'http://rubygems.org'
2   -
3   -gem "spree", :path => File.dirname(__FILE__)
4   -
5   -# gem 'mysql'
6   -gem 'sqlite3-ruby'
7   -gem 'ruby-debug' if RUBY_VERSION.to_f < 1.9
8   -gem "rdoc", "2.2"
9   -
10   -gemspec
11   -
12   -group :test do
13   - gem 'rspec-rails', '= 2.4.1'
14   - gem 'factory_girl_rails'
15   - gem 'factory_girl', '= 1.3.3'
16   - gem 'rcov'
17   - gem 'shoulda'
18   - if RUBY_VERSION < "1.9"
19   - gem "ruby-debug"
20   - else
21   - gem "ruby-debug19"
22   - end
23   -end
24   -
25   -group :cucumber do
26   - gem 'cucumber-rails'
27   - gem 'database_cleaner', '~> 0.5.2'
28   - gem 'nokogiri'
29   - gem 'capybara'
30   - gem 'factory_girl_rails'
31   - gem 'factory_girl', '= 1.3.3'
32   -
33   - if RUBY_VERSION < "1.9"
34   - gem "ruby-debug"
35   - else
36   - gem "ruby-debug19"
37   - end
38   -end
23 INSTALL
... ... @@ -1,23 +0,0 @@
1   -
2   -== Installation and Setup
3   -
4   -1. Create the MySQL/PostgreSQL/SQLite databases for your Web site. You only
5   - need to create the "production" database, but you may also want to create
6   - the "development" and "test" databases if you are developing extensions
7   - or running tests.
8   -
9   -2. Edit config/database.yml to taste.
10   -
11   -3. Run the database migrations, seed data and set up the admin user:
12   -
13   - $ rake db:bootstrap RAILS_ENV=production
14   -
15   - (NOTE: In dev mode you can just run `rake db:bootstrap`.)
16   -
17   -4. Start it like a normal Rails application. To test execute:
18   -
19   - $ script/server -e production
20   -
21   - And open your Web browser on port 3000 (http://localhost:3000). The
22   - administrative interface is available at /admin/. By default the bootstrap
23   - rake task creates a user called "spree@example.com" with a password of "spree".
132 README.md
Source Rendered
... ... @@ -1,130 +1,10 @@
1   -SUMMARY
2   --------
  1 +The Official Spree Repository Has Moved
  2 +---------------------------------------
3 3
4   -Spree is a complete open source commerce solution for Ruby on Rails. It was originally developed by Sean Schofield
5   -and is now maintained by a dedicated [core team](http://spreecommerce.com/core-team). You can find out more about
6   -by visiting the [Spree e-commerce project page](http://spreecommerce.com).
  4 +The new Github project page can be found at:
7 5
8   -Spree actually consists of several different gems, each of which are maintained in a single repository and documented
9   -in a single set of [online documentation](http://spreecommerce.com/documentation). By requiring the Spree gem you
10   -automatically require all of the necessary dependency gems. Those gems are as follows:
  6 +[http://github.com/spree/spree](http://github.com/spree/spree)
11 7
12   -* spree_api
13   -* spree_auth
14   -* spree_core
15   -* spree_dash
16   -* spree_promo
17   -* spree_sample
  8 +Please update your Git remote to point to the new official location:
18 9
19   -All of the gems are designed to work together to provide a fully functional e-commerce platform. It is also possible,
20   -however, to use only the pieces you are interested in. So for example, you could use just the barebones spree\_core gem
21   -and perhaps combine it with your own custom authorization scheme instead of using spree_auth.
22   -
23   -Using the Gem
24   --------------
25   -
26   -Start by adding the gem to your existing Rails 3.x application's Gemfile
27   -
28   - gem 'spree'
29   -
30   -Update your bundle
31   -
32   - bundle install
33   -
34   -Then use the install generator to do the basic setup (add Spree to Gemfile, etc.)
35   -
36   - rails g spree:site
37   -
38   -Now its time to install all of the necessary migrations, assets, etc.
39   -
40   - rake spree:install
41   -
42   -If you'd like to also install sample data and images you can follow up the above command with:
43   -
44   - rake spree_sample:install
45   -
46   -Now you just need to run the new migrations
47   -
48   - rake db:migrate
49   - rake db:seed
50   -
51   -If you also want some sample products, orders, etc. to play with you can run the appropriate rake task.
52   -
53   - rake db:sample
54   -
55   -
56   -Browse Store
57   -------------
58   -
59   -http://localhost:nnnn
60   -
61   -Browse Admin Interface
62   -----------------------
63   -
64   -http://localhost:nnnn/admin
65   -
66   -
67   -
68   -Working with the edge source (latest and greatest features)
69   ------------------------------------------------------------
70   -
71   -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.
72   -
73   -
74   -1. Clone the git repo
75   -
76   - git clone git://github.com/railsdog/spree.git spree
77   - cd spree
78   -
79   -2. Install the gem dependencies
80   -
81   - bundle install
82   -
83   -3. Create a sandbox rails application for testing purposes (and automatically perform all necessary database setup)
84   -
85   - rake sandbox
86   -
87   -6. Start the server
88   -
89   - cd sandbox
90   - rails server
91   -
92   -Running Tests
93   --------------
94   -
95   -If you want to run all the tests across all the gems then
96   -
97   - $ cd spree
98   - $ rake spec #=> 'this will run spec tests for all the gems'
99   - $ rake cucumber #=> 'this will run cucumber tests for all the gems'
100   - $ rake #=> 'this will run both spec and cucumber tests for all the gems'
101   -
102   -Each gem contains its own series of tests, and for each directory, you need to do a quick one-time
103   -creation of a test application and then you can use it to run the tests. For example, to run the
104   -tests for the core project.
105   -
106   - $ cd core
107   - $ rake test_app
108   - $ rake spec
109   - $ rake cucumber
110   - $ rake #=> 'this will run both spec and cucumber tests for the gem'
111   -
112   - # If you want to run specs for only a single spec file
113   - $ bundle exec rspec spec/models/state_spec.rb
114   -
115   - # If you want to run a particular line of spec
116   - $ bundle exec rspec spec/models/state_spec.rb:7
117   -
118   - # If you want to run a single cucumber feature
119   - # bundle exec cucumber features/admin/orders.feature --require features
120   -
121   - # If you want to run a particular scenario then include the line number
122   - # bundle exec cucumber features/admin/orders.feature:3 --require features
123   -
124   -
125   -Contributing
126   -------------
127   -
128   -Spree is an open source project. We encourage contributions. Please see the [contributors guidelines](http://spreecommerce.com/documentation/contributing_to_spree.html) before contributing.
129   -
130   -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.)
  10 +`git://github.com/spree/spree.git`
81 Rakefile
... ... @@ -1,81 +0,0 @@
1   -require 'rake'
2   -require 'rake/gempackagetask'
3   -require 'thor/group'
4   -
5   -spec = eval(File.read('spree.gemspec'))
6   -Rake::GemPackageTask.new(spec) do |pkg|
7   - pkg.gem_spec = spec
8   -end
9   -
10   -task :default => [:spec, :cucumber ]
11   -
12   -desc "run spec test for all gems"
13   -task :spec do
14   - %w(api auth core dash promo).each do |gem_name|
15   - puts "########################### #{gem_name} #########################"
16   - cmd = "rm #{gem_name}/Gemfile*"; puts cmd; system cmd
17   - cmd = "cd #{gem_name} && #{$0} test_app"; puts cmd; system cmd
18   - cmd = "cd #{gem_name} && #{$0} spec"; puts cmd; system cmd
19   - end
20   -end
21   -
22   -desc "run cucumber test for all gems"
23   -task :cucumber do
24   - %w(api auth core promo).each do |gem_name|
25   - puts "########################### #{gem_name} #########################"
26   - cmd = "rm #{gem_name}/Gemfile*"; puts cmd; system cmd
27   - cmd = "cd #{gem_name} && rake test_app"; puts cmd; system cmd
28   - cmd = "cd #{gem_name} && bundle exec cucumber -p ci"; puts cmd; system cmd
29   - end
30   -end
31   -
32   -desc "Release all gems to gemcutter. Package rails, package & push components, then push spree"
33   -task :release => :release_projects do
34   - require 'rake/gemcutter'
35   - Rake::Gemcutter::Tasks.new(spec).define
36   - Rake::Task['gem:push'].invoke
37   -end
38   -
39   -desc "Creates a sandbox application for testing your Spree code"
40   -task :sandbox do
41   -
42   - class SandboxGenerator < Thor::Group
43   - include Thor::Actions
44   -
45   - def generate_app
46   - remove_directory_if_exists("sandbox")
47   - run "rails new sandbox -GJT"
48   - end
49   -
50   - def append_gemfile
51   - inside "sandbox" do
52   - append_file "Gemfile" do
53   -<<-gems
54   - gem 'spree', :path => '../' \n
55   -gems
56   - end
57   - end
58   - end
59   -
60   - def install_generators
61   - inside "sandbox" do
62   - run 'rails g spree:site -f'
63   - run 'rake spree:install'
64   - run 'rake spree_sample:install'
65   - end
66   - end
67   -
68   - def run_bootstrap
69   - inside "sandbox" do
70   - run 'rake db:bootstrap AUTO_ACCEPT=true'
71   - end
72   - end
73   -
74   - private
75   - def remove_directory_if_exists(path)
76   - run "rm -r #{path}" if File.directory?(path)
77   - end
78   - end
79   -
80   - SandboxGenerator.start
81   -end
1  SPREE_VERSION
... ... @@ -1 +0,0 @@
1   -0.50.99
1  api/.rspec
... ... @@ -1 +0,0 @@
1   ---colour
26 api/LICENSE
... ... @@ -1,26 +0,0 @@
1   -Copyright (c) 2007-2010, Rails Dog LLC and other contributors
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.
16 api/README.md
Source Rendered
... ... @@ -1,16 +0,0 @@
1   -Spree API
2   -=========
3   -Manage orders,shipments etc. with a simple REST API
4   -
5   -See [RESTful API guide](http://spreecommerce.com/documentation/rest.html) for more details.
6   -
7   -Testing
8   -=======
9   -
10   -Create the test site
11   -
12   - rake test_app
13   -
14   -Run the tests
15   -
16   - rake spec
53 api/Rakefile
... ... @@ -1,53 +0,0 @@
1   -require 'rake'
2   -require 'rake/testtask'
3   -require 'rake/packagetask'
4   -require 'rake/gempackagetask'
5   -
6   -desc "Default Task"
7   -task :default => [:spec, :cucumber ]
8   -
9   -spec = eval(File.read('spree_api.gemspec'))
10   -
11   -Rake::GemPackageTask.new(spec) do |p|
12   - p.gem_spec = spec
13   -end
14   -
15   -desc "Release to gemcutter"
16   -task :release => :package do
17   - require 'rake/gemcutter'
18   - Rake::Gemcutter::Tasks.new(spec).define
19   - Rake::Task['gem:push'].invoke
20   -end
21   -
22   -desc "Regenerates a rails 3 app for testing"
23   -task :test_app do
24   - require '../lib/generators/spree/test_app_generator'
25   - class ApiTestAppGenerator < Spree::Generators::TestAppGenerator
26   -
27   - def install_gems
28   - inside "test_app" do
29   - run 'rake spree_core:install'
30   - run 'rake spree_auth:install'
31   - run 'rake spree_api:install'
32   - end
33   - end
34   -
35   - def migrate_db
36   - run_migrations
37   - end
38   -
39   - protected
40   - def full_path_for_local_gems
41   - <<-gems
42   -gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
43   -gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\'
44   -gem 'spree_api', :path => \'#{File.dirname(__FILE__)}\'
45   - gems
46   - end
47   - end
48   -
49   - ApiTestAppGenerator.start
50   -end
51   -
52   -ENV['SPREE_GEM_PATH'] = __FILE__
53   -require File.expand_path("../../core/lib/tasks/common", __FILE__)
19 api/app/controllers/admin/users_controller_decorator.rb
... ... @@ -1,19 +0,0 @@
1   -Admin::UsersController.class_eval do
2   -
3   - before_filter :load_roles, :only => [:edit, :new, :update, :create, :generate_api_key, :clear_api_key]
4   -
5   - def generate_api_key
6   - if object.generate_api_key!
7   - flash.notice = t('api.key_generated')
8   - end
9   - redirect_to edit_object_path
10   - end
11   -
12   - def clear_api_key
13   - if object.clear_api_key!
14   - flash.notice = t('api.key_cleared')
15   - end
16   - redirect_to edit_object_path
17   - end
18   -
19   -end
101 api/app/controllers/api/base_controller.rb
... ... @@ -1,101 +0,0 @@
1   -class Api::BaseController < Spree::BaseController
2   -
3   - def self.resource_controller_for_api
4   - resource_controller
5   - before_filter :check_http_authorization
6   - skip_before_filter :verify_authenticity_token, :if => lambda { admin_token_passed_in_headers }
7   -
8   - index do
9   - wants.json { render :json => collection.to_json(collection_serialization_options) }
10   - end
11   -
12   - show do
13   - wants.json { render :json => object.to_json(object_serialization_options) }
14   - failure.wants.json { render :text => "Failure\n", :status => 500 }
15   - end
16   -
17   - create do
18   - wants.json { render :text => "Resource created\n", :status => 201, :location => object_url }
19   - failure.wants.json { render :text => "Failure\n", :status => 500 }
20   - end
21   -
22   - update do
23   - wants.json { render :nothing => true }
24   - failure.wants.json { render :text => "Failure\n", :status => 500 }
25   - end
26   -
27   - define_method :admin_token_passed_in_headers do
28   - request.headers['HTTP_AUTHORIZATION'].present?
29   - end
30   -
31   - define_method :end_of_association_chain do
32   - parent? ? parent_association.scoped : model.scoped(:include => eager_load_associations)
33   - end
34   -
35   - define_method :collection do
36   - @collection ||= search.do_search.limit(100)
37   - end
38   - end
39   -
40   - def access_denied
41   - render :text => 'access_denied', :status => 401
42   - end
43   -
44   - # Generic action to handle firing of state events on an object
45   - def event
46   - valid_events = model.state_machine.events.map(&:name)
47   - valid_events_for_object = object.state_transitions.map(&:event)
48   -
49   - if params[:e].blank?
50   - errors = t('api.errors.missing_event')
51   - elsif valid_events_for_object.include?(params[:e].to_sym)
52   - object.send("#{params[:e]}!")
53   - errors = nil
54   - elsif valid_events.include?(params[:e].to_sym)
55   - errors = t('api.errors.invalid_event_for_object', :events => valid_events_for_object.join(','))
56   - else
57   - errors = t('api.errors.invalid_event', :events => valid_events.join(','))
58   - end
59   -
60   - respond_to do |wants|
61   - wants.json do
62   - if errors.blank?
63   - render :nothing => true
64   - else
65   - render :json => errors.to_json, :status => 422
66   - end
67   - end
68   - end
69   - end
70   -
71   - protected
72   -
73   - def search
74   - return @search unless @search.nil?
75   - @search = end_of_association_chain.searchlogic(params[:search])
76   - @search.order ||= "descend_by_created_at"
77   - @search
78   - end
79   -
80   - def collection_serialization_options
81   - {}
82   - end
83   -
84   - def object_serialization_options
85   - {}
86   - end
87   -
88   - def eager_load_associations
89   - nil
90   - end
91   -
92   - def object_errors
93   - {:errors => object.errors.full_messages}
94   - end
95   -
96   - private
97   - def check_http_authorization
98   - render :text => "Access Denied\n", :status => 401 unless request.headers['HTTP_AUTHORIZATION'].present?
99   - end
100   -
101   -end
4 api/app/controllers/api/countries_controller.rb
... ... @@ -1,4 +0,0 @@
1   -class Api::CountriesController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show
4   -end
12 api/app/controllers/api/inventory_units_controller.rb
... ... @@ -1,12 +0,0 @@
1   -class Api::InventoryUnitsController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show, :update, :create
4   - belongs_to :shipment, :order
5   -
6   - private
7   -
8   - def eager_load_associations
9   - [:variant]
10   - end
11   -
12   -end
16 api/app/controllers/api/line_items_controller.rb
... ... @@ -1,16 +0,0 @@
1   -class Api::LineItemsController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show, :update, :create
4   - belongs_to :order
5   -
6   - private
7   -
8   - def collection_serialization_options
9   - { :include => [:variant], :methods => [:description] }
10   - end
11   -
12   - def object_serialization_options
13   - collection_serialization_options
14   - end
15   -
16   -end
17 api/app/controllers/api/orders_controller.rb
... ... @@ -1,17 +0,0 @@
1   -class Api::OrdersController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show
4   -
5   - private
6   -
7   - def object_serialization_options
8   - { :include => {
9   - :bill_address => {:include => [:country, :state]},
10   - :ship_address => {:include => [:country, :state]},
11   - :shipments => {:include => [:shipping_method, :address]},
12   - :line_items => {:include => [:variant]}
13   - }
14   - }
15   - end
16   -
17   -end
15 api/app/controllers/api/products_controller.rb
... ... @@ -1,15 +0,0 @@
1   -class Api::ProductsController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show, :create, :update
4   - include Spree::Search
5   -
6   - private
7   - define_method :collection do
8   - @searcher = Spree::Config.searcher_class.new(params)
9   - @collection = @searcher.retrieve_products
10   - end
11   -
12   - def object_serialization_options
13   - { :include => [:master, :variants, :taxons] }
14   - end
15   -end
35 api/app/controllers/api/shipments_controller.rb
... ... @@ -1,35 +0,0 @@
1   -class Api::ShipmentsController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show, :update, :create
4   - belongs_to :order
5   -
6   - private
7   -
8   - def collection_serialization_options
9   - { :include => {:shipping_method => {}, :address => {}, :inventory_units => {:include => :variant}},
10   - :except => [:shipping_method_id, :address_id] }
11   - end
12   -
13   - def object_serialization_options
14   - { :include => {
15   - :shipping_method => {},
16   - :address => {:include => [:country, :state]},
17   - :inventory_units => {
18   - :include => {
19   - :variant => {
20   - :include => {
21   - :product => {:only => [:name]}
22   - }
23   - }
24   - }
25   - }
26   - },
27   - :except => [:shipping_method_id, :address_id]
28   - }
29   - end
30   -
31   - def eager_load_associations
32   - [:shipping_method, :address, {:inventory_units => [:variant]}]
33   - end
34   -
35   -end
5 api/app/controllers/api/states_controller.rb
... ... @@ -1,5 +0,0 @@
1   -class Api::StatesController < Api::BaseController
2   - resource_controller_for_api
3   - actions :index, :show
4   - belongs_to :country
5   -end
2  api/app/helpers/api/shipments_helper.rb
... ... @@ -1,2 +0,0 @@
1   -module Api::ShipmentsHelper
2   -end
7 api/app/models/line_item_decorator.rb
... ... @@ -1,7 +0,0 @@
1   -LineItem.class_eval do
2   - def description
3   - d = variant.product.name.clone
4   - d << " (#{variant.options_text})" unless variant.option_values.empty?
5   - d
6   - end
7   -end
22 api/app/models/user_decorator.rb
... ... @@ -1,22 +0,0 @@
1   -User.class_eval do
2   -
3   - def clear_api_key!
4   - self.update_attribute(:authentication_token, "")
5   - end
6   -
7   - def generate_api_key!
8   - self.reset_authentication_token!
9   - end
10   -
11   - #def self.authenticate_with_http(username, password)
12   - # logger.debug(username)
13   - # self.authenticate_with_token(:auth_token => username)
14   - #end
15   -
16   - private
17   -
18   - def secure_digest(*args)
19   - Digest::SHA1.hexdigest(args.flatten.join('--'))
20   - end
21   -
22   -end
16 api/app/views/admin/users/_api_fields.html.erb
... ... @@ -1,16 +0,0 @@
1   -<h2><%= t('api.access') %></h2>
2   -
3   -<% if @user.authentication_token.present? %>
4   - <p><strong><%= t('api.key') %></strong> <%= @user.authentication_token %></p>
5   - <%= form_tag clear_api_key_admin_user_path(@user), :method => :put do %>
6   - <%= button t("api.clear_key") %>
7   - <% end %>
8   - <%= form_tag generate_api_key_admin_user_path(@user), :method => :put do %>
9   - <%= button t("api.regenerate_key") %>
10   - <% end %>
11   -<% else %>
12   - <p><%= t('api.no_key') %></p>
13   - <%= form_tag generate_api_key_admin_user_path(@user), :method => :put do %>
14   - <%= button t("api.generate_key") %>
15   - <% end %>
16   -<% end %>
10 api/config/cucumber.yml
... ... @@ -1,10 +0,0 @@
1   -<%
2   -rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3   -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4   -std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5   -ci_opts = "--format progress --strict"
6   -%>
7   -default: <%= std_opts %> features
8   -wip: --tags @wip:3 --wip features
9   -ci: <%= ci_opts %> features CI=true
10   -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
16 api/config/locales/en.yml
... ... @@ -1,16 +0,0 @@
1   ----
2   -en:
3   - api: "API"
4   - api:
5   - access: "API Access"
6   - clear_key: "Clear API key"
7   - errors:
8   - invalid_event: "Invalid event name, valid names are %{events}"
9   - invalid_event_for_object: "Valid event name but not allowed for this object, valid names are %{events}"
10   - missing_event: "No event name supplied"
11   - generate_key: "Generate API key"
12   - key: "API Key"
13   - regenerate_key: "Regenerate API key"
14   - no_key: "No key defined"
15   - key_generated: "API key generated"
16   - key_cleared: "API key cleared"
36 api/config/routes.rb
... ... @@ -1,36 +0,0 @@
1   -Rails.application.routes.draw do
2   - namespace :admin do
3   - resources :users do
4   - member do
5   - put :generate_api_key
6   - put :clear_api_key
7   - end
8   - end
9   - end
10   -
11   - namespace :api do
12   - resources :shipments, :except => [:new,:edit] do
13   - put :event, :on => :member
14   - resources :inventory_units, :except => [:new,:edit] do
15   - put :event, :on => :member
16   - end
17   - end
18   - resources :orders, :except => [:new,:edit] do
19   - put :event, :on => :member
20   - resources :shipments, :except => [:new,:edit]
21   - resources :line_items, :except => [:new,:edit]
22   - resources :inventory_units, :except => [:new,:edit] do
23   - put :event, :on => :member
24   - end
25   - end
26   - resources :inventory_units, :except => [:new,:edit] do
27   - put :event, :on => :member
28   - end
29   - resources :products, :except => [:new,:edit]
30   - resources :countries, :except => [:new,:edit] do
31   - resources :states, :except => [:new,:edit]
32   - end
33   - resources :states, :except => [:new,:edit]
34   - end
35   -
36   -end
9 api/db/migrate/20100107141738_add_api_key_to_users.rb
... ... @@ -1,9 +0,0 @@
1   -class AddApiKeyToUsers < ActiveRecord::Migration
2   - def self.up
3   - add_column "users", "api_key", :string, :limit => 40
4   - end
5   -
6   - def self.down
7   - remove_column "users", "api_key"
8   - end
9   -end
16 api/features/orders_description.feature
... ... @@ -1,16 +0,0 @@
1   -@api
2   -Feature: Orders api description
3   - In order to get details on order that have been placed
4   - As a developer
5   - I want to see order details placed from my storefront
6   -
7   - Background:
8   - Given I am a valid API user
9   - And I send and accept json
10   -
11   - Scenario: Retrieve a list of my orders
12   - Given I have 5 orders
13   - When I send a GET request to "http://example.org/api/orders"
14   - Then the response status should be "200 OK"
15   - And the response should be an array with 5 "order" elements
16   -
31 api/features/step_definitions/api_steps.rb
... ... @@ -1,31 +0,0 @@
1   -World(Rack::Test::Methods)
2   -
3   -Given /^I am a valid API user$/ do
4   - @user = Factory(:user)
5   - unless admin_role = Role.find_by_name('admin')
6   - admin_role = Role.create(:name => 'admin')
7   - end
8   -
9   - unless @user.roles(&:name).include?('admin')
10   - @user.roles << admin_role
11   - end
12   -
13   - authorize @user.authentication_token, "X"
14   -end
15   -
16   -Given /^I send and accept json$/ do
17   - #header 'AUTHORIZATION', "#{@user.authentication_token}:X"
18   - header "Content-Type","application/json"
19   - header "Accept","application/json"
20   -end
21   -
22   -private
23   -
24   -def encode_credentials(username, password)
25   - req = Net::HTTP::Get.new('/api/orders/8567520/shipments')
26   - req.basic_auth(@user.authentication_token,"x")
27   - return req['authorization'].gsub(/Basic\w/, "")
28   - #ActionController::HttpAuthentication::Basic.encode_credentials(username,password)
29   - #{}"Basic " + Base64.encode64("#{username}:#{password}").gsub(/\r\n/m, "")
30   -end
31   -
24 api/features/step_definitions/orders_steps.rb
... ... @@ -1,24 +0,0 @@
1   -Given /^I have (\d+) orders$/ do |o|
2   - user = Factory(:user)
3   - Order.delete_all
4   - Order.create(:email => user.email,:number => 100)
5   - Order.create(:email => user.email,:number => 101)
6   - Order.create(:email => user.email,:number => 102)
7   - Order.create(:email => user.email,:number => 103)
8   - Order.create(:email => user.email,:number => 104)
9   - @orders = Order.all
10   -end
11   -
12   -When /^I send a GET request to "([^"]*)"$/ do |path|
13   - get path
14   -end
15   -
16   -Then /^the response status should be "([^"]*)"$/ do |status|
17   - last_response.status.should == status.to_i
18   -end
19   -
20   -Then /^the response should be an array with (\d+) "([^"]*)" elements$/ do |num, name|
21   - page = JSON.parse(last_response.body)
22   - #puts page.inspect
23   - page.map { |d| d[name] }.length.should == num.to_i
24   -end
219 api/features/step_definitions/web_steps.rb
... ... @@ -1,219 +0,0 @@
1   -# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2   -# It is recommended to regenerate this file in the future when you upgrade to a
3   -# newer version of cucumber-rails. Consider adding your own code to a new file
4   -# instead of editing this one. Cucumber will automatically load all features/**/*.rb
5   -# files.
6   -
7   -
8   -require 'uri'
9   -require 'cgi'
10   -require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
11   -
12   -module WithinHelpers
13   - def with_scope(locator)
14   - locator ? within(locator) { yield } : yield
15   - end
16   -end
17   -World(WithinHelpers)
18   -
19   -Given /^(?:|I )am on (.+)$/ do |page_name|
20   - visit path_to(page_name)
21   -end
22   -
23   -When /^(?:|I )go to (.+)$/ do |page_name|
24   - visit path_to(page_name)
25   -end
26   -
27   -When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
28   - with_scope(selector) do
29   - click_button(button)
30   - end
31   -end
32   -
33   -When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
34   - with_scope(selector) do
35   - click_link(link)
36   - end
37   -end
38   -
39   -When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
40   - with_scope(selector) do
41   - fill_in(field, :with => value)
42   - end
43   -end
44   -
45   -When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
46   - with_scope(selector) do
47   - fill_in(field, :with => value)
48   - end
49   -end
50   -
51   -# Use this to fill in an entire form with data from a table. Example:
52   -#
53   -# When I fill in the following:
54   -# | Account Number | 5002 |
55   -# | Expiry date | 2009-11-01 |
56   -# | Note | Nice guy |
57   -# | Wants Email? | |
58   -#
59   -# TODO: Add support for checkbox, select og option
60   -# based on naming conventions.
61   -#
62   -When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
63   - with_scope(selector) do
64   - fields.rows_hash.each do |name, value|
65   - When %{I fill in "#{name}" with "#{value}"}
66   - end
67   - end
68   -end
69   -
70   -When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
71   - with_scope(selector) do
72   - select(value, :from => field)
73   - end
74   -end
75   -
76   -When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
77   - with_scope(selector) do
78   - check(field)
79   - end
80   -end
81   -
82   -When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
83   - with_scope(selector) do
84   - uncheck(field)
85   - end
86   -end
87   -
88   -When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
89   - with_scope(selector) do
90   - choose(field)
91   - end
92   -end
93   -
94   -When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
95   - with_scope(selector) do
96   - attach_file(field, path)
97   - end
98   -end
99   -
100   -Then /^(?:|I )should see JSON:$/ do |expected_json|
101   - require 'json'
102   - expected = JSON.pretty_generate(JSON.parse(expected_json))