solidify 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +40 -0
  5. data/.travis.yml +10 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +3 -0
  8. data/Guardfile +51 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +75 -0
  11. data/Rakefile +42 -0
  12. data/app/controllers/concerns/solidify/liquid.rb +26 -0
  13. data/app/controllers/solidify/addresses_controller.rb +15 -0
  14. data/app/controllers/solidify/carts_controller.rb +15 -0
  15. data/app/controllers/solidify/collections_controller.rb +26 -0
  16. data/app/controllers/solidify/customers_controller.rb +16 -0
  17. data/app/controllers/solidify/home_controller.rb +15 -0
  18. data/app/controllers/solidify/liquid_controller.rb +25 -0
  19. data/app/controllers/solidify/orders_controller.rb +19 -0
  20. data/app/controllers/solidify/pages_controller.rb +22 -0
  21. data/app/controllers/solidify/products_controller.rb +34 -0
  22. data/app/controllers/solidify/registrations_controller.rb +25 -0
  23. data/app/controllers/solidify/responders/solidify/liquid_responder.rb +29 -0
  24. data/app/controllers/solidify/search_controller.rb +41 -0
  25. data/app/controllers/solidify/sessions_controller.rb +15 -0
  26. data/app/drops/rails_settings/scoped_settings_drop.rb +11 -0
  27. data/app/drops/solidify/errors_drop.rb +14 -0
  28. data/app/drops/solidify/link_drop.rb +15 -0
  29. data/app/drops/solidify/link_list_drop.rb +7 -0
  30. data/app/drops/solidify/nil_drop.rb +7 -0
  31. data/app/drops/solidify/page_drop.rb +7 -0
  32. data/app/drops/solidify/search_drop.rb +7 -0
  33. data/app/drops/spree/address_drop.rb +28 -0
  34. data/app/drops/spree/image_drop.rb +32 -0
  35. data/app/drops/spree/line_item_drop.rb +98 -0
  36. data/app/drops/spree/option_type_drop.rb +4 -0
  37. data/app/drops/spree/order_drop.rb +64 -0
  38. data/app/drops/spree/product_drop.rb +97 -0
  39. data/app/drops/spree/taxon_drop.rb +53 -0
  40. data/app/drops/spree/user_drop.rb +54 -0
  41. data/app/drops/spree/variant_drop.rb +111 -0
  42. data/app/fields/spree/address_fields.rb +18 -0
  43. data/app/fields/spree/image_fields.rb +12 -0
  44. data/app/fields/spree/line_item_fields.rb +21 -0
  45. data/app/fields/spree/order_fields.rb +22 -0
  46. data/app/fields/spree/product_fields.rb +22 -0
  47. data/app/fields/spree/taxon_fields.rb +18 -0
  48. data/app/fields/spree/user_fields.rb +14 -0
  49. data/app/fields/spree/variant_fields.rb +19 -0
  50. data/app/filters/solidify/additional_filters.rb +22 -0
  51. data/app/filters/solidify/html_filters.rb +16 -0
  52. data/app/filters/solidify/money_filters.rb +39 -0
  53. data/app/filters/solidify/string_filters.rb +47 -0
  54. data/app/filters/solidify/url_filters.rb +59 -0
  55. data/app/helpers/solidify/liquid_helper.rb +111 -0
  56. data/app/helpers/solidify/shop_helper.rb +7 -0
  57. data/app/models/concerns/solidify/address.rb +15 -0
  58. data/app/models/concerns/solidify/full_name.rb +11 -0
  59. data/app/models/concerns/solidify/handle.rb +25 -0
  60. data/app/models/concerns/solidify/inventory_policy.rb +7 -0
  61. data/app/models/concerns/solidify/validation_cancel.rb +33 -0
  62. data/app/models/concerns/spree/order_state.rb +19 -0
  63. data/app/models/solidify/asset.rb +12 -0
  64. data/app/models/solidify/link.rb +10 -0
  65. data/app/models/solidify/link_list.rb +7 -0
  66. data/app/models/solidify/page.rb +5 -0
  67. data/app/models/solidify/setting.rb +8 -0
  68. data/app/models/solidify/theme.rb +19 -0
  69. data/app/models/spree/address_decorator.rb +13 -0
  70. data/app/models/spree/image_decorator.rb +7 -0
  71. data/app/models/spree/line_item_decorator.rb +7 -0
  72. data/app/models/spree/order_decorator.rb +10 -0
  73. data/app/models/spree/product_decorator.rb +8 -0
  74. data/app/models/spree/taxon_decorator.rb +20 -0
  75. data/app/models/spree/user_decorator.rb +9 -0
  76. data/app/models/spree/variant_decorator.rb +11 -0
  77. data/app/poro/solidify/search.rb +14 -0
  78. data/app/services/solidify/app_specific_string_io.rb +15 -0
  79. data/app/services/solidify/asset_compiler.rb +11 -0
  80. data/app/services/solidify/asset_postprocessor.rb +53 -0
  81. data/app/services/solidify/collections_all_builder.rb +12 -0
  82. data/app/services/solidify/link_list_seeder.rb +26 -0
  83. data/app/services/solidify/liquid_asset_compiler.rb +19 -0
  84. data/app/services/solidify/scss_asset_compiler.rb +15 -0
  85. data/app/services/solidify/shop_settings_seeder.rb +26 -0
  86. data/app/services/solidify/theme_mechanic.rb +30 -0
  87. data/app/uploaders/solidify/asset_uploader.rb +10 -0
  88. data/app/views/solidify/global/content_for_header.html.erb +0 -0
  89. data/app/views/solidify/themes/skeleton-theme/README.md +54 -0
  90. data/app/views/solidify/themes/skeleton-theme/assets/arrow-down.svg.liquid +3 -0
  91. data/app/views/solidify/themes/skeleton-theme/assets/cart.svg.liquid +4 -0
  92. data/app/views/solidify/themes/skeleton-theme/assets/shop.js.liquid +75 -0
  93. data/app/views/solidify/themes/skeleton-theme/assets/shopify_common.js +14 -0
  94. data/app/views/solidify/themes/skeleton-theme/assets/style.scss.liquid +768 -0
  95. data/app/views/solidify/themes/skeleton-theme/config/settings.html +217 -0
  96. data/app/views/solidify/themes/skeleton-theme/config/settings_data.json +26 -0
  97. data/app/views/solidify/themes/skeleton-theme/layout/theme.liquid +181 -0
  98. data/app/views/solidify/themes/skeleton-theme/snippets/article-grid-item.liquid +73 -0
  99. data/app/views/solidify/themes/skeleton-theme/snippets/collection-grid-item.liquid +46 -0
  100. data/app/views/solidify/themes/skeleton-theme/snippets/collection-listing.liquid +46 -0
  101. data/app/views/solidify/themes/skeleton-theme/snippets/open-graph-tags.liquid +35 -0
  102. data/app/views/solidify/themes/skeleton-theme/snippets/product-grid-item.liquid +70 -0
  103. data/app/views/solidify/themes/skeleton-theme/snippets/site-nav.liquid +57 -0
  104. data/app/views/solidify/themes/skeleton-theme/snippets/social-links.liquid +42 -0
  105. data/app/views/solidify/themes/skeleton-theme/snippets/twitter-card.liquid +41 -0
  106. data/app/views/solidify/themes/skeleton-theme/templates/404.liquid +2 -0
  107. data/app/views/solidify/themes/skeleton-theme/templates/article.liquid +160 -0
  108. data/app/views/solidify/themes/skeleton-theme/templates/blog.grid.liquid +30 -0
  109. data/app/views/solidify/themes/skeleton-theme/templates/blog.liquid +92 -0
  110. data/app/views/solidify/themes/skeleton-theme/templates/cart.liquid +123 -0
  111. data/app/views/solidify/themes/skeleton-theme/templates/collection.liquid +102 -0
  112. data/app/views/solidify/themes/skeleton-theme/templates/customers/account.liquid +57 -0
  113. data/app/views/solidify/themes/skeleton-theme/templates/customers/activate_account.liquid +26 -0
  114. data/app/views/solidify/themes/skeleton-theme/templates/customers/addresses.liquid +173 -0
  115. data/app/views/solidify/themes/skeleton-theme/templates/customers/login.liquid +90 -0
  116. data/app/views/solidify/themes/skeleton-theme/templates/customers/order.liquid +103 -0
  117. data/app/views/solidify/themes/skeleton-theme/templates/customers/register.liquid +32 -0
  118. data/app/views/solidify/themes/skeleton-theme/templates/customers/reset_password.liquid +27 -0
  119. data/app/views/solidify/themes/skeleton-theme/templates/index.liquid +39 -0
  120. data/app/views/solidify/themes/skeleton-theme/templates/list-collections.liquid +19 -0
  121. data/app/views/solidify/themes/skeleton-theme/templates/page.liquid +16 -0
  122. data/app/views/solidify/themes/skeleton-theme/templates/product.liquid +202 -0
  123. data/app/views/solidify/themes/skeleton-theme/templates/search.liquid +72 -0
  124. data/bin/rails +12 -0
  125. data/config/app.yml +0 -0
  126. data/config/initializers/carrierwave.rb +25 -0
  127. data/config/initializers/devise.rb +286 -0
  128. data/config/initializers/form_tag.rb +43 -0
  129. data/config/initializers/liquid.rb +213 -0
  130. data/config/initializers/sass.rb +15 -0
  131. data/config/initializers/spree.rb +7 -0
  132. data/config/initializers/theme_settings.rb +29 -0
  133. data/config/routes.rb +52 -0
  134. data/config/spring.rb +2 -0
  135. data/db/migrate/20170223064316_create_solidify_assets.solidify.rb +14 -0
  136. data/db/migrate/20170223064317_create_solidify_themes.solidify.rb +10 -0
  137. data/db/migrate/20170223064318_create_solidify_link_lists.solidify.rb +12 -0
  138. data/db/migrate/20170223064319_create_solidify_links.solidify.rb +13 -0
  139. data/db/migrate/20170223064320_create_solidify_settings.solidify.rb +22 -0
  140. data/db/migrate/20170223064321_create_solidify_pages.solidify.rb +16 -0
  141. data/db/migrate/20170223064322_add_attributes_to_spree_users.solidify.rb +7 -0
  142. data/db/migrate/20170223064323_add_handle_to_spree_taxons.solidify.rb +7 -0
  143. data/db/migrate/20170228115149_add_state_and_country_fields_to_spree_addresses.solidify.rb +7 -0
  144. data/lib/generators/solidify/install/install_generator.rb +23 -0
  145. data/lib/solidify.rb +11 -0
  146. data/lib/solidify/configuration.rb +21 -0
  147. data/lib/solidify/engine.rb +24 -0
  148. data/lib/solidify/testing_support/factories.rb +5 -0
  149. data/lib/solidify/testing_support/factories/assets.rb +75 -0
  150. data/lib/solidify/testing_support/factories/solidify_pages.rb +10 -0
  151. data/lib/solidify/testing_support/factories/spree_addresses.rb +9 -0
  152. data/lib/solidify/testing_support/factories/spree_line_items.rb +10 -0
  153. data/lib/solidify/testing_support/factories/spree_orders.rb +9 -0
  154. data/lib/solidify/testing_support/factories/spree_products.rb +8 -0
  155. data/lib/solidify/testing_support/factories/spree_taxons.rb +7 -0
  156. data/lib/solidify/testing_support/factories/spree_variants.rb +7 -0
  157. data/lib/solidify/testing_support/factories/themes.rb +7 -0
  158. data/lib/solidify/version.rb +3 -0
  159. data/lib/tasks/download_theme.rake +18 -0
  160. data/lib/tasks/seed_default_theme.rake +8 -0
  161. data/lib/tasks/seed_everything.rake +12 -0
  162. data/lib/tasks/seed_link_list.rake +8 -0
  163. data/lib/tasks/seed_shop_settings.rake +8 -0
  164. data/solidify.gemspec +61 -0
  165. metadata +668 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5d31725c68cd0a010a576ed9b11c5d131c844276
4
+ data.tar.gz: 91a1b12282e26c409889ee29430a4972d73aa3f8
5
+ SHA512:
6
+ metadata.gz: 8f88be72ab00dc21517c024172433549bb15e2ec9a5d07d76148dda71c2325a8c718201ba70239d87f532b445a71298c21789de781b1d06b1c79a08ac3f493fc
7
+ data.tar.gz: 1bfdcf0408cb98e0001168b3d58e8616cdc77084c188a71e3e8fdac5ef9e4a59b52957fda8eb29452ac3379947e551f3893f4892a71b75cc9242161b270c593a
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /spec/dummy/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,40 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ Exclude:
4
+ - 'bin/*'
5
+ - 'db/schema.rb'
6
+ - 'vendor/bundle/**/*'
7
+ - 'spec/dummy/**/*'
8
+ Include:
9
+ - 'lib/tasks/**/*'
10
+ - '**/Gemfile'
11
+ - '**/Rakefile'
12
+ - '**/Guardfile'
13
+ TargetRubyVersion: 2.3
14
+ Documentation:
15
+ Enabled: false
16
+ Metrics/AbcSize:
17
+ Exclude:
18
+ - 'db/migrate/**'
19
+ Metrics/BlockLength:
20
+ Exclude:
21
+ - config/environments/production.rb
22
+ - '**/*_spec.rb'
23
+ - 'spec/shared_examples/**'
24
+ Metrics/MethodLength:
25
+ Exclude:
26
+ - 'db/migrate/**'
27
+ Metrics/ModuleLength:
28
+ Exclude:
29
+ - '**/*_spec.rb'
30
+ - 'spec/shared_examples/**'
31
+ Lint/Debugger:
32
+ Enabled: false
33
+ Lint/DefEndAlignment:
34
+ AutoCorrect: true
35
+ Lint/EndAlignment:
36
+ AutoCorrect: true
37
+ Rails:
38
+ Enabled: true
39
+ Style/FrozenStringLiteralComment:
40
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ addons:
2
+ code_climate:
3
+ repo_token: d5a9fb48e59e528a86fc65b09dcbd8836b70879f97d56759d0f5a5fe3d8597bc
4
+ after_success:
5
+ - bundle exec codeclimate-test-reporter
6
+ cache: bundler
7
+ language: ruby
8
+ rvm: 2.4.0
9
+ services:
10
+ - redis-server
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at viktor.fonic@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,51 @@
1
+ guard :bundler do
2
+ require 'guard/bundler'
3
+ require 'guard/bundler/verify'
4
+ helper = Guard::Bundler::Verify.new
5
+
6
+ files = ['Gemfile']
7
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
8
+
9
+ # Assume files are symlinked from somewhere
10
+ files.each { |file| watch(helper.real_path(file)) }
11
+ end
12
+
13
+ guard :rubocop, all_on_start: false, cli: '-aDERS' do
14
+ watch(/.+\.rb$/)
15
+ watch(/.+\.rake$/)
16
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
17
+ end
18
+
19
+ guard :rspec, cmd: 'spring rspec', failed_mode: :keep do
20
+ require 'guard/rspec/dsl'
21
+ dsl = Guard::RSpec::Dsl.new(self)
22
+
23
+ # RSpec files
24
+ rspec = dsl.rspec
25
+ watch(rspec.spec_helper) { rspec.spec_dir }
26
+ watch(rspec.spec_support) { rspec.spec_dir }
27
+ watch(rspec.spec_files)
28
+
29
+ # Ruby files
30
+ ruby = dsl.ruby
31
+ dsl.watch_spec_files_for(ruby.lib_files)
32
+
33
+ # watch /app files
34
+ watch(%r{^app/(.+)/solidify/(.+).rb$}) do |m|
35
+ "spec/#{m[1]}/solidify/#{m[2]}_spec.rb"
36
+ end
37
+ watch(%r{^app/(.+)/spree/(.+).rb$}) do |m|
38
+ "spec/#{m[1]}/spree/#{m[2]}_spec.rb"
39
+ end
40
+ watch(%r{^app/(.+)/spree/(.+)_decorator.rb$}) do |m|
41
+ "spec/#{m[1]}/spree/#{m[2]}_spec.rb"
42
+ end
43
+ end
44
+
45
+ guard 'spring', bundler: true do
46
+ watch('Gemfile.lock')
47
+ watch(%r{^config/})
48
+ watch(%r{^lib/})
49
+ watch(%r{^spec/(support|factories)/})
50
+ watch(%r{^spec/factory.rb})
51
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Viktor Fonic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # Solidify
2
+
3
+ [![Build Status](https://travis-ci.org/vfonic/solidify.svg?branch=master)](https://travis-ci.org/vfonic/solidify)
4
+ [![Code Climate](https://codeclimate.com/github/vfonic/solidify/badges/gpa.svg)](https://codeclimate.com/github/vfonic/solidify)
5
+ [![Test Coverage](https://codeclimate.com/github/vfonic/solidify/badges/coverage.svg)](https://codeclimate.com/github/vfonic/solidify/coverage)
6
+ [![security](https://hakiri.io/github/vfonic/solidify/master.svg)](https://hakiri.io/github/vfonic/solidify/master)
7
+ [![git.legal](https://git.legal/projects/3620/badge.svg?key=5c097d05a251758abac3 "Number of libraries approved")](https://git.legal/projects/3620)
8
+
9
+ Rails meets Shopify liquid theme files.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'solidify'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install
22
+
23
+ ## Usage
24
+
25
+ To get the necessary migrations into your app, run the following
26
+ (this assumes you have already set `solidus` with `solidus_auth_devise`):
27
+
28
+ ```sh
29
+ $ rails generate solidify:install
30
+ ```
31
+
32
+ Add these ENV variables so that Carrierwave gem can store your theme files to S3:
33
+
34
+ ```yaml
35
+ AWS_ACCESS_KEY_ID: ''
36
+ AWS_SECRET_ACCESS_KEY: ''
37
+ AWS_S3_REGION: 'us-east-1'
38
+ AWS_S3_BUCKET_NAME: 'solid5-shop'
39
+ ```
40
+
41
+ Run this command to seed the default theme, shop settings and link lists:
42
+
43
+ ```sh
44
+ $ rails solidify:shop:seed_everything
45
+ ```
46
+
47
+ To download theme files, run:
48
+
49
+ ```sh
50
+ $ rails solidify:theme:download_all_themes
51
+ ```
52
+
53
+ ## Running tests
54
+
55
+ To run the tests, you first need to create a test app. This can be done by running:
56
+
57
+ ```sh
58
+ $ bundle exec rake
59
+ ```
60
+
61
+ This will create a dummy app in `/spec/dummy` directory and run rubocop and all rspec tests. To run the tests second time, you don't need to run it through rake, but can run it normally via:
62
+
63
+ ```sh
64
+ $ rspec
65
+ ```
66
+
67
+ or
68
+
69
+ ```sh
70
+ $ spring rspec
71
+ ```
72
+
73
+ ## License
74
+
75
+ [MIT License](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ load 'rails/tasks/statistics.rake'
8
+
9
+ Bundler::GemHelper.install_tasks
10
+
11
+ require 'rspec/core'
12
+ require 'rspec/core/rake_task'
13
+ require 'spree/testing_support/common_rake'
14
+
15
+ require 'solidus_core'
16
+
17
+ desc 'Run all specs in spec directory (excluding plugin specs)'
18
+ RSpec::Core::RakeTask.new
19
+
20
+ task :default do
21
+ if Dir['spec/dummy'].empty?
22
+ Rake::Task[:test_app].invoke
23
+ Dir.chdir('../../')
24
+ end
25
+ require 'rubocop/rake_task'
26
+ RuboCop::RakeTask.new
27
+ Rake::Task['rubocop:auto_correct'].invoke
28
+ Rake::Task[:spec].invoke
29
+ end
30
+
31
+ desc 'Generates a dummy app for testing'
32
+ task :test_app do
33
+ ENV['LIB_NAME'] = 'solidify'
34
+ Rake::Task['common:test_app'].invoke('Spree::User')
35
+
36
+ # we can not run this as a Rake::Task because it depends on environment
37
+ # and environment is not ready from the just created dummy app for some reason
38
+ # rubocop:disable Metric/LineLength
39
+ sh 'bundle exec rake solidify:themes:seed_default_theme RAILS_ENV=test AWS_S3_BUCKET_NAME=solidify'
40
+ # rubocop:enable Metric/LineLength
41
+ sh 'bundle exec rake solidify:themes:download_all_themes RAILS_ENV=test'
42
+ end
@@ -0,0 +1,26 @@
1
+ module Solidify
2
+ module Liquid
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include LiquidHelper
7
+ include ShopHelper
8
+ prepend_before_action :set_active_theme
9
+ before_action :set_liquid_assigns
10
+
11
+ layout :theme_layout_file
12
+
13
+ def liquid_assigns
14
+ # merge example:
15
+ # { nested: { one: 1 } }.merge({ nested: { two: 2 } })
16
+ # => { nested: { two: 2 } }
17
+ # deep_merge example:
18
+ # { nested: { one: 1 } }.merge({ nested: { two: 2 } })
19
+ # => { nested: { one: 1, two: 2 } }
20
+ super.merge(@liquid_assigns)
21
+ end
22
+
23
+ alias_method :customer, :current_customer
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ module Solidify
2
+ class AddressesController < LiquidController
3
+ def index
4
+ render controller_action_to_liquid_file_path
5
+ end
6
+
7
+ def set_liquid_assigns
8
+ @liquid_assigns = {
9
+ 'canonical_url' => "#{request.base_url}#{customer_addresses_path}",
10
+ 'page_title' => 'addresses.title',
11
+ 'template' => 'page'
12
+ }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Solidify
2
+ class CartsController < LiquidController
3
+ def show
4
+ render controller_action_to_liquid_file_path
5
+ end
6
+
7
+ def set_liquid_assigns
8
+ @liquid_assigns = {
9
+ 'canonical_url' => request.base_url.to_s,
10
+ 'page_title' => 'cart',
11
+ 'template' => 'cart'
12
+ }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ module Solidify
2
+ class CollectionsController < LiquidController
3
+ def show
4
+ render controller_action_to_liquid_file_path(collection)
5
+ end
6
+
7
+ def set_liquid_assigns
8
+ @liquid_assigns = {
9
+ 'canonical_url' => "#{request.base_url}#{collection.url}",
10
+ 'collection' => collection,
11
+ 'page_title' => collection.title,
12
+ 'template' => 'collection'
13
+ }
14
+ end
15
+
16
+ private
17
+
18
+ def collection
19
+ @collection ||= if params[:id] == 'all'
20
+ Spree::Taxon.find_or_create_collections_all
21
+ else
22
+ Spree::Taxon.find(params[:id])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ module Solidify
2
+ class CustomersController < LiquidController
3
+ def show
4
+ render controller_action_to_liquid_file_path(customer)
5
+ end
6
+
7
+ def set_liquid_assigns
8
+ @liquid_assigns = {
9
+ 'canonical_url' => "#{request.base_url}/account",
10
+ 'customer' => customer,
11
+ 'page_title' => 'customer.title',
12
+ 'template' => 'customer'
13
+ }
14
+ end
15
+ end
16
+ end