solidus_liquid 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +36 -0
  5. data/.travis.yml +10 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +3 -0
  8. data/Guardfile +37 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +84 -0
  11. data/Rakefile +35 -0
  12. data/app/controllers/concerns/solidus_liquid/liquid.rb +26 -0
  13. data/app/controllers/solidus_liquid/addresses_controller.rb +15 -0
  14. data/app/controllers/solidus_liquid/carts_controller.rb +15 -0
  15. data/app/controllers/solidus_liquid/collections_controller.rb +22 -0
  16. data/app/controllers/solidus_liquid/customers_controller.rb +16 -0
  17. data/app/controllers/solidus_liquid/home_controller.rb +15 -0
  18. data/app/controllers/solidus_liquid/liquid_controller.rb +25 -0
  19. data/app/controllers/solidus_liquid/orders_controller.rb +18 -0
  20. data/app/controllers/solidus_liquid/pages_controller.rb +22 -0
  21. data/app/controllers/solidus_liquid/products_controller.rb +30 -0
  22. data/app/controllers/solidus_liquid/registrations_controller.rb +25 -0
  23. data/app/controllers/solidus_liquid/responders/solidus_liquid/liquid_responder.rb +29 -0
  24. data/app/controllers/solidus_liquid/search_controller.rb +41 -0
  25. data/app/controllers/solidus_liquid/sessions_controller.rb +15 -0
  26. data/app/drops/rails_settings/scoped_settings_drop.rb +11 -0
  27. data/app/drops/solidus_liquid/errors_drop.rb +14 -0
  28. data/app/drops/solidus_liquid/link_drop.rb +15 -0
  29. data/app/drops/solidus_liquid/link_list_drop.rb +7 -0
  30. data/app/drops/solidus_liquid/nil_drop.rb +7 -0
  31. data/app/drops/solidus_liquid/page_drop.rb +7 -0
  32. data/app/drops/solidus_liquid/search_drop.rb +7 -0
  33. data/app/drops/spree/address_drop.rb +24 -0
  34. data/app/drops/spree/image_drop.rb +10 -0
  35. data/app/drops/spree/line_item_drop.rb +5 -0
  36. data/app/drops/spree/option_type_drop.rb +4 -0
  37. data/app/drops/spree/order_drop.rb +18 -0
  38. data/app/drops/spree/product_drop.rb +92 -0
  39. data/app/drops/spree/taxon_drop.rb +31 -0
  40. data/app/drops/spree/user_drop.rb +19 -0
  41. data/app/drops/spree/variant_drop.rb +80 -0
  42. data/app/filters/solidus_liquid/additional_filters.rb +22 -0
  43. data/app/filters/solidus_liquid/html_filters.rb +20 -0
  44. data/app/filters/solidus_liquid/money_filters.rb +15 -0
  45. data/app/filters/solidus_liquid/string_filters.rb +11 -0
  46. data/app/filters/solidus_liquid/url_filters.rb +55 -0
  47. data/app/helpers/solidus_liquid/liquid_helper.rb +107 -0
  48. data/app/helpers/solidus_liquid/shop_helper.rb +7 -0
  49. data/app/models/concerns/solidus_liquid/address.rb +15 -0
  50. data/app/models/concerns/solidus_liquid/full_name.rb +11 -0
  51. data/app/models/concerns/solidus_liquid/handle.rb +25 -0
  52. data/app/models/concerns/solidus_liquid/inventory_policy.rb +7 -0
  53. data/app/models/solidus_liquid/asset.rb +12 -0
  54. data/app/models/solidus_liquid/link.rb +10 -0
  55. data/app/models/solidus_liquid/link_list.rb +7 -0
  56. data/app/models/solidus_liquid/page.rb +5 -0
  57. data/app/models/solidus_liquid/setting.rb +8 -0
  58. data/app/models/solidus_liquid/theme.rb +19 -0
  59. data/app/models/spree/address_decorator.rb +20 -0
  60. data/app/models/spree/image_decorator.rb +19 -0
  61. data/app/models/spree/product_decorator.rb +14 -0
  62. data/app/models/spree/taxon_decorator.rb +5 -0
  63. data/app/models/spree/variant_decorator.rb +15 -0
  64. data/app/poro/solidus_liquid/search.rb +14 -0
  65. data/app/services/solidus_liquid/app_specific_string_io.rb +15 -0
  66. data/app/services/solidus_liquid/asset_compiler.rb +11 -0
  67. data/app/services/solidus_liquid/asset_postprocessor.rb +53 -0
  68. data/app/services/solidus_liquid/link_list_seeder.rb +26 -0
  69. data/app/services/solidus_liquid/liquid_asset_compiler.rb +19 -0
  70. data/app/services/solidus_liquid/scss_asset_compiler.rb +15 -0
  71. data/app/services/solidus_liquid/shop_settings_seeder.rb +26 -0
  72. data/app/services/solidus_liquid/theme_mechanic.rb +45 -0
  73. data/app/uploaders/solidus_liquid/asset_uploader.rb +10 -0
  74. data/app/views/solidus_liquid/global/content_for_header.html.erb +0 -0
  75. data/app/views/solidus_liquid/themes/skeleton-theme/README.md +54 -0
  76. data/app/views/solidus_liquid/themes/skeleton-theme/assets/arrow-down.svg.liquid +3 -0
  77. data/app/views/solidus_liquid/themes/skeleton-theme/assets/cart.svg.liquid +4 -0
  78. data/app/views/solidus_liquid/themes/skeleton-theme/assets/shop.js.liquid +75 -0
  79. data/app/views/solidus_liquid/themes/skeleton-theme/assets/shopify_common.js +14 -0
  80. data/app/views/solidus_liquid/themes/skeleton-theme/assets/style.scss.liquid +768 -0
  81. data/app/views/solidus_liquid/themes/skeleton-theme/config/settings.html +217 -0
  82. data/app/views/solidus_liquid/themes/skeleton-theme/config/settings_data.json +26 -0
  83. data/app/views/solidus_liquid/themes/skeleton-theme/layout/theme.liquid +181 -0
  84. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/article-grid-item.liquid +73 -0
  85. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/collection-grid-item.liquid +46 -0
  86. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/collection-listing.liquid +46 -0
  87. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/open-graph-tags.liquid +35 -0
  88. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/product-grid-item.liquid +70 -0
  89. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/site-nav.liquid +57 -0
  90. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/social-links.liquid +42 -0
  91. data/app/views/solidus_liquid/themes/skeleton-theme/snippets/twitter-card.liquid +41 -0
  92. data/app/views/solidus_liquid/themes/skeleton-theme/templates/404.liquid +2 -0
  93. data/app/views/solidus_liquid/themes/skeleton-theme/templates/article.liquid +160 -0
  94. data/app/views/solidus_liquid/themes/skeleton-theme/templates/blog.grid.liquid +30 -0
  95. data/app/views/solidus_liquid/themes/skeleton-theme/templates/blog.liquid +92 -0
  96. data/app/views/solidus_liquid/themes/skeleton-theme/templates/cart.liquid +123 -0
  97. data/app/views/solidus_liquid/themes/skeleton-theme/templates/collection.liquid +102 -0
  98. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/account.liquid +57 -0
  99. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/activate_account.liquid +26 -0
  100. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/addresses.liquid +173 -0
  101. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/login.liquid +90 -0
  102. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/order.liquid +103 -0
  103. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/register.liquid +32 -0
  104. data/app/views/solidus_liquid/themes/skeleton-theme/templates/customers/reset_password.liquid +27 -0
  105. data/app/views/solidus_liquid/themes/skeleton-theme/templates/index.liquid +39 -0
  106. data/app/views/solidus_liquid/themes/skeleton-theme/templates/list-collections.liquid +19 -0
  107. data/app/views/solidus_liquid/themes/skeleton-theme/templates/page.liquid +16 -0
  108. data/app/views/solidus_liquid/themes/skeleton-theme/templates/product.liquid +202 -0
  109. data/app/views/solidus_liquid/themes/skeleton-theme/templates/search.liquid +72 -0
  110. data/bin/rails +12 -0
  111. data/config/app.yml +0 -0
  112. data/config/initializers/carrierwave.rb +25 -0
  113. data/config/initializers/devise.rb +286 -0
  114. data/config/initializers/form_tag.rb +43 -0
  115. data/config/initializers/liquid.rb +202 -0
  116. data/config/initializers/sass.rb +15 -0
  117. data/config/initializers/theme_settings.rb +29 -0
  118. data/config/routes.rb +48 -0
  119. data/db/migrate/20170223064316_create_solidus_liquid_assets.solidus_liquid.rb +14 -0
  120. data/db/migrate/20170223064317_create_solidus_liquid_themes.solidus_liquid.rb +10 -0
  121. data/db/migrate/20170223064318_create_solidus_liquid_link_lists.solidus_liquid.rb +12 -0
  122. data/db/migrate/20170223064319_create_solidus_liquid_links.solidus_liquid.rb +13 -0
  123. data/db/migrate/20170223064320_create_solidus_liquid_settings.solidus_liquid.rb +22 -0
  124. data/db/migrate/20170223064321_create_solidus_liquid_pages.solidus_liquid.rb +16 -0
  125. data/db/migrate/20170223064322_add_attributes_to_spree_users.solidus_liquid.rb +7 -0
  126. data/db/migrate/20170223064323_add_handle_to_spree_taxons.solidus_liquid.rb +7 -0
  127. data/lib/generators/solidus_liquid/install/install_generator.rb +13 -0
  128. data/lib/solidus_liquid.rb +11 -0
  129. data/lib/solidus_liquid/configuration.rb +21 -0
  130. data/lib/solidus_liquid/engine.rb +24 -0
  131. data/lib/solidus_liquid/factories.rb +7 -0
  132. data/lib/solidus_liquid/version.rb +3 -0
  133. data/lib/tasks/download_theme.rake +18 -0
  134. data/lib/tasks/seed_default_theme.rake +8 -0
  135. data/lib/tasks/seed_everything.rake +14 -0
  136. data/lib/tasks/seed_link_list.rake +8 -0
  137. data/lib/tasks/seed_shop_settings.rake +8 -0
  138. data/solidus_liquid.gemspec +56 -0
  139. metadata +586 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8c33473a36648befa79daaeb6e3f3025a2f7f62b
4
+ data.tar.gz: d341103b9b4c6191dbd430b258f7906c3a73feed
5
+ SHA512:
6
+ metadata.gz: 36eeb5e886cb920ebacf86d3585afea93e9090c65a8cd350432898bf831d8a2821d5aa3d0efcd34c065dced89e0b7c8894f2e73771c0aa49ea74e979312c8cfc
7
+ data.tar.gz: 91f472da219cd2ce128856a84ed308efbd0fd678bc509dff26a8415fa50d407768f3688fb7345d8573d3b14a99dd4fc0555162a88e10c5b7841055908cf90ab5
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,36 @@
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/**'
24
+ Metrics/MethodLength:
25
+ Exclude:
26
+ - 'db/migrate/**'
27
+ Lint/Debugger:
28
+ Enabled: false
29
+ Lint/DefEndAlignment:
30
+ AutoCorrect: true
31
+ Lint/EndAlignment:
32
+ AutoCorrect: true
33
+ Rails:
34
+ Enabled: true
35
+ Style/FrozenStringLiteralComment:
36
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ addons:
2
+ code_climate:
3
+ repo_token: 341434bb91c704341aff79848c22e2c605ddd6f99c213d7166953c46436ad6cf
4
+ after_success:
5
+ - bundle exec codeclimate-test-reporter
6
+ cache: bundler
7
+ language: ruby
8
+ rvm: 2.3.3
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,37 @@
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 :rspec, cmd: 'rspec' do
14
+ require 'guard/rspec/dsl'
15
+ dsl = Guard::RSpec::Dsl.new(self)
16
+
17
+ # RSpec files
18
+ rspec = dsl.rspec
19
+ watch(rspec.spec_helper) { rspec.spec_dir }
20
+ watch(rspec.spec_support) { rspec.spec_dir }
21
+ watch(rspec.spec_files)
22
+
23
+ # Ruby files
24
+ ruby = dsl.ruby
25
+ dsl.watch_spec_files_for(ruby.lib_files)
26
+
27
+ # watch /app files
28
+ watch(%r{^app/(.+)/solidus_liquid/(.+).rb$}) do |m|
29
+ "spec/#{m[1]}/#{m[2]}_spec.rb"
30
+ end
31
+ end
32
+
33
+ guard :rubocop, cli: '-Sa' do
34
+ watch(/.+\.rb$/)
35
+ watch(/.+\.rake$/)
36
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
37
+ 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,84 @@
1
+ # Solidus Liquid
2
+
3
+ [![Build Status](https://travis-ci.org/vfonic/solidus_liquid.svg?branch=master)](https://travis-ci.org/vfonic/solidus_liquid)
4
+ [![Code Climate](https://codeclimate.com/github/vfonic/solidus_liquid/badges/gpa.svg)](https://codeclimate.com/github/vfonic/solidus_liquid)
5
+ [![Test Coverage](https://codeclimate.com/github/vfonic/solidus_liquid/badges/coverage.svg)](https://codeclimate.com/github/vfonic/solidus_liquid/coverage)
6
+ [![security](https://hakiri.io/github/vfonic/solidus_liquid/master.svg)](https://hakiri.io/github/vfonic/solidus_liquid/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 'solidus_liquid'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install
22
+
23
+ ## Usage
24
+
25
+ First run:
26
+
27
+ ```ruby
28
+ rails generate solidus_liquid:install
29
+ ```
30
+
31
+ ...to get the necessary migrations into your app.
32
+
33
+ SolidusLiquid uses redis to manage Shop and Theme settings. To load the settings, create a new initializer in `config/initializers`:
34
+
35
+ ```ruby
36
+ if SolidusLiquid::Theme.table_exists?
37
+ SolidusLiquid::Theme.all.each do |theme|
38
+ settings_file = Rails.root.join(
39
+ 'app', 'views', 'themes', theme.id.to_s, 'config', 'settings_data.json'
40
+ )
41
+ next unless settings_file.exist?
42
+ settings_data = JSON.parse(
43
+ File.read(settings_file)
44
+ )
45
+ if settings_data['current'].is_a? String
46
+ settings = settings_data['presets'][settings_data['current']].to_json
47
+ else
48
+ settings = settings_data['current'].to_json
49
+ end
50
+ Redis.current.set("solidus_liquid_themes_#{theme.id}", settings)
51
+ end
52
+ end
53
+
54
+ settings_file = SolidusLiquid::Engine.root.join(
55
+ 'app', 'views', 'solidus_liquid', 'themes', 'skeleton-theme', 'config', 'settings_data.json'
56
+ )
57
+ settings_data = JSON.parse(File.read(settings_file))
58
+ if settings_data['current'].is_a? String
59
+ settings = settings_data['presets'][settings_data['current']].to_json
60
+ else
61
+ settings = settings_data['current'].to_json
62
+ end
63
+ Redis.current.set("solidus_liquid_themes_", settings)
64
+ ```
65
+
66
+ Add this gem to your `Gemfile` until I publish it:
67
+ ```ruby
68
+ gem 'liquid-rails', github: 'vfonic/liquid-rails'
69
+ ```
70
+
71
+ Add these ENV variables so that Carrierwave gem can store your theme files to S3:
72
+
73
+ ```yaml
74
+ AWS_ACCESS_KEY_ID: ''
75
+ AWS_SECRET_ACCESS_KEY: ''
76
+ AWS_S3_REGION: 'us-east-1'
77
+ AWS_S3_BUCKET_NAME: 'solid5-shop'
78
+ ```
79
+
80
+ From rails console run `SolidusLiquid::ThemeMechanic.new.create` to seed the database.
81
+
82
+ Run `rake solidus_liquid:theme:download_all_themes` to download theme files.
83
+
84
+ [MIT License](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,35 @@
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'] = 'solidus_liquid'
34
+ Rake::Task['common:test_app'].invoke('Spree::User')
35
+ end
@@ -0,0 +1,26 @@
1
+ module SolidusLiquid
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 SolidusLiquid
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 SolidusLiquid
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,22 @@
1
+ module SolidusLiquid
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 ||= Spree::Taxon.find(params[:id])
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ module SolidusLiquid
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
@@ -0,0 +1,15 @@
1
+ module SolidusLiquid
2
+ class HomeController < 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.to_s,
10
+ 'page_title' => '',
11
+ 'template' => 'page'
12
+ }
13
+ end
14
+ end
15
+ end