archangel 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +7 -15
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -5
- data/.gitignore +1 -0
- data/.hound.yml +2 -2
- data/.jshintignore +5 -0
- data/.jshintrc +28 -0
- data/.nvmrc +1 -0
- data/CONTRIBUTING.md +13 -114
- data/Gemfile +3 -3
- data/README.md +12 -37
- data/Rakefile +11 -0
- data/app/controllers/archangel/application_controller.rb +1 -2
- data/archangel.gemspec +3 -1
- data/bin/archangel +15 -0
- data/docs/Developers.md +122 -1
- data/docs/Extension/Controllers.md +139 -0
- data/docs/Extension/Developers.md +27 -0
- data/docs/Extension/Helpers.md +17 -0
- data/docs/Extension/Ideas.md +131 -0
- data/docs/Extension/Models.md +32 -0
- data/docs/Extension/Policies.md +42 -0
- data/docs/Extension/Routes.md +26 -0
- data/docs/Extension/Uploaders.md +3 -0
- data/docs/Extension/Views.md +3 -0
- data/docs/Release.md +9 -3
- data/docs/Theme/Developers.md +7 -0
- data/lib/archangel/command/extension.rb +97 -0
- data/lib/archangel/command/templates/extension/.editorconfig +19 -0
- data/lib/archangel/command/templates/extension/.gitignore +11 -0
- data/lib/archangel/command/templates/extension/.rspec +2 -0
- data/lib/archangel/command/templates/extension/.rubocop.yml +32 -0
- data/lib/archangel/command/templates/extension/Gemfile +29 -0
- data/lib/archangel/command/templates/extension/MIT-LICENSE +21 -0
- data/lib/archangel/command/templates/extension/README.md +79 -0
- data/lib/archangel/command/templates/extension/Rakefile +25 -0
- data/lib/archangel/command/templates/extension/app/assets/javascripts/archangel/auth/%extension_name%.js.tt +3 -0
- data/lib/archangel/command/templates/extension/app/assets/javascripts/archangel/backend/%extension_name%.js.tt +3 -0
- data/lib/archangel/command/templates/extension/app/assets/javascripts/archangel/frontend/%extension_name%.js.tt +3 -0
- data/lib/archangel/command/templates/extension/app/assets/stylesheets/archangel/auth/%extension_name%.css.tt +5 -0
- data/lib/archangel/command/templates/extension/app/assets/stylesheets/archangel/backend/%extension_name%.css.tt +5 -0
- data/lib/archangel/command/templates/extension/app/assets/stylesheets/archangel/frontend/%extension_name%.css.tt +5 -0
- data/lib/archangel/command/templates/extension/bin/rails.tt +11 -0
- data/lib/archangel/command/templates/extension/config/locales/en.yml.tt +4 -0
- data/lib/archangel/command/templates/extension/config/routes.rb +5 -0
- data/lib/archangel/command/templates/extension/extension.gemspec +25 -0
- data/lib/archangel/command/templates/extension/lib/%extension_name%/engine.rb.tt +29 -0
- data/lib/archangel/command/templates/extension/lib/%extension_name%/factories.rb.tt +13 -0
- data/lib/archangel/command/templates/extension/lib/%extension_name%/version.rb.tt +5 -0
- data/lib/archangel/command/templates/extension/lib/%extension_name%.rb.tt +9 -0
- data/lib/archangel/command/templates/extension/lib/generators/%extension_name%/install/install_generator.rb.tt +42 -0
- data/lib/archangel/command/templates/extension/spec/rails_helper.rb.tt +41 -0
- data/lib/archangel/command/templates/extension/spec/spec_helper.rb +22 -0
- data/lib/archangel/command/templates/extension/spec/support/.keep +0 -0
- data/lib/archangel/liquid/drop.rb +21 -11
- data/lib/archangel/liquid_view.rb +7 -31
- data/lib/archangel/version.rb +1 -1
- data/lib/generators/archangel/dummy/dummy_generator.rb +1 -0
- data/package.json +8 -3
- data/spec/lib/archangel/command/extension_spec.rb +100 -0
- data/spec/lib/archangel/liquid/drop_spec.rb +10 -0
- data/spec/lib/archangel/liquid/drops/page_drop_spec.rb +77 -0
- data/spec/lib/archangel/liquid/drops/site_drop_spec.rb +78 -0
- data/spec/lib/archangel/liquid/filters/link_to_filter_spec.rb +0 -4
- data/spec/lib/archangel/liquid/tags/collection_tag_spec.rb +0 -1
- data/spec/lib/archangel/liquid/tags/collectionfor_tag_spec.rb +0 -1
- data/spec/lib/archangel/liquid/tags/theme_javascript_tag_spec.rb +4 -3
- data/spec/lib/archangel/liquid/tags/theme_stylesheet_tag_spec.rb +4 -3
- metadata +64 -6
- data/docs/ExtensionDevelopers.md +0 -3
- data/docs/ExtensionIdeas.md +0 -132
- data/docs/ThemeDevelopers.md +0 -3
@@ -0,0 +1,27 @@
|
|
1
|
+
# Extension Developers
|
2
|
+
|
3
|
+
Extensions are meant to extend the functionality of Archangel. Documentation for theme development is [also available](https://github.com/archangel/archangel/blob/master/docs/Theme/Developers.md).
|
4
|
+
|
5
|
+
Feeling bored? Looking for ideas? Take a look at possible [ideas for extensions](https://github.com/archangel/archangel/blob/master/docs/Extension/Ideas.md).
|
6
|
+
|
7
|
+
## Generate an extension
|
8
|
+
|
9
|
+
Generate an Archangel extension with `archangel extension NAME`
|
10
|
+
|
11
|
+
To generate an extension at `PWD` with the name `archangel_foo`
|
12
|
+
|
13
|
+
```
|
14
|
+
$ archangel extension foo
|
15
|
+
```
|
16
|
+
|
17
|
+
## Best Practices
|
18
|
+
|
19
|
+
The following are best practice guides for building and managing Archangel extensions.
|
20
|
+
|
21
|
+
* [Controllers](https://github.com/archangel/archangel/blob/master/docs/Extension/Controllers.md)
|
22
|
+
* [Helpers](https://github.com/archangel/archangel/blob/master/docs/Extension/Helpers.md)
|
23
|
+
* [Models](https://github.com/archangel/archangel/blob/master/docs/Extension/Models.md)
|
24
|
+
* [Policies](https://github.com/archangel/archangel/blob/master/docs/Extension/Policies.md)
|
25
|
+
* [Routes](https://github.com/archangel/archangel/blob/master/docs/Extension/Routes.md)
|
26
|
+
* [Views](https://github.com/archangel/archangel/blob/master/docs/Extension/Views.md)
|
27
|
+
* [Uploaders](https://github.com/archangel/archangel/blob/master/docs/Extension/Uploaders.md)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Helpers
|
2
|
+
|
3
|
+
Helpers are separated by `frontend`, `backend` or `auth` namespaces. Each section should be separated for functional clarity.
|
4
|
+
|
5
|
+
## Backend Helpers
|
6
|
+
|
7
|
+
For Backend helpers, create your helper at `app/helpers/archangel/backend/foos_helper.rb` add the following
|
8
|
+
|
9
|
+
```
|
10
|
+
module Archangel
|
11
|
+
module Backend
|
12
|
+
module FoosHelper
|
13
|
+
...
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
```
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# Extension Ideas
|
2
|
+
|
3
|
+
Feeling bored? Looking for ideas?
|
4
|
+
|
5
|
+
_ \* In no particular order_
|
6
|
+
|
7
|
+
* Preview
|
8
|
+
* Page preview
|
9
|
+
* Angular
|
10
|
+
* Helper extension to include for themes built with Angular
|
11
|
+
* React
|
12
|
+
* Helper extension to include for themes built with React
|
13
|
+
* Vue
|
14
|
+
* Helper extension to include for themes built with Vue
|
15
|
+
* Aurelia
|
16
|
+
* Helper extension to include for themes built with Aurelia
|
17
|
+
* Search
|
18
|
+
* Elasticsearch
|
19
|
+
* Ransack
|
20
|
+
* Comments
|
21
|
+
* Facebook
|
22
|
+
* Disqus
|
23
|
+
* Database
|
24
|
+
* Auto approve
|
25
|
+
* Manual approve
|
26
|
+
* Migrate
|
27
|
+
* Export for Wordpress
|
28
|
+
* Export for Refinary
|
29
|
+
* Import from Wordpress
|
30
|
+
* Import from Refinary
|
31
|
+
* Forms
|
32
|
+
* WYSIWYG for custom form builder
|
33
|
+
* Honeypot
|
34
|
+
* Time
|
35
|
+
* Captcha
|
36
|
+
* Multi-tenant
|
37
|
+
* Types
|
38
|
+
* Domain
|
39
|
+
* Subdomain
|
40
|
+
* Schema switching
|
41
|
+
* Manage domains
|
42
|
+
* CLI to create schemas
|
43
|
+
* Background worker to create schemas
|
44
|
+
* Notifications
|
45
|
+
* json_ld
|
46
|
+
* API
|
47
|
+
* CORS
|
48
|
+
* Rate limits
|
49
|
+
* GraphQL
|
50
|
+
* Social Like
|
51
|
+
* Types
|
52
|
+
* Facebook
|
53
|
+
* Database
|
54
|
+
* Toggle enabled/disabled by default
|
55
|
+
* Toggle enabled/disabled per page
|
56
|
+
* Social Share
|
57
|
+
* Toggle enabled/disabled by default
|
58
|
+
* Toggle enabled/disabled per page
|
59
|
+
* robots.txt
|
60
|
+
* RSS feed
|
61
|
+
* Sitemap
|
62
|
+
* Columns
|
63
|
+
* changefreq
|
64
|
+
* always
|
65
|
+
* hourly
|
66
|
+
* daily
|
67
|
+
* weekly
|
68
|
+
* monthly
|
69
|
+
* yearly
|
70
|
+
* never
|
71
|
+
* priority
|
72
|
+
* 0.0..1.0
|
73
|
+
* sitemap.xml
|
74
|
+
* sitemap.xml.gz
|
75
|
+
* Update robots.txt
|
76
|
+
* Rebuild on Page save (background worker)
|
77
|
+
* Notify search engines (background worker)
|
78
|
+
* 2FA
|
79
|
+
* Opt-in
|
80
|
+
* Force all
|
81
|
+
* Oauth
|
82
|
+
* Splash Page
|
83
|
+
* Types
|
84
|
+
* Overlay
|
85
|
+
* Redirect
|
86
|
+
* Start At
|
87
|
+
* End At
|
88
|
+
* Remember with Javascript cookie
|
89
|
+
* Cookie lifetime
|
90
|
+
* Pixel trackers
|
91
|
+
* Location
|
92
|
+
* Head
|
93
|
+
* Body (top)
|
94
|
+
* Body (bottom)
|
95
|
+
* Statistics/Analytics
|
96
|
+
* Google Analytics
|
97
|
+
* Graphs/Charts
|
98
|
+
* History/Versions
|
99
|
+
* Roll back to previous versions
|
100
|
+
* Activity
|
101
|
+
* Log activity in backend
|
102
|
+
* Icons
|
103
|
+
* favicon
|
104
|
+
* Apple
|
105
|
+
* Android
|
106
|
+
* Windows
|
107
|
+
* Stylesheet
|
108
|
+
* Site Stylesheet
|
109
|
+
* Per page Stylesheet
|
110
|
+
* Javascript
|
111
|
+
* Site Javascript
|
112
|
+
* Per page Javascript
|
113
|
+
* Community
|
114
|
+
* Allow registering
|
115
|
+
* User listing
|
116
|
+
* User profile
|
117
|
+
* User search/filter
|
118
|
+
* Friends/Followers
|
119
|
+
* Events
|
120
|
+
* Calendar
|
121
|
+
* Reoccurring events
|
122
|
+
* Reminders
|
123
|
+
* sms
|
124
|
+
* email
|
125
|
+
* Google Calendar integration
|
126
|
+
* iCloud Calendar integration
|
127
|
+
* Static
|
128
|
+
* Generate static frontend site
|
129
|
+
* Help
|
130
|
+
* Help and instructions for each section in Backend
|
131
|
+
* Monetize YouTube videos
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Models
|
2
|
+
|
3
|
+
Models are not separated by `frontend`, `backend` or `auth` and therefore do not need to be namespaced.
|
4
|
+
|
5
|
+
Create your model at `app/models/archangel/foo.rb` add the following.
|
6
|
+
|
7
|
+
```
|
8
|
+
module Archangel
|
9
|
+
class Foo < ApplicationRecord
|
10
|
+
before_validation :parameterize_slug
|
11
|
+
|
12
|
+
validates :bar, presence: true
|
13
|
+
validates :slug, presence: true, uniqueness: true
|
14
|
+
|
15
|
+
belongs_to :site
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def parameterize_slug
|
20
|
+
self.slug = slug.to_s.downcase.parameterize
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
To change the `id` for constructing a URL to this object you can override `#to_param` in your model to make `foo_path` construct a path using the record `slug` instead of the `id`. See [`#to_param`](https://apidock.com/rails/ActiveRecord/Base/to_param) for further explanation.
|
27
|
+
|
28
|
+
```
|
29
|
+
def to_param
|
30
|
+
slug
|
31
|
+
end
|
32
|
+
```
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Policies
|
2
|
+
|
3
|
+
Policies are not separated by `frontend`, `backend` or `auth` and therefore do not need to be namespaced. [Pundit](https://github.com/varvet/pundit) is used for authorization.
|
4
|
+
|
5
|
+
Create your policy at `app/policies/archangel/foo.rb` add the following.
|
6
|
+
|
7
|
+
```
|
8
|
+
module Archangel
|
9
|
+
class FooPolicy < ApplicationPolicy
|
10
|
+
end
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
14
|
+
Extending `ApplicationPolicy` will set default authorization throughout the controller. The only reason you would need anything more than this is if you require more complex authorization policies.
|
15
|
+
|
16
|
+
Custom routes that are not RESTful need to added.
|
17
|
+
|
18
|
+
```
|
19
|
+
module Archangel
|
20
|
+
class FooPolicy < ApplicationPolicy
|
21
|
+
def custom?
|
22
|
+
scope.where(id: record.id).exists?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
To specifically check if the User is an `admin`, `ApplicationPolicy` has a method to do this.
|
29
|
+
|
30
|
+
```
|
31
|
+
module Archangel
|
32
|
+
class FooPolicy < ApplicationPolicy
|
33
|
+
def destroy?
|
34
|
+
admin_user?
|
35
|
+
end
|
36
|
+
|
37
|
+
def custom?
|
38
|
+
admin_user?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Routes
|
2
|
+
|
3
|
+
Routes are separated by `frontend`, `backend` or `auth` namespaces. Each section should be separated for functional clarity.
|
4
|
+
|
5
|
+
## Backend Routes
|
6
|
+
|
7
|
+
For Backend routes, open `config/routes.rb` and add the following
|
8
|
+
|
9
|
+
```
|
10
|
+
Archangel::Engine.routes.draw do
|
11
|
+
namespace :backend, path: Archangel.config.backend_path do
|
12
|
+
# GET /backend/foos
|
13
|
+
# POST /backend/foos
|
14
|
+
# GET /backend/foos/new
|
15
|
+
# GET /backend/foos/[ID]/edit
|
16
|
+
# GET /backend/foos/[ID]
|
17
|
+
# PATCH /backend/foos/[ID]
|
18
|
+
# PUT /backend/foos/[ID]
|
19
|
+
# DELETE /backend/foos/[ID]
|
20
|
+
resources :foos do
|
21
|
+
# GET /backend/foos/custom
|
22
|
+
get :custom
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
```
|
data/docs/Release.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Releasing Gem
|
2
2
|
|
3
|
-
1.
|
3
|
+
1. Clean up generated files
|
4
|
+
|
5
|
+
```
|
6
|
+
$ bundle exec rake clean
|
7
|
+
```
|
8
|
+
|
9
|
+
2. Bump the gem version in `lib/archangel/version.rb`
|
4
10
|
|
5
11
|
Follow the rules of [Semantic Versioning](https://semver.org/). For example:
|
6
12
|
|
@@ -16,10 +22,10 @@
|
|
16
22
|
|
17
23
|
This will create a new .gem file in `pkg/`. Fix any errors or warnings that come up.
|
18
24
|
|
19
|
-
|
25
|
+
4. Create the gem, tag it in Github and release to Rubygems
|
20
26
|
|
21
27
|
```
|
22
28
|
$ bundle exec rake release
|
23
29
|
```
|
24
30
|
|
25
|
-
|
31
|
+
5. Profit!
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
module Archangel
|
6
|
+
##
|
7
|
+
# Command line
|
8
|
+
#
|
9
|
+
module Command
|
10
|
+
##
|
11
|
+
# Generate Archangel extension
|
12
|
+
#
|
13
|
+
class Extension < Thor::Group
|
14
|
+
include Thor::Actions
|
15
|
+
|
16
|
+
source_root File.expand_path("templates/extension", __dir__)
|
17
|
+
|
18
|
+
desc "Build an Archangel extension"
|
19
|
+
argument :extension_name, type: :string,
|
20
|
+
desc: "Extension name",
|
21
|
+
default: "sample"
|
22
|
+
|
23
|
+
##
|
24
|
+
# Generate extension
|
25
|
+
#
|
26
|
+
# Usage
|
27
|
+
# archangel extension [EXTENSION_NAME]
|
28
|
+
# bundle exec bin/archangel extension [EXTENSION_NAME]
|
29
|
+
#
|
30
|
+
def generate
|
31
|
+
prefix_name
|
32
|
+
|
33
|
+
empty_directory extension_name
|
34
|
+
|
35
|
+
copy_directories
|
36
|
+
copy_files
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Banner
|
41
|
+
#
|
42
|
+
# Say something nice
|
43
|
+
#
|
44
|
+
def banner
|
45
|
+
puts %(
|
46
|
+
|
47
|
+
******************************************************************
|
48
|
+
|
49
|
+
Your extension has been generated with a gemspec dependency on
|
50
|
+
Archangel v#{archangel_version}
|
51
|
+
|
52
|
+
You look lovely today by the way.
|
53
|
+
|
54
|
+
******************************************************************
|
55
|
+
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
no_tasks do
|
60
|
+
def class_name
|
61
|
+
Thor::Util.camel_case extension_name
|
62
|
+
end
|
63
|
+
|
64
|
+
def archangel_version
|
65
|
+
Archangel.version[/(.*)\./, 1]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
no_tasks do
|
70
|
+
def prefix_name
|
71
|
+
ext_name = extension_name.downcase
|
72
|
+
ext_name = "archangel_#{ext_name}" unless ext_name =~ /^archangel_/
|
73
|
+
|
74
|
+
@extension_name = Thor::Util.snake_case(ext_name)
|
75
|
+
end
|
76
|
+
|
77
|
+
def copy_directories
|
78
|
+
%w[
|
79
|
+
app bin config lib spec
|
80
|
+
].each { |dir| directory(dir, "#{extension_name}/#{dir}") }
|
81
|
+
|
82
|
+
chmod("#{extension_name}/bin/rails", 0o755)
|
83
|
+
end
|
84
|
+
|
85
|
+
def copy_files
|
86
|
+
%w[
|
87
|
+
.editorconfig .gitignore .rspec .rubocop.yml Gemfile MIT-LICENSE
|
88
|
+
Rakefile README.md
|
89
|
+
].each { |tpl| template(tpl, "#{extension_name}/#{tpl}") }
|
90
|
+
|
91
|
+
template("extension.gemspec",
|
92
|
+
"#{extension_name}/#{extension_name}.gemspec")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# EditorConfig is awesome: http://EditorConfig.org
|
2
|
+
|
3
|
+
root = true
|
4
|
+
|
5
|
+
[*]
|
6
|
+
charset = utf-8
|
7
|
+
end_of_line = lf
|
8
|
+
insert_final_newline = true
|
9
|
+
indent_style = space
|
10
|
+
indent_size = 2
|
11
|
+
|
12
|
+
[*.rb]
|
13
|
+
max_line_length = 80
|
14
|
+
|
15
|
+
[*.{css,erb,html,js,scss,ts}]
|
16
|
+
max_line_length = 120
|
17
|
+
|
18
|
+
[*.{md,json,yml}]
|
19
|
+
insert_final_newline = false
|
@@ -0,0 +1,32 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- '**/Gemfile'
|
4
|
+
- '**/Rakefile'
|
5
|
+
Exclude:
|
6
|
+
- 'bin/**/*'
|
7
|
+
- 'db/migrate/**/*'
|
8
|
+
- 'spec/dummy/**/*'
|
9
|
+
|
10
|
+
Gemspec/RequiredRubyVersion:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Metrics/BlockLength:
|
14
|
+
Exclude:
|
15
|
+
- '**/*.gemspec'
|
16
|
+
- 'spec/**/*.rb'
|
17
|
+
|
18
|
+
Metrics/ModuleLength:
|
19
|
+
Exclude:
|
20
|
+
- 'spec/**/*.rb'
|
21
|
+
|
22
|
+
Style/Documentation:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/FrozenStringLiteralComment:
|
26
|
+
EnforcedStyle: always
|
27
|
+
|
28
|
+
Style/StringLiterals:
|
29
|
+
EnforcedStyle: double_quotes
|
30
|
+
|
31
|
+
Style/StringLiteralsInInterpolation:
|
32
|
+
EnforcedStyle: double_quotes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "rubocop", "~> 0.52", require: false
|
9
|
+
end
|
10
|
+
|
11
|
+
group :development, :test do
|
12
|
+
gem "pry-byebug", "~> 3.5"
|
13
|
+
gem "sqlite3", ">= 1.3", platforms: %i[ruby mswin mswin64 mingw x64_mingw]
|
14
|
+
gem "thor", "~> 0.19"
|
15
|
+
end
|
16
|
+
|
17
|
+
group :test do
|
18
|
+
gem "capybara", "~> 2.17"
|
19
|
+
gem "coveralls", "~> 0.8"
|
20
|
+
gem "database_cleaner", "~> 1.6"
|
21
|
+
gem "factory_bot_rails", "~> 4.8"
|
22
|
+
gem "launchy", "~> 2.4"
|
23
|
+
gem "poltergeist", "~> 1.17"
|
24
|
+
gem "rails-controller-testing", "~> 1.0"
|
25
|
+
gem "rspec-rails", "~> 3.7"
|
26
|
+
gem "shoulda-callback-matchers", "~> 1.1"
|
27
|
+
gem "shoulda-matchers", "~> 3.1"
|
28
|
+
gem "simplecov", "~> 0.14"
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) <%= Time.now.year %> YOUR NAME
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# <%= class_name %>
|
2
|
+
|
3
|
+
Introduction goes here.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add to your application's Gemfile
|
8
|
+
|
9
|
+
```
|
10
|
+
gem "<%= extension_name %>", github: "USERNAME/<%= extension_name %>"
|
11
|
+
```
|
12
|
+
|
13
|
+
Run the bundle command
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Run the install generator
|
20
|
+
|
21
|
+
```
|
22
|
+
$ bundle exec rails g <%= extension_name %>:install
|
23
|
+
```
|
24
|
+
|
25
|
+
If your server was running, restart it to find the assets properly.
|
26
|
+
|
27
|
+
## Updating
|
28
|
+
|
29
|
+
Subsequent updates can be done by bumping the version in your Gemfile then adding the new migrations
|
30
|
+
|
31
|
+
```
|
32
|
+
$ bundle exec rails <%= extension_name %>:install:migrations
|
33
|
+
```
|
34
|
+
|
35
|
+
Run migrations
|
36
|
+
|
37
|
+
```
|
38
|
+
$ bundle exec rails db:migrate
|
39
|
+
```
|
40
|
+
|
41
|
+
## Testing
|
42
|
+
|
43
|
+
First, generate a dummy application. You will be required to generate a dummy application before running tests.
|
44
|
+
|
45
|
+
```
|
46
|
+
$ bundle exec rake dummy_app
|
47
|
+
```
|
48
|
+
|
49
|
+
Run tests
|
50
|
+
|
51
|
+
```
|
52
|
+
$ bundle exec rake
|
53
|
+
```
|
54
|
+
|
55
|
+
or
|
56
|
+
|
57
|
+
```
|
58
|
+
$ bundle exec rake spec
|
59
|
+
```
|
60
|
+
|
61
|
+
or
|
62
|
+
|
63
|
+
```
|
64
|
+
$ bundle exec rspec spec
|
65
|
+
```
|
66
|
+
|
67
|
+
When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:
|
68
|
+
|
69
|
+
```
|
70
|
+
require "<%= extension_name %>/factories"
|
71
|
+
```
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
1. Fork it ( https://github.com/USERNAME/<%= extension_name %>/fork )
|
76
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
77
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
78
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
79
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/setup"
|
5
|
+
rescue LoadError
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
7
|
+
end
|
8
|
+
|
9
|
+
Bundler::GemHelper.install_tasks
|
10
|
+
|
11
|
+
require "bundler/gem_tasks"
|
12
|
+
require "rspec/core/rake_task"
|
13
|
+
|
14
|
+
require "archangel/testing_support/rake/dummy_rake"
|
15
|
+
|
16
|
+
RSpec::Core::RakeTask.new
|
17
|
+
|
18
|
+
task default: :spec
|
19
|
+
|
20
|
+
desc "Generates a dummy app for testing"
|
21
|
+
task :dummy_app do
|
22
|
+
ENV["LIB_NAME"] = "<%= extension_name %>"
|
23
|
+
|
24
|
+
Rake::Task["dummy:generate"].invoke
|
25
|
+
end
|