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
data/CODE_OF_CONDUCT.md
ADDED
data/CONTRIBUTING.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
git_source(:github) { |repo| "git@github.com:#{repo}.git" }
|
3
|
+
|
4
|
+
# Declare your gem's dependencies in theme.gemspec.
|
5
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
6
|
+
# development dependencies will be added by default to the :development group.
|
7
|
+
gemspec
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use a debugger
|
14
|
+
# gem 'byebug', group: [:development, :test]
|
15
|
+
|
16
|
+
gem 'workarea'
|
17
|
+
|
18
|
+
group :test do
|
19
|
+
gem 'workarea-bogus_theme', '~> 0.1.0', path: 'engines/workarea-bogus-theme', require: 'workarea/bogus_theme'
|
20
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
WebLinc
|
2
|
+
Business Source License
|
3
|
+
|
4
|
+
Licensor: WebLinc Corporation, 22 S. 3rd Street, 2nd Floor, Philadelphia PA 19106
|
5
|
+
|
6
|
+
Licensed Work: Workarea Commerce Platform
|
7
|
+
The Licensed Work is (c) 2019 WebLinc Corporation
|
8
|
+
|
9
|
+
Additional Use Grant:
|
10
|
+
You may make production use of the Licensed Work without an additional license agreement with WebLinc so long as you do not use the Licensed Work for a Commerce Service.
|
11
|
+
|
12
|
+
A "Commerce Service" is a commercial offering that allows third parties (other than your employees and contractors) to access the functionality of the Licensed Work by creating or managing commerce functionality, the products, taxonomy, assets and/or content of which are controlled by such third parties.
|
13
|
+
|
14
|
+
For information about obtaining an additional license agreement with WebLinc, contact licensing@workarea.com.
|
15
|
+
|
16
|
+
Change Date: 2019-08-20
|
17
|
+
|
18
|
+
Change License: Version 2.0 or later of the GNU General Public License as published by the Free Software Foundation
|
19
|
+
|
20
|
+
Terms
|
21
|
+
|
22
|
+
The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
|
23
|
+
|
24
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
|
25
|
+
|
26
|
+
If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
|
27
|
+
|
28
|
+
All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
|
29
|
+
|
30
|
+
You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
|
31
|
+
|
32
|
+
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
33
|
+
|
34
|
+
This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works and to refer to it using the trademark "Business Source License" as long as you comply with the Covenants of Licensor below.
|
35
|
+
|
36
|
+
Covenants of Licensor
|
37
|
+
In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
|
38
|
+
|
39
|
+
To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
|
40
|
+
|
41
|
+
To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None."
|
42
|
+
|
43
|
+
To specify a Change Date.
|
44
|
+
|
45
|
+
Not to modify this License in any other way.
|
46
|
+
|
47
|
+
Notice
|
48
|
+
The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
|
49
|
+
|
50
|
+
For more information on the use of the Business Source License generally, please visit the Adopting and Developing Business Source License FAQ.
|
51
|
+
|
52
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab.
|
data/README.md
ADDED
@@ -0,0 +1,315 @@
|
|
1
|
+
# Workarea Theme
|
2
|
+
|
3
|
+
This plugins provides infrastructure for theme development and use on the Workarea platform.
|
4
|
+
|
5
|
+
## Workarea Themes
|
6
|
+
|
7
|
+
A Workarea theme is a specialized type of Workarea plugin.
|
8
|
+
Themes specifically customize the appearance of the Workarea platform.
|
9
|
+
Themes allow for re-use of storefront code, helping to jump-start front-end work
|
10
|
+
for an implementation.
|
11
|
+
A theme may be used as a starting point for front-end development, or as a
|
12
|
+
complete storefront UI.
|
13
|
+
|
14
|
+
## Installing a theme in a Workarea application
|
15
|
+
|
16
|
+
Installing a theme in a Workarea application is like installing any other plugin.
|
17
|
+
Add the theme's gem to your application's gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
source 'https://gems.weblinc.com' do
|
21
|
+
gem 'workarea-your_theme_name'
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
Then run `bundle install` and restart your application.
|
26
|
+
|
27
|
+
Some themes may need extra configuration. Check the README.md for the theme you
|
28
|
+
are using to see if any further configuration is necessary.
|
29
|
+
|
30
|
+
## Configuring a theme
|
31
|
+
|
32
|
+
All themes include a `config/initializer/theme.rb` file, which provides options
|
33
|
+
for configuration within the Workarea application.
|
34
|
+
Typically themes allow configuration for color schemes and font families.
|
35
|
+
|
36
|
+
An example of a Workarea theme configuration file:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Workarea.configure do |config|
|
40
|
+
config.theme = {
|
41
|
+
color_schemes: ["one", "workarea", "midnight"],
|
42
|
+
color_scheme: "one",
|
43
|
+
font_stacks: {
|
44
|
+
roboto: '"Roboto", "HelveticaNeue", "Helvetica Neue", sans-serif',
|
45
|
+
lora: '"Lora", "Times New Roman", "Georgia", serif',
|
46
|
+
hind: '"Hind", Helvetica, Arial, sans-serif',
|
47
|
+
source_serif_pro: '"Source Serif Pro", "Times New Roman", Georgia, serif',
|
48
|
+
muli: '"Muli", Helvetica, Arial, sans-serif',
|
49
|
+
playfair_display: '"Playfair Display", "Times New Roman", Georgia, serif'
|
50
|
+
},
|
51
|
+
primary_font_family: "roboto",
|
52
|
+
secondary_font_family: "lora"
|
53
|
+
}
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
## Approaches to using a theme
|
58
|
+
|
59
|
+
There are 2 ways to use a Workarea theme.
|
60
|
+
|
61
|
+
1. Installing the theme as a gem in your application, similar to other plugins.
|
62
|
+
2. As a development tool by running the `starter_store` generator to import a
|
63
|
+
theme's files to your application.
|
64
|
+
|
65
|
+
### Gem vs. Development tool approach
|
66
|
+
|
67
|
+
Using a Workarea theme as a gem is the quickest way to apply a theme to a Workarea
|
68
|
+
application. The benefit of running a theme as a gem is getting bug-fixes and upgrades
|
69
|
+
from the theme in patch releases.
|
70
|
+
|
71
|
+
Using a theme as a development tool is an alternative way to use a Workarea theme.
|
72
|
+
Rather than running the theme as a plugin; all of the theme's files, dependencies,
|
73
|
+
and configurations are copied in to your application. This is done by running the
|
74
|
+
`starter_store` generator from your host application. This approach allows greater
|
75
|
+
flexibility in development, however it removes you from the direct upgrade path
|
76
|
+
for the theme. This means you will need to use the Workarea upgrade tool to apply
|
77
|
+
patches and upgrades as they are released for the theme.
|
78
|
+
|
79
|
+
The development tool approach is most useful if:
|
80
|
+
|
81
|
+
- You plan to customize the application heavily using the theme as a starting point.
|
82
|
+
- You need to remove a dependency of the theme.
|
83
|
+
- For example a theme may depend on workarea-reviews, but your implementation uses
|
84
|
+
a 3rd party review system. The only way to use a theme and remove one of its
|
85
|
+
dependencies is by installing the theme using the `starter_store` generator.
|
86
|
+
|
87
|
+
### Using a theme as a development tool
|
88
|
+
|
89
|
+
To prepare for installing a theme as a starter store you must add the theme to
|
90
|
+
your application gemfile and run `db:seed`. Once you have the theme running in your
|
91
|
+
application run the `starter_store` generator
|
92
|
+
|
93
|
+
```bash
|
94
|
+
bundle exec rails g workarea:starter_store
|
95
|
+
```
|
96
|
+
|
97
|
+
During the execution of this generator you will be prompted to make decisions
|
98
|
+
re. overriding existing files in your application. Use the Ynaqdh interface
|
99
|
+
to make decisions on a per-file basis. I have found that 'n' is typically the
|
100
|
+
preferable choice, with the exception of locales/en.yml
|
101
|
+
|
102
|
+
After the generator is run you should:
|
103
|
+
|
104
|
+
1. Run bundle install.
|
105
|
+
2. Confirm that your application is running and is styled as expected.
|
106
|
+
3. Remove the now commented-out theme from your gemfile.
|
107
|
+
4. Run the full test suite and ensure nothing is failing.
|
108
|
+
5. Commit your changes and open a pull-request.
|
109
|
+
|
110
|
+
#### Appended files
|
111
|
+
|
112
|
+
Appends, and append removals will still be handled via the imported appends.rb
|
113
|
+
initializer. It is recommended that you review the contents of this file and
|
114
|
+
update your host application where appropriate to include these appended files
|
115
|
+
as normal, removing them from appends.rb. This is especially advisable for Sass
|
116
|
+
and JS assets which can easily be added to your application manifests.
|
117
|
+
|
118
|
+
## Upgrading a themed application
|
119
|
+
|
120
|
+
If you have installed your theme using the `starter_store` generator the upgrade
|
121
|
+
path is the same as any other application. Be sure to use the [Workarea upgrade tool](https://stash.tools.weblinc.com/projects/WL/repos/workarea-upgrade/browse) when
|
122
|
+
upgrading your application
|
123
|
+
|
124
|
+
If your application is using a theme as a plugin you should follow these steps:
|
125
|
+
|
126
|
+
1. Check whether your theme has already been upgraded for compatibility with the
|
127
|
+
version of Workarea you are upgrading to.
|
128
|
+
- If the theme is not yet upgraded contact the theme developer and find out
|
129
|
+
when that will be complete. It is not recommended to upgrade your application
|
130
|
+
until the theme is ready.
|
131
|
+
2. Upgrade Workarea and all other plugins first, use the Workarea upgrade tool to
|
132
|
+
create a diff and make the necessary changes in your application.
|
133
|
+
3. Update the theme's version in your gemfile to use the latest version that is
|
134
|
+
compatible with your new Workarea version.
|
135
|
+
4. Run the upgrade tool against your theme to see if there are further changes
|
136
|
+
that need to be made to files that have been overridden in your application.
|
137
|
+
|
138
|
+
Once all necessary changes highlighted in the diff have been made, tests are
|
139
|
+
passing, and your PR has been accepted, your application is upgraded and should
|
140
|
+
be sent to QA for testing. Drink a beer, you've earned it!
|
141
|
+
|
142
|
+
## Multisite support for themes
|
143
|
+
|
144
|
+
Multisite applications are able to use Workarea themes without many changes to
|
145
|
+
the normal multi-site development workflow.
|
146
|
+
|
147
|
+
Configuration options set in theme.rb should be applied to each instance of
|
148
|
+
Workarea::Site, this allows you to easily apply different color schemes and fonts
|
149
|
+
to each site with minimal effort. Skinning a new site for a themed multi-site app
|
150
|
+
should be relatively simple!
|
151
|
+
|
152
|
+
It is not possible to use more than 1 theme per application. This means you cannot
|
153
|
+
use different themes for different sites within a multi-site application. All sites
|
154
|
+
must be based on the same theme, but each can customize away from the theme as necessary.
|
155
|
+
Follow the [instructions for working with multi-site applications](https://stash.tools.weblinc.com/projects/WL/repos/workarea-multi-site/browse)
|
156
|
+
for more information about developing multi-site applications.
|
157
|
+
|
158
|
+
## Developing a new Workarea Theme
|
159
|
+
|
160
|
+
To create a Workarea theme use the _rails plugin new_ command with the Workarea
|
161
|
+
theme template. Follow the instructions for using the [app template](https://developer.workarea.com/workarea-3/guides/app-template),
|
162
|
+
with the following changes.
|
163
|
+
|
164
|
+
- Use _rails plugin new_ instead of _rails new_
|
165
|
+
- Use the path to _theme\_template.rb_ (instead of _app\_template.rb_) as the
|
166
|
+
argument to the _--template_ option
|
167
|
+
- Include the _--full_ option when running _rails plugin new_
|
168
|
+
|
169
|
+
After creating the theme, edit the gemspec file to set relevant metadata.
|
170
|
+
|
171
|
+
Alternatively you may use the Workarea CLI to run the new theme generator, if you
|
172
|
+
have the CLI tool installed you can run
|
173
|
+
|
174
|
+
```bash
|
175
|
+
workarea new theme path/to/my_theme
|
176
|
+
```
|
177
|
+
|
178
|
+
### Theme development workflow
|
179
|
+
|
180
|
+
Once you've created your theme engine and edited the gemspec you can start
|
181
|
+
developing your theme. Theme development relies heavily on overriding views,
|
182
|
+
stylesheets, and javascripts from Workarea Storefront. To jump-start your theme
|
183
|
+
development run the theme override generator to override all of the files you're
|
184
|
+
likely to need in your theme.
|
185
|
+
|
186
|
+
To use the theme override generator run
|
187
|
+
|
188
|
+
```bash
|
189
|
+
bin/rails generate workarea:theme_override
|
190
|
+
```
|
191
|
+
|
192
|
+
This will override every view file, along with most Sass and JS files from
|
193
|
+
workarea-storefront. The generator also commits these overrides and stores the
|
194
|
+
commit SHA in `lib/workarea/theme/override_commit`. This file is used by the
|
195
|
+
Workarea `theme_cleanup` rake task and should not be deleted.
|
196
|
+
|
197
|
+
Having overridden most of the files you will need to develop your theme, you are
|
198
|
+
now ready to start implementing your designs. Should you need to override other
|
199
|
+
files from Storefront, or another plugin, you should use the [Workarea override
|
200
|
+
generator](https://developer.workarea.com/workarea-3/guides/overriding).
|
201
|
+
|
202
|
+
Once you have implemented your theme you should run the Workarea `theme_cleanup` rake
|
203
|
+
task. This will remove any files in `/app` that have not changed since you ran the
|
204
|
+
theme_override generator. To execute `theme_cleanup` run:
|
205
|
+
|
206
|
+
```bash
|
207
|
+
bin/rails workarea:theme_cleanup
|
208
|
+
```
|
209
|
+
|
210
|
+
Be sure to check the files that have been removed, and test that your theme runs
|
211
|
+
and looks correct before committing this change.
|
212
|
+
|
213
|
+
Once your theme is cleaned up you're done, congratulations! Now head over to the
|
214
|
+
[Workarea plugin documentation](https://developer.workarea.com/workarea-3/guides/plugins-overview)
|
215
|
+
to learn how to release your theme for use!
|
216
|
+
|
217
|
+
### Theme requirements
|
218
|
+
|
219
|
+
In order for your theme to be registered correctly within the host application it
|
220
|
+
must depend on workarea-theme and have the following include in your plugin's
|
221
|
+
engine.rb file:
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
include Workarea::Theme
|
225
|
+
```
|
226
|
+
|
227
|
+
This is necessary for the `starter_store` generator to work.
|
228
|
+
|
229
|
+
In addition your theme must:
|
230
|
+
|
231
|
+
- Include a theme.rb initializer.
|
232
|
+
- Allow the host application to configure the color scheme.
|
233
|
+
- Allow the host application to configure fonts.
|
234
|
+
|
235
|
+
The theme_template will take care of setting these things up for you, be sure to
|
236
|
+
follow the instructions for creating a new Workarea theme to ensure your theme is
|
237
|
+
configured properly.
|
238
|
+
|
239
|
+
It is recommended that your theme's README include the following information:
|
240
|
+
|
241
|
+
- Optimal image sizes.
|
242
|
+
- Compatible Workarea plugins and dependencies.
|
243
|
+
- Browser support, preferably supplemented with a browserlist file in the theme's
|
244
|
+
root directory.
|
245
|
+
- Instructions for any additional configuration or features specific to your theme.
|
246
|
+
|
247
|
+
### Theme plugin dependencies
|
248
|
+
|
249
|
+
Your theme may include dependencies on other Workarea plugins. This allows you to
|
250
|
+
ship a theme with support for popular functionality out of the box, and to benefit
|
251
|
+
from pluginized UI components and functionality.
|
252
|
+
|
253
|
+
To add support for another plugin, first add it to your theme's gemspec like this:
|
254
|
+
|
255
|
+
```ruby
|
256
|
+
s.add_dependency 'workarea-swatches', '1.0.0'
|
257
|
+
```
|
258
|
+
|
259
|
+
Next you will need to override the relevant files from the plugin to your theme.
|
260
|
+
You should use the [workarea override generator](https://developer.workarea.com/workarea-3/guides/overriding) to do this.
|
261
|
+
Once you have overridden all of the necessary files you can adjust styles, markup,
|
262
|
+
and functionality as required to meet your requirements.
|
263
|
+
|
264
|
+
_Note:_ dependencies of a theme cannot be removed when using
|
265
|
+
the theme as a gem, so it is best to keep dependencies to a minimum. The only way
|
266
|
+
to remove a theme's dependencies within a host application is to use the `starter_store`
|
267
|
+
generator, then remove the unwanted dependency from the application gemfile along
|
268
|
+
with any related app files (views, styles etc.).
|
269
|
+
|
270
|
+
### Maintaining your theme
|
271
|
+
|
272
|
+
A theme is like a baby, you spend a while making one, then you have a lifetime
|
273
|
+
of taking care of it.
|
274
|
+
|
275
|
+
Maintaining your theme means fixing bugs as they come in, and keeping your theme
|
276
|
+
up to date with the latest versions of Workarea. If your theme is not kept up to
|
277
|
+
date you will cause great pain and sadness for developers that have used your theme
|
278
|
+
in their applications. You might prevent them from being able to take upgrades.
|
279
|
+
|
280
|
+
#### Upgrading for minor-version compatibility
|
281
|
+
|
282
|
+
Upgrading your theme for compatibility with Workarea is important. At a minimum
|
283
|
+
all themes should be upgraded with the latest changes in each new minor version
|
284
|
+
of Workarea.
|
285
|
+
|
286
|
+
To upgrade your theme follow these steps:
|
287
|
+
|
288
|
+
1. Read both the release notes on developer.workarea.com and the release announcement
|
289
|
+
on discourse.
|
290
|
+
- Discourse includes release notes for plugins, ensure any plugin dependencies
|
291
|
+
are upgraded too!
|
292
|
+
2. Create a new host app to use for the upgrade.
|
293
|
+
3. Install your theme, seed the app, and make sure it’s running as expected.
|
294
|
+
4. Install the workarea-upgrade gem.
|
295
|
+
5. Use the `starter_store` generator to clone your theme in to your new host
|
296
|
+
application.
|
297
|
+
6. Run the workarea_upgrade command, first checking the report for your upgrade,
|
298
|
+
then generating a diff.
|
299
|
+
7. The upgrade report should help you estimate how much time your upgrade will take.
|
300
|
+
8. Step through your diff making all the necessary changes to your theme.
|
301
|
+
9. Load your theme and the latest version of Workarea in a different host app.
|
302
|
+
10. Ensure the app loads, resolve any errors you encounter.
|
303
|
+
11. Check every view that you changed as part of the diff.
|
304
|
+
12. If styles or JS functionality were changed or added you should ensure these
|
305
|
+
are working as intended at this point.
|
306
|
+
13. Commit your changes and open a PR.
|
307
|
+
|
308
|
+
Good work soldier! Your Workarea theme is up-to-date. Once your PR is approved,
|
309
|
+
and changes pass QA you can release your theme's new minor version to the gem server.
|
310
|
+
|
311
|
+
## Copyright & Licensing
|
312
|
+
|
313
|
+
Copyright WebLinc 2018. All rights reserved.
|
314
|
+
|
315
|
+
For licensing, contact sales@workarea.com.
|
data/Rakefile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'rdoc/task'
|
9
|
+
|
10
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
11
|
+
rdoc.rdoc_dir = 'rdoc'
|
12
|
+
rdoc.title = 'Theme'
|
13
|
+
rdoc.options << '--line-numbers'
|
14
|
+
rdoc.rdoc_files.include('README.md')
|
15
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
16
|
+
end
|
17
|
+
|
18
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
19
|
+
load 'rails/tasks/engine.rake'
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
load 'workarea/changelog.rake'
|
22
|
+
|
23
|
+
require 'rake/testtask'
|
24
|
+
|
25
|
+
Rake::TestTask.new(:test) do |t|
|
26
|
+
t.libs << 'lib'
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
task default: :test
|
32
|
+
|
33
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
34
|
+
require 'workarea/theme/version'
|
35
|
+
|
36
|
+
desc "Release version #{Workarea::Theme::VERSION} of the gem"
|
37
|
+
task :release do
|
38
|
+
host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
|
39
|
+
|
40
|
+
#Rake::Task['workarea:changelog'].execute
|
41
|
+
#system 'git add CHANGELOG.md'
|
42
|
+
#system 'git commit -m "Update CHANGELOG"'
|
43
|
+
#system 'git push origin HEAD'
|
44
|
+
|
45
|
+
system "git tag -a v#{Workarea::Theme::VERSION} -m 'Tagging #{Workarea::Theme::VERSION}'"
|
46
|
+
system 'git push --tags'
|
47
|
+
|
48
|
+
system 'gem build workarea-theme.gemspec'
|
49
|
+
system "gem push workarea-theme-#{Workarea::Theme::VERSION}.gem"
|
50
|
+
system "gem push workarea-theme-#{Workarea::Theme::VERSION}.gem --host #{host}"
|
51
|
+
system "rm workarea-theme-#{Workarea::Theme::VERSION}.gem"
|
52
|
+
end
|
53
|
+
|
54
|
+
desc 'Run the JavaScript tests'
|
55
|
+
ENV['TEASPOON_RAILS_ENV'] = File.expand_path('test/dummy/config/environment', __dir__)
|
56
|
+
task teaspoon: 'app:teaspoon'
|
57
|
+
|
58
|
+
desc 'Start a server at http://localhost:3000/teaspoon for JavaScript tests'
|
59
|
+
task :teaspoon_server do
|
60
|
+
Dir.chdir('test/dummy')
|
61
|
+
teaspoon_env = File.expand_path('test/teaspoon_env.rb', __dir__)
|
62
|
+
system "RAILS_ENV=test TEASPOON_ENV=#{teaspoon_env} rails s"
|
63
|
+
end
|