workarea-theme 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.eslintrc +25 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +25 -0
- data/.rubocop.yml +8 -0
- data/.scss-lint.yml +192 -0
- data/CHANGELOG.md +88 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +20 -0
- data/LICENSE +52 -0
- data/README.md +315 -0
- data/Rakefile +63 -0
- data/bin/rails +21 -0
- data/config/initializers/workarea.rb +3 -0
- data/config/routes.rb +2 -0
- data/docs/guides/source/theme_template.rb +155 -0
- data/engines/workarea-bogus-theme/.gitignore +19 -0
- data/engines/workarea-bogus-theme/Gemfile +19 -0
- data/engines/workarea-bogus-theme/README.md +51 -0
- data/engines/workarea-bogus-theme/Rakefile +108 -0
- data/engines/workarea-bogus-theme/bin/rails +21 -0
- data/engines/workarea-bogus-theme/config/initializers/theme.rb +16 -0
- data/engines/workarea-bogus-theme/config/initializers/workarea.rb +3 -0
- data/engines/workarea-bogus-theme/config/routes.rb +2 -0
- data/engines/workarea-bogus-theme/lib/tasks/bogus_theme_tasks.rake +4 -0
- data/engines/workarea-bogus-theme/lib/workarea/bogus_theme.rb +11 -0
- data/engines/workarea-bogus-theme/lib/workarea/bogus_theme/engine.rb +11 -0
- data/engines/workarea-bogus-theme/lib/workarea/bogus_theme/version.rb +5 -0
- data/engines/workarea-bogus-theme/test/dummy/Rakefile +6 -0
- data/engines/workarea-bogus-theme/test/dummy/bin/bundle +4 -0
- data/engines/workarea-bogus-theme/test/dummy/bin/rails +5 -0
- data/engines/workarea-bogus-theme/test/dummy/bin/rake +5 -0
- data/engines/workarea-bogus-theme/test/dummy/bin/setup +38 -0
- data/engines/workarea-bogus-theme/test/dummy/bin/update +30 -0
- data/engines/workarea-bogus-theme/test/dummy/bin/yarn +12 -0
- data/engines/workarea-bogus-theme/test/dummy/config.ru +5 -0
- data/engines/workarea-bogus-theme/test/dummy/config/application.rb +27 -0
- data/engines/workarea-bogus-theme/test/dummy/config/boot.rb +5 -0
- data/engines/workarea-bogus-theme/test/dummy/config/cable.yml +10 -0
- data/engines/workarea-bogus-theme/test/dummy/config/environment.rb +5 -0
- data/engines/workarea-bogus-theme/test/dummy/config/environments/development.rb +54 -0
- data/engines/workarea-bogus-theme/test/dummy/config/environments/production.rb +91 -0
- data/engines/workarea-bogus-theme/test/dummy/config/environments/test.rb +44 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/assets.rb +14 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/inflections.rb +16 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/mime_types.rb +4 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/workarea.rb +5 -0
- data/engines/workarea-bogus-theme/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/engines/workarea-bogus-theme/test/dummy/config/locales/en.yml +33 -0
- data/engines/workarea-bogus-theme/test/dummy/config/puma.rb +56 -0
- data/engines/workarea-bogus-theme/test/dummy/config/routes.rb +5 -0
- data/engines/workarea-bogus-theme/test/dummy/config/secrets.yml +32 -0
- data/engines/workarea-bogus-theme/test/dummy/config/spring.rb +6 -0
- data/engines/workarea-bogus-theme/test/dummy/db/seeds.rb +2 -0
- data/engines/workarea-bogus-theme/test/dummy/lib/assets/.keep +0 -0
- data/engines/workarea-bogus-theme/test/dummy/log/.keep +0 -0
- data/engines/workarea-bogus-theme/test/dummy/package.json +5 -0
- data/engines/workarea-bogus-theme/test/teaspoon_env.rb +6 -0
- data/engines/workarea-bogus-theme/test/test_helper.rb +10 -0
- data/engines/workarea-bogus-theme/workarea-bogus_theme.gemspec +21 -0
- data/lib/generators/workarea/starter_store/USAGE +13 -0
- data/lib/generators/workarea/starter_store/starter_store_generator.rb +124 -0
- data/lib/generators/workarea/theme_override/USAGE +8 -0
- data/lib/generators/workarea/theme_override/theme_override_generator.rb +50 -0
- data/lib/tasks/theme_tasks.rake +4 -0
- data/lib/workarea/theme.rb +40 -0
- data/lib/workarea/theme/engine.rb +8 -0
- data/lib/workarea/theme/errors.rb +5 -0
- data/lib/workarea/theme/version.rb +5 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/bin/bundle +4 -0
- data/test/dummy/bin/rails +5 -0
- data/test/dummy/bin/rake +5 -0
- data/test/dummy/bin/setup +38 -0
- data/test/dummy/bin/update +30 -0
- data/test/dummy/bin/yarn +12 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +27 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +91 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +32 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/package.json +5 -0
- data/test/generators/workarea/starter_store_generator_test.rb +79 -0
- data/test/generators/workarea/theme_override_generator_test.rb +23 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +10 -0
- data/workarea-theme.gemspec +21 -0
- metadata +201 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
20
|
+
# the default I18n backend:
|
21
|
+
#
|
22
|
+
# true, false, on, off, yes, no
|
23
|
+
#
|
24
|
+
# Instead, surround them with single quotes.
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# 'true': 'foo'
|
28
|
+
#
|
29
|
+
# To learn more, please read the Rails Internationalization guide
|
30
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
31
|
+
|
32
|
+
en:
|
33
|
+
hello: "Hello world"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum; this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
|
8
|
+
threads threads_count, threads_count
|
9
|
+
|
10
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
11
|
+
#
|
12
|
+
port ENV.fetch('PORT') { 3000 }
|
13
|
+
|
14
|
+
# Specifies the `environment` that Puma will run in.
|
15
|
+
#
|
16
|
+
environment ENV.fetch('RAILS_ENV') { 'development' }
|
17
|
+
|
18
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
19
|
+
# Workers are forked webserver processes. If using threads and workers together
|
20
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
21
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
22
|
+
# processes).
|
23
|
+
#
|
24
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
25
|
+
|
26
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
27
|
+
# This directive tells Puma to first boot the application and load code
|
28
|
+
# before forking the application. This takes advantage of Copy On Write
|
29
|
+
# process behavior so workers use less memory. If you use this option
|
30
|
+
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
31
|
+
# block.
|
32
|
+
#
|
33
|
+
# preload_app!
|
34
|
+
|
35
|
+
# If you are preloading your application and using Active Record, it's
|
36
|
+
# recommended that you close any connections to the database before workers
|
37
|
+
# are forked to prevent connection leakage.
|
38
|
+
#
|
39
|
+
# before_fork do
|
40
|
+
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
41
|
+
# end
|
42
|
+
|
43
|
+
# The code in the `on_worker_boot` will be called if you are using
|
44
|
+
# clustered mode by specifying a number of `workers`. After each worker
|
45
|
+
# process is booted, this block will be run. If you are using the `preload_app!`
|
46
|
+
# option, you will want to use this block to reconnect to any threads
|
47
|
+
# or connections that may have been created at application boot, as Ruby
|
48
|
+
# cannot share connections between processes.
|
49
|
+
#
|
50
|
+
# on_worker_boot do
|
51
|
+
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
|
55
|
+
# Allow puma to be restarted by `rails restart` command.
|
56
|
+
plugin :tmp_restart
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rails secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
# Shared secrets are available across all environments.
|
14
|
+
|
15
|
+
# shared:
|
16
|
+
# api_key: a1B2c3D4e5F6
|
17
|
+
|
18
|
+
# Environmental secrets are only available for that specific environment.
|
19
|
+
|
20
|
+
development:
|
21
|
+
secret_key_base: 001621c41f01ea5ded08595001057f27c1933a09b16a9bca8a64c443c92c0b207296840b3a4b8814e16c81091d14d0e0c3a11d0ddd4ce0ee249c432ff24deda7
|
22
|
+
|
23
|
+
test:
|
24
|
+
secret_key_base: b1431d24ef871c8310ee649c048b45a070a46409393a16ae584136e898e2f53d307a44816a8853ea3617660f530e5cbd0f39f2c0c64a60e5535f69bb13fb2d7a
|
25
|
+
|
26
|
+
# Do not keep production secrets in the unencrypted secrets file.
|
27
|
+
# Instead, either read values from the environment.
|
28
|
+
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
29
|
+
# and move the `production:` environment over there.
|
30
|
+
|
31
|
+
production:
|
32
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require File.expand_path('../test/dummy/config/environment.rb', __dir__)
|
5
|
+
require 'rails/test_help'
|
6
|
+
require 'workarea/test_help'
|
7
|
+
|
8
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
9
|
+
# to be shown.
|
10
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'workarea/bogus_theme/version'
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'workarea-bogus_theme'
|
9
|
+
s.version = Workarea::BogusTheme::VERSION
|
10
|
+
s.authors = ['Jake Beresford']
|
11
|
+
s.email = ['jberesford@weblinc.com']
|
12
|
+
s.homepage = 'http://www.workarea.com'
|
13
|
+
s.summary = 'BogusTheme for testing theme functionality'
|
14
|
+
s.description = 'Totally fake theme, dude.'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
|
18
|
+
s.add_dependency 'workarea', '~> 3.x'
|
19
|
+
s.add_dependency 'workarea-blog', '>= 3.2.0'
|
20
|
+
s.add_dependency 'workarea-theme'
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Description:
|
2
|
+
Imports a theme in to your host application to kick-start development.
|
3
|
+
You must have a single workarea theme installed in your host application.
|
4
|
+
|
5
|
+
Examples:
|
6
|
+
rails g workarea:starter_store
|
7
|
+
|
8
|
+
This will create all app, config, and test files from your theme in your host
|
9
|
+
application.
|
10
|
+
|
11
|
+
It will also import all of the dependencies from the theme's gemspec in to
|
12
|
+
your host application's Gemfile. The theme will be commented out in the
|
13
|
+
Gemfile as it is no longer needed.
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'workarea/testing/engine'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class StarterStoreGenerator < Rails::Generators::Base
|
5
|
+
desc File.read(File.expand_path('USAGE', __dir__))
|
6
|
+
|
7
|
+
def theme_import
|
8
|
+
@theme = Workarea::Theme.installed
|
9
|
+
self.class.source_root(@theme.root)
|
10
|
+
|
11
|
+
import_app_files
|
12
|
+
update_gemfile
|
13
|
+
import_initializers
|
14
|
+
import_tests
|
15
|
+
remove_theme_from_gemfile
|
16
|
+
load_helpers
|
17
|
+
bundle_install
|
18
|
+
|
19
|
+
puts "#{@theme.homebase_name} imported successfully."
|
20
|
+
puts 'You may need to run the assets:clobber rake task for changes to take effect.'
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def import_app_files
|
26
|
+
puts 'Importing app files...'
|
27
|
+
|
28
|
+
relative_path = 'app'
|
29
|
+
directory(relative_to_original_destination_root(relative_path), relative_path)
|
30
|
+
end
|
31
|
+
|
32
|
+
def import_initializers
|
33
|
+
puts 'Importing initializers...'
|
34
|
+
|
35
|
+
relative_path = 'config'
|
36
|
+
directory(relative_to_original_destination_root(relative_path), relative_path)
|
37
|
+
end
|
38
|
+
|
39
|
+
def load_helpers
|
40
|
+
puts 'Loading helpers...'
|
41
|
+
|
42
|
+
helpers = Dir["#{@theme.root}/app/helpers/**/*.rb"].map do |helper|
|
43
|
+
file_name = helper.split('/').last.gsub('.rb', '')
|
44
|
+
"Workarea::Storefront::ApplicationController.helper(Workarea::Storefront::#{file_name.camelize})\n".indent(2)
|
45
|
+
end.join('')
|
46
|
+
|
47
|
+
application do
|
48
|
+
f = "config.to_prepare do\n"
|
49
|
+
f << helpers.indent(4)
|
50
|
+
f << "end\n".indent(4)
|
51
|
+
f
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def import_tests
|
56
|
+
puts 'Importing tests...'
|
57
|
+
|
58
|
+
relative_path = 'test'
|
59
|
+
directory(relative_to_original_destination_root(relative_path), relative_path, exclude_pattern: 'dummy/*|teaspoon_env.rb|test_helper.rb')
|
60
|
+
end
|
61
|
+
|
62
|
+
def remove_theme_from_gemfile
|
63
|
+
puts 'Commenting out theme from gemfile...'
|
64
|
+
comment_lines 'Gemfile', /#{@theme.slug}/
|
65
|
+
end
|
66
|
+
|
67
|
+
def update_gemfile
|
68
|
+
puts 'Updating gemfile...'
|
69
|
+
|
70
|
+
workarea_dependencies, other_dependencies = dependency_array.partition { |d| d[:name].include?("workarea") }
|
71
|
+
|
72
|
+
inject_into_file 'Gemfile', after: "source 'https://gems.weblinc.com' do\n" do
|
73
|
+
workarea_dependencies.map do |dependency|
|
74
|
+
if dependency[:requirement] == '>= 0'
|
75
|
+
"gem '#{dependency[:name]}'\n"
|
76
|
+
else
|
77
|
+
"gem '#{dependency[:name]}', '#{dependency[:requirement]}'\n"
|
78
|
+
end
|
79
|
+
end.join('').indent(2)
|
80
|
+
end
|
81
|
+
|
82
|
+
inject_into_file 'Gemfile', before: "source 'https://gems.weblinc.com' do\n" do
|
83
|
+
other_dependencies.map do |dependency|
|
84
|
+
if dependency[:requirement] == '>= 0'
|
85
|
+
"gem '#{dependency[:name]}'\n"
|
86
|
+
else
|
87
|
+
"gem '#{dependency[:name]}', '#{dependency[:requirement]}'\n"
|
88
|
+
end
|
89
|
+
end.join('')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def dependency_array
|
94
|
+
dependencies_from_gemspec.delete_if do |d|
|
95
|
+
d[:name].in?(dependencies_from_gemfile) || d[:name] == 'workarea-theme'
|
96
|
+
end.sort_by { |d| d[:name] }
|
97
|
+
end
|
98
|
+
|
99
|
+
def dependencies_from_gemspec
|
100
|
+
gemspec_path = "#{@theme.root}/workarea-#{@theme.slug}.gemspec"
|
101
|
+
dependencies = Gem::Specification.load(gemspec_path).dependencies
|
102
|
+
|
103
|
+
dependencies.map do |dependency|
|
104
|
+
{
|
105
|
+
name: dependency.name,
|
106
|
+
requirement: dependency.requirements_list.join('')
|
107
|
+
}
|
108
|
+
end.compact
|
109
|
+
end
|
110
|
+
|
111
|
+
def dependencies_from_gemfile
|
112
|
+
File.readlines('Gemfile').map do |line|
|
113
|
+
next unless line.include?('gem')
|
114
|
+
next if line.include?('#') || line.include?('gems.weblinc') || line.include?('rubygems')
|
115
|
+
line.chomp.strip.split(',').first.split("'").last
|
116
|
+
end.compact
|
117
|
+
end
|
118
|
+
|
119
|
+
def bundle_install
|
120
|
+
puts 'Installing new gems...'
|
121
|
+
run('bundle install', verbose: false)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'workarea/testing/engine'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class ThemeOverrideGenerator < Rails::Generators::Base
|
5
|
+
desc File.read(File.expand_path('USAGE', __dir__))
|
6
|
+
|
7
|
+
def copy_storefront
|
8
|
+
override_views
|
9
|
+
override_styles
|
10
|
+
override_javascripts
|
11
|
+
commit_overrides
|
12
|
+
puts 'Good to go! Your theme is ready for development!'
|
13
|
+
puts "Don't forget to run the cleanup script when you're done."
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def override_views
|
19
|
+
Rails::Generators.invoke('workarea:override', ['views', 'workarea/storefront'])
|
20
|
+
Rails::Generators.invoke('workarea:override', ['layouts', 'workarea/storefront/application.html.haml'])
|
21
|
+
Rails::Generators.invoke('workarea:override', ['layouts', 'workarea/storefront/checkout.html.haml'])
|
22
|
+
end
|
23
|
+
|
24
|
+
def override_styles
|
25
|
+
Rails::Generators.invoke('workarea:override', ['stylesheets', 'workarea/storefront/base'])
|
26
|
+
Rails::Generators.invoke('workarea:override', ['stylesheets', 'workarea/storefront/components'])
|
27
|
+
Rails::Generators.invoke('workarea:override', ['stylesheets', 'workarea/storefront/settings'])
|
28
|
+
Rails::Generators.invoke('workarea:override', ['stylesheets', 'workarea/storefront/typography'])
|
29
|
+
end
|
30
|
+
|
31
|
+
def override_javascripts
|
32
|
+
Rails::Generators.invoke('workarea:override', ['javascripts', 'workarea/storefront/modules'])
|
33
|
+
Rails::Generators.invoke('workarea:override', ['javascripts', 'workarea/storefront/templates'])
|
34
|
+
end
|
35
|
+
|
36
|
+
def commit_overrides
|
37
|
+
if Rails.env.test?
|
38
|
+
create_file 'lib/workarea/theme/override_commit', 'TEST'
|
39
|
+
else
|
40
|
+
`git add .`
|
41
|
+
`git commit -m"Theme override commit"`
|
42
|
+
sha = `git log -n 1 --format=%H`
|
43
|
+
|
44
|
+
create_file 'lib/workarea/theme/override_commit', sha
|
45
|
+
`git add lib/workarea/theme/override_commit`
|
46
|
+
`git commit -m"Commit the override commit sha record"`
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'workarea'
|
4
|
+
require 'workarea/storefront'
|
5
|
+
require 'workarea/admin'
|
6
|
+
|
7
|
+
require 'workarea/theme/engine'
|
8
|
+
require 'workarea/theme/version'
|
9
|
+
require 'workarea/theme/errors'
|
10
|
+
|
11
|
+
module Workarea
|
12
|
+
module Theme
|
13
|
+
extend ActiveSupport::Concern
|
14
|
+
mattr_accessor :installed
|
15
|
+
|
16
|
+
included do
|
17
|
+
extend Workarea::MountPoint
|
18
|
+
|
19
|
+
mod = to_s.gsub('::Engine', '').constantize
|
20
|
+
|
21
|
+
def mod.slug
|
22
|
+
to_s.gsub('Workarea::', '').underscore
|
23
|
+
end
|
24
|
+
|
25
|
+
def mod.homebase_name
|
26
|
+
to_s.gsub('Workarea::', '').gsub('::', ' ').titleize
|
27
|
+
end
|
28
|
+
|
29
|
+
def mod.root
|
30
|
+
const_get(:Engine).root
|
31
|
+
end
|
32
|
+
|
33
|
+
if Workarea::Theme.installed.present?
|
34
|
+
raise MultipleThemesError
|
35
|
+
else
|
36
|
+
Workarea::Theme.installed = mod
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|