archangel 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +7 -15
  3. data/.github/PULL_REQUEST_TEMPLATE.md +0 -5
  4. data/.gitignore +1 -0
  5. data/.hound.yml +2 -2
  6. data/.jshintignore +5 -0
  7. data/.jshintrc +28 -0
  8. data/.nvmrc +1 -0
  9. data/CONTRIBUTING.md +13 -114
  10. data/Gemfile +3 -3
  11. data/README.md +12 -37
  12. data/Rakefile +11 -0
  13. data/app/controllers/archangel/application_controller.rb +1 -2
  14. data/archangel.gemspec +3 -1
  15. data/bin/archangel +15 -0
  16. data/docs/Developers.md +122 -1
  17. data/docs/Extension/Controllers.md +139 -0
  18. data/docs/Extension/Developers.md +27 -0
  19. data/docs/Extension/Helpers.md +17 -0
  20. data/docs/Extension/Ideas.md +131 -0
  21. data/docs/Extension/Models.md +32 -0
  22. data/docs/Extension/Policies.md +42 -0
  23. data/docs/Extension/Routes.md +26 -0
  24. data/docs/Extension/Uploaders.md +3 -0
  25. data/docs/Extension/Views.md +3 -0
  26. data/docs/Release.md +9 -3
  27. data/docs/Theme/Developers.md +7 -0
  28. data/lib/archangel/command/extension.rb +97 -0
  29. data/lib/archangel/command/templates/extension/.editorconfig +19 -0
  30. data/lib/archangel/command/templates/extension/.gitignore +11 -0
  31. data/lib/archangel/command/templates/extension/.rspec +2 -0
  32. data/lib/archangel/command/templates/extension/.rubocop.yml +32 -0
  33. data/lib/archangel/command/templates/extension/Gemfile +29 -0
  34. data/lib/archangel/command/templates/extension/MIT-LICENSE +21 -0
  35. data/lib/archangel/command/templates/extension/README.md +79 -0
  36. data/lib/archangel/command/templates/extension/Rakefile +25 -0
  37. data/lib/archangel/command/templates/extension/app/assets/javascripts/archangel/auth/%extension_name%.js.tt +3 -0
  38. data/lib/archangel/command/templates/extension/app/assets/javascripts/archangel/backend/%extension_name%.js.tt +3 -0
  39. data/lib/archangel/command/templates/extension/app/assets/javascripts/archangel/frontend/%extension_name%.js.tt +3 -0
  40. data/lib/archangel/command/templates/extension/app/assets/stylesheets/archangel/auth/%extension_name%.css.tt +5 -0
  41. data/lib/archangel/command/templates/extension/app/assets/stylesheets/archangel/backend/%extension_name%.css.tt +5 -0
  42. data/lib/archangel/command/templates/extension/app/assets/stylesheets/archangel/frontend/%extension_name%.css.tt +5 -0
  43. data/lib/archangel/command/templates/extension/bin/rails.tt +11 -0
  44. data/lib/archangel/command/templates/extension/config/locales/en.yml.tt +4 -0
  45. data/lib/archangel/command/templates/extension/config/routes.rb +5 -0
  46. data/lib/archangel/command/templates/extension/extension.gemspec +25 -0
  47. data/lib/archangel/command/templates/extension/lib/%extension_name%/engine.rb.tt +29 -0
  48. data/lib/archangel/command/templates/extension/lib/%extension_name%/factories.rb.tt +13 -0
  49. data/lib/archangel/command/templates/extension/lib/%extension_name%/version.rb.tt +5 -0
  50. data/lib/archangel/command/templates/extension/lib/%extension_name%.rb.tt +9 -0
  51. data/lib/archangel/command/templates/extension/lib/generators/%extension_name%/install/install_generator.rb.tt +42 -0
  52. data/lib/archangel/command/templates/extension/spec/rails_helper.rb.tt +41 -0
  53. data/lib/archangel/command/templates/extension/spec/spec_helper.rb +22 -0
  54. data/lib/archangel/command/templates/extension/spec/support/.keep +0 -0
  55. data/lib/archangel/liquid/drop.rb +21 -11
  56. data/lib/archangel/liquid_view.rb +7 -31
  57. data/lib/archangel/version.rb +1 -1
  58. data/lib/generators/archangel/dummy/dummy_generator.rb +1 -0
  59. data/package.json +8 -3
  60. data/spec/lib/archangel/command/extension_spec.rb +100 -0
  61. data/spec/lib/archangel/liquid/drop_spec.rb +10 -0
  62. data/spec/lib/archangel/liquid/drops/page_drop_spec.rb +77 -0
  63. data/spec/lib/archangel/liquid/drops/site_drop_spec.rb +78 -0
  64. data/spec/lib/archangel/liquid/filters/link_to_filter_spec.rb +0 -4
  65. data/spec/lib/archangel/liquid/tags/collection_tag_spec.rb +0 -1
  66. data/spec/lib/archangel/liquid/tags/collectionfor_tag_spec.rb +0 -1
  67. data/spec/lib/archangel/liquid/tags/theme_javascript_tag_spec.rb +4 -3
  68. data/spec/lib/archangel/liquid/tags/theme_stylesheet_tag_spec.rb +4 -3
  69. metadata +64 -6
  70. data/docs/ExtensionDevelopers.md +0 -3
  71. data/docs/ExtensionIdeas.md +0 -132
  72. data/docs/ThemeDevelopers.md +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e58c0764542b5ba954a4a76a78cf5ba377c33e91a5baf3e76428b1c02dce7d4
4
- data.tar.gz: b7ebd658a326d420160b61cf183227d147fc2ebcb2714a53ae052afe07ed0b7a
3
+ metadata.gz: 68e5d684902d60ef8038ad7742db68f526aad40eb98a774efbd99c36e2ebc39d
4
+ data.tar.gz: a2ea939de0bb71993fac52d5ad02a793a34196b92512f9f5e6124e0c37c38f7c
5
5
  SHA512:
6
- metadata.gz: c3f4cf33c322c9a508a2eed8b933da2f31c79c087c67f5bfc167980b63bc42d37c5b7c5df54149562810dc0d39854490a6192ad81aba6be89b856d72f50860a3
7
- data.tar.gz: e71e3176820ccacea49121788aefb5b3125d01d250a877f86bda917c39d8770411f591620b33b78241d1518c102894821a9d8899d31c8188fecddf5852345dc8
6
+ metadata.gz: acb8fef35d67234c3594efc0f529d1c6a3058cb3ad752b85d36d0b8b4c543734860ba28b5d58f2221981e6094a4a0e269ce4b0fcd22f0b215e35282b88167a8f
7
+ data.tar.gz: 8265bb0b3f2141364c1abb2b00408553c744c633e2e1182a9dfa5f6ad2cea7ee297738f47007d640ffe01cc1eef98b42834c096f7b5ce4a46c39fd7a2e68c670
@@ -1,23 +1,15 @@
1
1
  # Summary
2
2
 
3
- A few sentences describing the issue.
4
-
5
- Expected behavior...
6
-
7
- Actual behavior...
8
-
9
- Possible fix...
10
-
11
- Stacktrace...
3
+ A few sentences describing the issue; including expected behavior, actual behavior, possible fix or stacktrace.
12
4
 
13
5
  ## Steps to Reproduce
14
6
 
15
- 1.
16
- 2.
17
- 3.
7
+ 1. Do this...
8
+ 2. Do that...
9
+ 3. ...
18
10
 
19
11
  ## Your Environment
20
12
 
21
- * Ruby Version:
22
- * Gem Version:
23
- * OS and Version:
13
+ * Ruby Version: 2.5
14
+ * Rails Version: 5
15
+ * Archangel Version: < 1
@@ -11,8 +11,3 @@ A few sentences describing the changes and overall goal(s) of the pull request.
11
11
 
12
12
  * Feature or item being removed or modified
13
13
  * ...
14
-
15
- ## Migrations
16
-
17
- * [ ] Yes
18
- * [X] No
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  .DS_Store
3
3
  .Trashes
4
4
  .yardoc/
5
+ archangel_*/
5
6
  brakeman.html
6
7
  coverage/
7
8
  Desktop.ini
data/.hound.yml CHANGED
@@ -10,8 +10,8 @@ jshint:
10
10
  config_file: .jshintrc
11
11
  ignore_file: .jshintignore
12
12
 
13
- # # https://github.com/bbatsov/rubocop
14
- ruby:
13
+ # https://github.com/bbatsov/rubocop
14
+ rubocop:
15
15
  enabled: true
16
16
  config_file: .rubocop.yml
17
17
 
data/.jshintignore ADDED
@@ -0,0 +1,5 @@
1
+ coverage/
2
+ doc/
3
+ node_modules/
4
+ spec/
5
+ vendor/
data/.jshintrc ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "globals": {
3
+ "$": true,
4
+ "Archangel": true,
5
+ "document": true,
6
+ "jQuery": true,
7
+ "localStorage": true,
8
+ "Sortable": true,
9
+ "window": true,
10
+ "XMLHttpRequest": true
11
+ },
12
+ "boss": true,
13
+ "curly": true,
14
+ "debug": false,
15
+ "devel": false,
16
+ "eqeqeq": true,
17
+ "esversion": 6,
18
+ "evil": false,
19
+ "jquery": true,
20
+ "lastsemic": true,
21
+ "newcap": false,
22
+ "node": true,
23
+ "onecase": true,
24
+ "quotmark": "single",
25
+ "strict": true,
26
+ "undef": true,
27
+ "unused": true
28
+ }
data/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 8.11.1
data/CONTRIBUTING.md CHANGED
@@ -9,16 +9,13 @@ The following is a set of guidelines for contributing to Archangel and its manag
9
9
  * [Code of Conduct](#code-of-conduct)
10
10
  * [How To Contribute](#how-to-contribute)
11
11
  * [Issues](#issues)
12
- * [Pull Requests](#pull-requests)
13
- * [Testing](#code)
14
- * [Code Analysis](#code)
15
12
  * [Security and Maintenance](#security-and-maintenance)
16
- * [Documentation](#code)
13
+ * [Developers](#developers)
14
+ * [Pull Requests](#pull-requests)
17
15
 
18
16
  ## Code of Conduct
19
17
 
20
- This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to
21
- uphold this code. Please report unacceptable behavior to [archangel.cms@gmail.com](mailto:archangel.cms@gmail.com).
18
+ This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [archangel.cms@gmail.com](mailto:archangel.cms@gmail.com).
22
19
 
23
20
  ## How To Contribute
24
21
 
@@ -33,118 +30,20 @@ Help is always appreciated. If you are not able to contribute with code, bug rep
33
30
 
34
31
  Archangel uses [Github Issues](https://github.com/archangel/archangel/issues) to manage issues. A [number of labels](https://github.com/archangel/archangel/labels) are used to control flow and function. Enhancements and feature requests can also be submitted. Extension ideas are also accepted.
35
32
 
36
- ## Pull Requests
37
-
38
- We gladly accept pull requests to Archangel.
39
-
40
- 1. Fork the repo ([https://github.com/archangel/archangel/fork](https://github.com/archangel/archangel/fork))
41
- 2. Clone the fork to your local machine
42
- 3. Run `bundle install` inside `archangel` directory
43
- 4. Make your updates or improvements
44
- 5. Commit your changes (`git commit -am 'Did some good things'`)
45
- 6. Push to your fork (`git push`)
46
- 7. Create a new Pull Request
47
-
48
- ## Testing
49
-
50
- Tests are always necessary. If you find yourself thinking, "Do I need to write tests for this?," the answer is yes. [Travis CI](https://travis-ci.org/) is used for running tests. To get the best possible overview of issues with different Ruby versions, Archangel is tested with multiple various of Ruby. See [`.travis.yml`](.travis.yml) for the versions of Ruby tested.
51
-
52
- Generate a dummy application. You will be required to generate a dummy application before running tests.
53
-
54
- ```
55
- $ bundle exec rake dummy_app
56
- ```
57
-
58
- Run tests
59
-
60
- ```
61
- $ bundle exec rake
62
- ```
63
-
64
- or
65
-
66
- ```
67
- $ bundle exec rake spec
68
- ```
69
-
70
- or
71
-
72
- ```
73
- $ bundle exec rspec spec
74
- ```
75
-
76
- You can also enable fail fast in order to stop tests at the first failure
77
-
78
- ```
79
- $ bundle exec rspec spec --fail-fast
80
- ```
81
-
82
- ## Code Analysis
83
-
84
- Various tools are used to make sure code is linted and formatted correctly.
85
-
86
- ### Reek
87
-
88
- [Reek](https://github.com/troessner/reek) is a code smell detector for Ruby.
89
-
90
- ```
91
- $ reek
92
- ```
93
-
94
- ### RuboCop
95
-
96
- [RuboCop](https://github.com/bbatsov/rubocop) is a Ruby static code analyzer.
97
-
98
- ```
99
- $ rubocop
100
- ```
101
-
102
- ### scss-lint
103
-
104
- [scss-lint](https://github.com/brigade/scss-lint) is a SCSS style analyzer.
105
-
106
- ```
107
- $ scss-lint .
108
- ```
109
-
110
33
  ## Security and Maintenance
111
34
 
112
35
  [Brakeman](https://github.com/presidentbeef/brakeman) is a static analysis security vulnerability scanner. Brakeman issues are reported in [Code Climate](https://codeclimate.com/).
113
36
 
114
- ```
115
- $ brakeman
116
- ```
117
-
118
- or
119
-
120
- ```
121
- $ bundle exec brakeman
122
- ```
123
-
124
- ## Documentation
37
+ ## Developers
125
38
 
126
- [Yard](https://github.com/lsegal/yard) is used to generate documentation. [Online documentation is available](http://www.rubydoc.info/github/archangel/archangel/master)
39
+ Developer documentation [is available](https://github.com/archangel/archangel/blob/master/docs/Developers.md).
127
40
 
128
- Build the documentation
129
-
130
- ```
131
- $ yard
132
- ```
133
-
134
- or
135
-
136
- ```
137
- $ yard doc
138
- ```
139
-
140
- Build the documentation and list all undocumented objects
141
-
142
- ```
143
- $ yard stats --list-undoc
144
- ```
145
-
146
- Inch documentation statistics can be generated
41
+ ## Pull Requests
147
42
 
148
- ```
149
- $ inch
150
- ```
43
+ 1. Fork the repo ([https://github.com/archangel/archangel/fork](https://github.com/archangel/archangel/fork))
44
+ 2. Clone the fork to your local machine
45
+ 3. Run `bundle install` inside `archangel` directory
46
+ 4. Make your updates or improvements
47
+ 5. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 6. Push to your fork (`git push origin my-new-feature`)
49
+ 7. Create a new Pull Request
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
  group :development do
8
8
  gem "brakeman", "~> 4.1", require: false
9
9
  gem "bundler-audit", "~> 0.6", require: false
10
- gem "inch", "~> 0.8.0.rc2", require: false
10
+ gem "inch", "~> 0.8", require: false
11
11
  gem "listen", "~> 3.1", require: false
12
12
  gem "mdl", "~> 0.4", require: false
13
13
  gem "reek", "~> 4.7", require: false
@@ -23,11 +23,11 @@ group :development, :test do
23
23
  end
24
24
 
25
25
  group :test do
26
- gem "capybara", "~> 2.17"
26
+ gem "capybara", "~> 3.0"
27
27
  gem "coveralls", "~> 0.8"
28
28
  gem "database_cleaner", "~> 1.6"
29
29
  gem "factory_bot_rails", "~> 4.8"
30
- gem "poltergeist", "~> 1.17"
30
+ gem "poltergeist", "~> 1.18"
31
31
  gem "rails-controller-testing", "~> 1.0"
32
32
  gem "rspec-rails", "~> 3.7"
33
33
  gem "shoulda-callback-matchers", "~> 1.1"
data/README.md CHANGED
@@ -12,8 +12,6 @@
12
12
 
13
13
  Archangel is a Rails CMS.
14
14
 
15
- The Archangel logo is made by [Joshua Boyd](http://www.joshadamboyd.com/)
16
-
17
15
  This project rocks and uses MIT-LICENSE.
18
16
 
19
17
  [Online documentation is available](http://www.rubydoc.info/github/archangel/archangel/master)
@@ -27,7 +25,7 @@ Deploy a sample application to [Heroku](https://www.heroku.com/) to play with.
27
25
  ## Requirements
28
26
 
29
27
  * Ruby >= 2.2.10
30
- * Rails ~> 5.1.4
28
+ * Rails ~> 5.1
31
29
 
32
30
  ## Installation
33
31
 
@@ -71,38 +69,6 @@ Run migrations
71
69
  $ bundle exec rails db:migrate
72
70
  ```
73
71
 
74
- ## Testing
75
-
76
- Generate a dummy application. You will be required to generate a dummy application before running tests.
77
-
78
- ```
79
- $ bundle exec rake dummy_app
80
- ```
81
-
82
- Run tests
83
-
84
- ```
85
- $ bundle exec rake
86
- ```
87
-
88
- or
89
-
90
- ```
91
- $ bundle exec rake spec
92
- ```
93
-
94
- or
95
-
96
- ```
97
- $ bundle exec rspec spec
98
- ```
99
-
100
- You can also enable fail fast in order to stop tests at the first failure
101
-
102
- ```
103
- $ bundle exec rspec spec --fail-fast
104
- ```
105
-
106
72
  ## Code Analysis
107
73
 
108
74
  * [Travis CI](https://travis-ci.org/) is used for running tests.
@@ -113,11 +79,20 @@ $ bundle exec rspec spec --fail-fast
113
79
 
114
80
  General documentation for developers
115
81
 
82
+ * [Contributing Guide](https://github.com/archangel/archangel/blob/master/CONTRIBUTING.md)
116
83
  * [Documentation for Archangel gem developers](https://github.com/archangel/archangel/blob/master/docs/Developers.md)
117
- * [Documentation for extension developers](https://github.com/archangel/archangel/blob/master/docs/ExtensionDevelopers.md)
118
- * [Documentation for theme developers](https://github.com/archangel/archangel/blob/master/docs/ThemeDevelopers.md)
84
+ * [Documentation for extension developers](https://github.com/archangel/archangel/blob/master/docs/Extension/Developers.md)
85
+ * [Documentation for theme developers](https://github.com/archangel/archangel/blob/master/docs/Theme/Developers.md)
119
86
  * [Documentation for releasing a gem version](https://github.com/archangel/archangel/blob/master/docs/Release.md) (maintainers only)
120
87
 
88
+ ## Logo
89
+
90
+ Archangel's logo was created by [Joshua Boyd](http://www.joshadamboyd.com/).
91
+
92
+ ## Special Thanks
93
+
94
+ [@archangel-dlt](https://github.com/archangel-dlt/) originally had the "archangel" gem name and were kind enough to give it up
95
+
121
96
  ## Contributing
122
97
 
123
98
  A [contributing guide](https://github.com/archangel/archangel/blob/master/CONTRIBUTING.md) is available.
data/Rakefile CHANGED
@@ -25,3 +25,14 @@ task :dummy_app do
25
25
 
26
26
  Rake::Task["dummy:generate"].invoke
27
27
  end
28
+
29
+ desc "Remove any generated files and directories"
30
+ task :clean do
31
+ %w[
32
+ brakeman.html Gemfile.lock spec/examples.txt yarn.lock
33
+ ].each { |file| rm_f file }
34
+
35
+ %w[
36
+ .yardoc coverage doc pkg archangel_* node_modules pkg spec/dummy
37
+ ].each { |directory| rm_rf directory }
38
+ end
@@ -24,8 +24,7 @@ module Archangel
24
24
 
25
25
  theme :theme_resolver
26
26
 
27
- rescue_from ActionController::UnknownController,
28
- AbstractController::ActionNotFound,
27
+ rescue_from AbstractController::ActionNotFound,
29
28
  ActionView::MissingTemplate,
30
29
  ActiveRecord::RecordNotFound, with: :render_404_error
31
30
 
data/archangel.gemspec CHANGED
@@ -14,7 +14,8 @@ Gem::Specification.new do |s|
14
14
  s.summary = "Archangel CMS"
15
15
  s.description = "Archangel is a Rails CMS"
16
16
  s.license = "MIT"
17
- s.files = `git ls-files`.split($ORS)
17
+ s.files = `git ls-files -z`.split("\x0")
18
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
 
19
20
  s.required_ruby_version = ">= 2.2.10"
20
21
 
@@ -48,5 +49,6 @@ Gem::Specification.new do |s|
48
49
  s.add_dependency "responders", "~> 2.4"
49
50
  s.add_dependency "selectize-rails", "~> 0.12"
50
51
  s.add_dependency "simple_form", "~> 4.0"
52
+ s.add_dependency "thor", "~> 0.19"
51
53
  s.add_dependency "validates", "~> 1.0"
52
54
  end
data/bin/archangel ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "thor/group"
5
+
6
+ case ARGV.first.downcase
7
+ when "extension"
8
+ require "archangel/command/extension"
9
+
10
+ ARGV.shift
11
+
12
+ Archangel::Command::Extension.start
13
+ else
14
+ puts "Unknown Archangel command."
15
+ end
data/docs/Developers.md CHANGED
@@ -1,3 +1,124 @@
1
1
  # Archangel Development
2
2
 
3
- TODO
3
+ This is documentation for developing the Archangel gem
4
+
5
+ Documentation for theme developers [is available](https://github.com/archangel/archangel/blob/master/docs/Theme/Developers.md).
6
+
7
+ Documentation for theme developers [is available](https://github.com/archangel/archangel/blob/master/docs/Extension/Developers.md).
8
+
9
+ ## Testing
10
+
11
+ [Travis CI](https://travis-ci.org/) is used for running tests. To get the best possible overview of issues with different Ruby versions, Archangel is tested with multiple various of Ruby. See [.travis.yml](https://github.com/archangel/archangel/blob/master/.travis.yml) for the versions of Ruby tested.
12
+
13
+ Generate a dummy application. You will be required to generate a dummy application before running tests.
14
+
15
+ ```
16
+ $ bundle exec rake dummy_app
17
+ ```
18
+
19
+ Run tests
20
+
21
+ ```
22
+ $ bundle exec rake
23
+ ```
24
+
25
+ or
26
+
27
+ ```
28
+ $ bundle exec rake spec
29
+ ```
30
+
31
+ or
32
+
33
+ ```
34
+ $ bundle exec rspec spec
35
+ ```
36
+
37
+ You can also enable fail fast in order to stop tests at the first failure
38
+
39
+ ```
40
+ $ bundle exec rspec spec --fail-fast
41
+ ```
42
+
43
+ ## Code Analysis
44
+
45
+ Various tools are used to ensure code is linted and formatted correctly.
46
+
47
+ ### JSHint
48
+
49
+ [jshint](https://github.com/jshint/jshint) is a Javascript style analyzer.
50
+
51
+ ```
52
+ $ jshint app/assets
53
+ ```
54
+
55
+ > NOTE: Integrations for multiple text editors and IDEs are [also available](http://jshint.com/install/).
56
+
57
+ ### Reek
58
+
59
+ [Reek](https://github.com/troessner/reek) is a code smell detector for Ruby.
60
+
61
+ ```
62
+ $ reek
63
+ ```
64
+
65
+ > NOTE: Integrations for multiple text editors and IDEs are [also available](https://github.com/troessner/reek#editor-integrations).
66
+
67
+ ### RuboCop
68
+
69
+ [RuboCop](https://github.com/bbatsov/rubocop) is a Ruby static code analyzer.
70
+
71
+ ```
72
+ $ rubocop
73
+ ```
74
+
75
+ ### scss-lint
76
+
77
+ [scss-lint](https://github.com/brigade/scss-lint) is a SCSS style analyzer.
78
+
79
+ ```
80
+ $ scss-lint .
81
+ ```
82
+
83
+ ## Security and Maintenance
84
+
85
+ [Brakeman](https://github.com/presidentbeef/brakeman) is a static analysis security vulnerability scanner. Brakeman issues are reported in [Code Climate](https://codeclimate.com/).
86
+
87
+ ```
88
+ $ bundle exec brakeman
89
+ $ open brakeman.html
90
+ ```
91
+
92
+ ### Cleanup
93
+
94
+ Remove all generated files
95
+
96
+ ```
97
+ $ bundle exec rake clean
98
+ ```
99
+
100
+ ## Documentation
101
+
102
+ [Yard](https://github.com/lsegal/yard) is used to generate documentation. [Online documentation is available](http://www.rubydoc.info/github/archangel/archangel/master)
103
+
104
+ Build the documentation
105
+
106
+ ```
107
+ $ yard doc
108
+ ```
109
+
110
+ Build the documentation and list all undocumented objects
111
+
112
+ ```
113
+ $ yard stats --list-undoc
114
+ ```
115
+
116
+ [Inch](https://inch-ci.org/) documentation statistics can be generated
117
+
118
+ ```
119
+ $ inch
120
+ ```
121
+
122
+ ## Releasing
123
+
124
+ Documentation for maintainers to release a new gem version [is available](https://github.com/archangel/archangel/blob/master/docs/Release.md).
@@ -0,0 +1,139 @@
1
+ # Controllers
2
+
3
+ Controllers are separated by `frontend`, `backend` or `auth` namespaces. Each section should be separated for functional clarity.
4
+
5
+ ## Backend Controllers
6
+
7
+ For Backend controllers, create your controller at `app/controllers/archangel/backend/foos_controller.rb` add the following.
8
+
9
+ ```
10
+ module Archangel
11
+ module Backend
12
+ class FoosController < BackendController
13
+ before_action :set_resources, only: %i[index]
14
+ before_action :set_resource, only: %i[destroy edit show update]
15
+ before_action :set_new_resource, only: %i[create new]
16
+
17
+ def index
18
+ respond_with @foos
19
+ end
20
+
21
+ def show
22
+ respond_with @foo
23
+ end
24
+
25
+ def new
26
+ respond_with @foo
27
+ end
28
+
29
+ def create
30
+ @foo.save
31
+
32
+ respond_with @foo, location: -> { location_after_create }
33
+ end
34
+
35
+ def edit
36
+ respond_with @foo
37
+ end
38
+
39
+ def update
40
+ @foo.update(resource_params)
41
+
42
+ respond_with @foo, location: -> { location_after_update }
43
+ end
44
+
45
+ def destroy
46
+ @foo.destroy
47
+
48
+ respond_with @foo, location: -> { location_after_destroy }
49
+ end
50
+
51
+ protected
52
+
53
+ def permitted_attributes
54
+ %w[bar bat baz slug]
55
+ end
56
+
57
+ def set_resources
58
+ @foos = current_site.foos.page(page_num).per(per_page)
59
+
60
+ authorize @foos
61
+ end
62
+
63
+ def set_resource
64
+ resource_id = params.fetch(:id)
65
+
66
+ # When `to_param` is not used in the model
67
+ @foo = current_site.foos.find_by!(id: resource_id)
68
+
69
+ # When `to_param` is used in the model
70
+ # @foo = current_site.foos.find_by!(slug: resource_id)
71
+
72
+ authorize @foo
73
+ end
74
+
75
+ def set_new_resource
76
+ new_params = action_name.to_sym == :create ? resource_params : nil
77
+
78
+ @foo = current_site.foos.new(new_params)
79
+
80
+ authorize @foo
81
+ end
82
+
83
+ def resource_params
84
+ params.require(resource_namespace).permit(permitted_attributes)
85
+ end
86
+
87
+ def resource_namespace
88
+ controller_name.singularize.to_sym
89
+ end
90
+
91
+ def location_after_create
92
+ location_after_save
93
+ end
94
+
95
+ def location_after_update
96
+ location_after_save
97
+ end
98
+
99
+ def location_after_destroy
100
+ location_after_save
101
+ end
102
+
103
+ def location_after_save
104
+ backend_foos_path
105
+ end
106
+ end
107
+ end
108
+ end
109
+ ```
110
+
111
+ Extending `BackendController` assumes your controller requires policy authorization. If your controller does not require authorization, use the following
112
+
113
+ ```
114
+ module Archangel
115
+ module Backend
116
+ class FoosController < BackendController
117
+ include Archangel::SkipAuthorizableConcern
118
+
119
+ ...
120
+ end
121
+ end
122
+ end
123
+ ```
124
+
125
+ To change the `id` for constructing a URL to this object, override `set_resource` in your controller.
126
+
127
+ ```
128
+ def set_resource
129
+ resource_id = params.fetch(:id)
130
+
131
+ @foo = current_site.foos.find_by!(slug: resource_id)
132
+
133
+ authorize @foo
134
+ end
135
+ ```
136
+
137
+ ## Testing Backend Controllers
138
+
139
+ TODO