granule 0.1.6 → 0.1.7

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +8 -7
  5. data/Gemfile +2 -0
  6. data/README.md +112 -13
  7. data/Rakefile +2 -0
  8. data/bin/console +1 -0
  9. data/exe/granule +1 -2
  10. data/granule.gemspec +2 -0
  11. data/lib/granule/cli.rb +19 -4
  12. data/lib/granule/feature/devise_semantic/devise.en.yml +65 -0
  13. data/lib/granule/feature/devise_semantic/devise.rb +303 -0
  14. data/lib/granule/feature/devise_semantic/devise_create_users.rb +43 -0
  15. data/lib/granule/feature/devise_semantic/user.rb +8 -0
  16. data/lib/granule/feature/devise_semantic/views/users/confirmations/new.html.erb +16 -0
  17. data/lib/granule/feature/devise_semantic/views/users/mailer/confirmation_instructions.html.erb +5 -0
  18. data/lib/granule/feature/devise_semantic/views/users/mailer/email_changed.html.erb +7 -0
  19. data/lib/granule/feature/devise_semantic/views/users/mailer/password_change.html.erb +3 -0
  20. data/lib/granule/feature/devise_semantic/views/users/mailer/reset_password_instructions.html.erb +8 -0
  21. data/lib/granule/feature/devise_semantic/views/users/mailer/unlock_instructions.html.erb +7 -0
  22. data/lib/granule/feature/devise_semantic/views/users/passwords/edit.html.erb +25 -0
  23. data/lib/granule/feature/devise_semantic/views/users/passwords/new.html.erb +18 -0
  24. data/lib/granule/feature/devise_semantic/views/users/registrations/edit.html.erb +45 -0
  25. data/lib/granule/feature/devise_semantic/views/users/registrations/new.html.erb +31 -0
  26. data/lib/granule/feature/devise_semantic/views/users/sessions/new.html.erb +37 -0
  27. data/lib/granule/feature/devise_semantic/views/users/shared/_error_messages.html.erb +14 -0
  28. data/lib/granule/feature/devise_semantic/views/users/shared/_links.html.erb +25 -0
  29. data/lib/granule/feature/devise_semantic/views/users/show.html.erb +22 -0
  30. data/lib/granule/feature/devise_semantic/views/users/unlocks/new.html.erb +16 -0
  31. data/lib/granule/feature/devise_semantic.rb +58 -0
  32. data/lib/granule/feature/semantic_react/hello_react.jsx +340 -0
  33. data/lib/granule/feature/semantic_react/homes_controller.rb +5 -0
  34. data/lib/granule/feature/semantic_react/index.html.erb +0 -0
  35. data/lib/granule/feature/semantic_react.rb +50 -0
  36. data/lib/granule/new/base/.dockerignore.tt +5 -0
  37. data/lib/granule/new/base/.gitignore.tt +33 -0
  38. data/lib/granule/{templates → new/base}/.rubocop.yml.tt +0 -0
  39. data/lib/granule/new/base/Dockerfile.dev.tt +34 -0
  40. data/lib/granule/{templates → new/base}/Gemfile.tt +5 -8
  41. data/lib/granule/new/base/README.md.tt +21 -0
  42. data/lib/granule/new/base/database.yml.tt +21 -0
  43. data/lib/granule/new/base/docker-compose.yml.tt +83 -0
  44. data/lib/granule/new/base.rb +19 -0
  45. data/lib/granule/version.rb +4 -2
  46. data/lib/granule.rb +2 -1
  47. metadata +38 -8
  48. data/Gemfile.lock +0 -169
  49. data/lib/granule/template.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b082a65854e1aab6a3638fb0bc4c7f64f88cad69f685f67c681776ab10a772d3
4
- data.tar.gz: 55ba22577d24d92d736d828b782d1465788ed4ce7970ff99b44e27202cf2afc4
3
+ metadata.gz: 36c6e3904ef0412b890f1ef65ed92960a3b1e914607989f387a4c124ad7ddd4a
4
+ data.tar.gz: 8412718336be9b9648da1fa3e653ac9e7b4580bf48c675e1f6f8f8a1bf0c3e86
5
5
  SHA512:
6
- metadata.gz: db8be67c3a0f1ab0d79a127c9904b4d9158b0177f6e725f2c1397063505ccb8e77ef4d417545216cf6651055932580fc4d778f52fe935e841a41cc3602ec20b9
7
- data.tar.gz: 4e8a189006214ce6f5b4c2504b2c9bb5c1089fdca8fab3e6db204561b6f96e94e6ad436286af3a55b7a5d5356b9a1a9e4ceb86591a49e6218ccd644933c2e716
6
+ metadata.gz: b1fb416fa5cbac9176c66047a08acc71c7f3239e00dec11f4718faea790b09ecdf5909520ef97b36da3bf03948d82cbf7eea7c1f3c361ff7a5337cc68ad8aad0
7
+ data.tar.gz: 6315f37cba131cc7a59aff0de80d8dc4697915b6b9ffb39e6a7e1aa692927b56c2718877b616da1d99ed86d31a3b16cc39fcec6b790738eb61f53a800f8f3d79
@@ -0,0 +1,21 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Get bundle dependencies
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs 4 --retry 3
20
+ - name: Run tests
21
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  *.gem
13
+
14
+ Gemfile.lock
data/.rubocop.yml CHANGED
@@ -9,19 +9,20 @@ AllCops:
9
9
  Metrics/LineLength:
10
10
  Max: 120
11
11
 
12
- Documentation:
13
- Enabled: false
14
-
15
- FrozenStringLiteralComment:
16
- Enabled: false
17
-
18
- Style/LambdaCall:
12
+ Style/Documentation:
19
13
  Enabled: false
20
14
 
21
15
  Metrics/BlockLength:
16
+ Max: 50
22
17
  Exclude:
23
18
  - 'spec/**/*.rb'
24
19
  - '*.gemspec'
25
20
 
21
+ Metrics/MethodLength:
22
+ Max: 50
23
+
26
24
  RSpec/MultipleExpectations:
27
25
  Enabled: false
26
+
27
+ RSpec/ExampleLength:
28
+ Max: 20
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in granule.gemspec
data/README.md CHANGED
@@ -1,45 +1,144 @@
1
1
  # Granule
2
+ > Boilerplate/template/generator for Rails app
2
3
 
3
- Rails (5.2.3) template with useful gems and configs
4
+ Rails (6.0.2) template with useful gems, configs and features. Ready for development out of the box. Dockerized for development.
4
5
 
5
- ## Installation
6
+ ## Installing / Getting started
6
7
 
7
- $ gem install granule
8
+ A quick introduction of the minimal setup you need to get a hello world up & running.
8
9
 
9
- ## Usage
10
-
11
- $ granule new <NAME>
10
+ ```shell
11
+ gem install granule
12
+ ```
12
13
 
14
+ ### Initial Configuration
13
15
 
14
- ## What's inside?
16
+ ```shell
17
+ granule new my-rails-app
18
+ ```
15
19
 
16
- ### App
17
-
18
- $ rails new -T --database=postgresql --webpack=react --skip-sprockets --skip-turbolinks
20
+ Executes `rails new --skip-test --skip-bundle --database=postgresql --webpack=react --skip-turbolinks my-rails-app` under the hood.
19
21
 
20
22
  ### Gems
21
23
 
22
24
  Core
23
25
 
26
+ * [bootsnap](https://github.com/Shopify/bootsnap) - library that plugs into Ruby, with optional support for ActiveSupport and YAML, to optimize and cache expensive computations
24
27
  * [devise](https://github.com/plataformatec/devise) - Authentication
25
28
  * [dry-matcher](https://github.com/dry-rb/dry-matcher) - Pattern matching for ruby. Used to unify controller handlers
26
29
  * [dry-monads](https://github.com/dry-rb/dry-monads) - Set of common monads for Ruby. Service Object/Interactor.
27
30
  * [dry-validation](https://github.com/dry-rb/dry-validation) - Validation library with type-safe schemas and rules.
28
31
  * [i18n-js](https://github.com/fnando/i18n-js) - Small library to provide the I18n translations on the Javascript
29
- * [react-rails](https://github.com/reactjs/react-rails) - React + Rails + Webpacker as a monolith app
32
+ * [mini_magick](https://github.com/minimagick/minimagick) - mini replacement for RMagick
33
+ * [pg](https://github.com/ged/ruby-pg) - A PostgreSQL client library for Ruby
34
+ * [data_migrate](https://github.com/ilyakatz/data-migrate) - Migrate and update data alongside your database structure.
35
+ * [puma](https://github.com/puma/puma) - A Ruby/Rack web server built for concurrency
30
36
  * [rolify](https://github.com/RolifyCommunity/rolify) - Role management library with resource scoping
31
37
  * [webpacker](https://github.com/rails/webpacker) - Bundling JavaScript assets
32
38
 
33
39
  Development
34
40
 
35
- * TBD
41
+ * [better_errors](https://github.com/BetterErrors/better_errors) - Replaces the standard Rails error page with a much better and more useful error page
42
+ * [letter_opener_web](https://github.com/fgrehm/letter_opener_web) - A web interface for browsing Ruby on Rails sent emails
43
+ * [listen](https://github.com/guard/listen) (default) - Listens to file modifications and notifies you about the changes. (Used for spring)
44
+ * [spring](https://github.com/rails/spring) (default) - Rails application preloader
45
+ * [spring-watcher-listen](https://github.com/jonleighton/spring-watcher-listen) (default) - Makes Spring watch the filesystem for changes using Listen rather than by polling the filesystem.
46
+ * [web-console](https://github.com/rails/web-console) (default) - Web Console is a debugging tool for your Ruby on Rails applications.
47
+
48
+ Development + Test
49
+
50
+ * [brakeman](https://github.com/presidentbeef/brakeman) - A static analysis security vulnerability scanner for Ruby on Rails applications
51
+ * [bullet](https://github.com/flyerhzm/bullet) - Helps to kill N+1 queries and unused eager loading
52
+ * [bundler-audit](https://github.com/rubysec/bundler-audit) - Patch-level verification for Bundler
53
+ * [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails) - fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.
54
+ * [fasterer](https://github.com/DamirSvrtan/fasterer) - Fasterer will suggest some speed improvements which you can check in detail at the fast-ruby repo.
55
+ * [ffaker](https://github.com/ffaker/ffaker) - Used to easily generate fake data: names, addresses, phone numbers, etc.
56
+ * [i18n-tasks](https://github.com/glebm/i18n-tasks) - Manage translation and localization with static analysis, for Ruby i18n
57
+ * [lol_dba](https://github.com/plentz/lol_dba) - small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts
58
+ * [pry-rails](https://github.com/rweng/pry-rails) - Causes rails console to open pry. It therefore depends on pry.
59
+ * [pry-rescue](https://github.com/ConradIrwin/pry-rescue) - Whenever an exception is raised, but not rescued, pry-rescue will automatically open Pry for you:
60
+ * [pry-stack_explorer](https://github.com/pry/pry-stack_explorer) - plugin for the Pry REPL that enables the user to navigate the call-stack
61
+ * [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) - code metric tool to check the quality of Rails code.
62
+ * [reek](https://github.com/troessner/reek) - Code smell detector for Ruby
63
+ * [rubocop](https://github.com/rubocop-hq/rubocop) - A Ruby static code analyzer and formatter, based on the community Ruby style guide.
64
+ * [rubocop-performance](https://github.com/rubocop-hq/rubocop-performance) - An extension of RuboCop focused on code performance checks.
65
+ * [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) - Code style checking for RSpec files
66
+ * [rubycritic](https://github.com/whitesmith/rubycritic) - A Ruby code quality reporter
36
67
 
37
68
  Test
38
69
 
39
- * TBD
70
+ * [capybara](https://github.com/teamcapybara/capybara) - Acceptance test framework for web applications
71
+ * [rspec-rails](https://github.com/rspec/rspec-rails) - RSpec for Rails-3+
72
+ * [selenium-webdriver](https://github.com/SeleniumHQ/selenium) - Provides Ruby bindings for WebDriver
73
+ * [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) - Provides RSpec- and Minitest-compatible one-liners to test common Rails functionality that, if written by hand, would be much longer, more complex, and error-prone.
74
+ * [simplecov](https://github.com/colszowka/simplecov) - Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites
75
+ * [webdrivers](https://github.com/titusfortner/webdrivers) - Keep your Selenium WebDrivers updated automatically
76
+
77
+ ### Conventions
78
+
79
+ #### Folder structure
80
+
81
+ `feature folders` is convenient way to split business logic regarding controller actions.
82
+
83
+ .
84
+ ├── app
85
+ │ ├── controllers
86
+ │ │ ├── applications_controller.rb # Default
87
+ │ │ └── sessions_controller.rb # Typical rails controller
88
+ │ ├── core
89
+ │ │ ├── application_interactor.rb # Parent interactor class
90
+ │ │ ├── application_contract.rb # Parent contract class
91
+ │ │ └── session_create # Feature folder (controller_action name)
92
+ │ │ ├── contract.rb # params validations
93
+ │ │ ├── interactor.rb # business logic
94
+ │ │ ├── policy.rb # authorization layer
95
+ │ │ ├── serializer.rb # json presenter
96
+ │ │ └── you_name_it.rb # custom logic
97
+ │ ...
98
+ ├── spec
99
+ │ ├── core
100
+ │ │ ├── session_create_spec.rb # Unit tests input/output
101
+ │ │ ...
102
+ │ ├── request
103
+ │ │ ├── sessions_request_spec.rb # Integration tests (SUCCESS/FAIL)
104
+ │ │ ...
105
+ │ └── system
106
+ │ ├── login_spec.rb # Rails System specs (using browser driver)
107
+ │ ...
108
+
109
+ ## Features
110
+
111
+ What's all the bells and whistles this project can perform?
112
+ * What's the main functionality
113
+ * You can also do another thing
114
+ * If you get really randy, you can even do this
115
+
116
+ ## Usage
117
+
118
+ ### Controllers
119
+
120
+ TBD
121
+
122
+ ### Matchers
123
+
124
+ TBD
125
+
126
+ ### Interactors
127
+
128
+ TBD
129
+
130
+ ### Contracts
131
+
132
+ TBD
133
+
134
+ ### Authorization
135
+
136
+ TBD
40
137
 
41
138
  ## Contributing
42
139
 
140
+ TBD
141
+
43
142
  Bug reports and pull requests are welcome on GitHub at https://github.com/leksster/granule. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
44
143
 
45
144
  ## License
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'granule'
data/exe/granule CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require 'bundler'
4
- require 'bundler/setup'
5
4
  require 'granule'
6
5
 
7
6
  Granule::CLI.start(ARGV)
data/granule.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'granule/version'
data/lib/granule/cli.rb CHANGED
@@ -1,15 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
4
+ require 'granule/feature/semantic_react'
5
+ require 'granule/feature/devise_semantic'
2
6
 
3
7
  module Granule
4
8
  class CLI < Thor
5
9
  include Thor::Actions
6
10
 
7
- DEFAULT_OPTIONS = '-T --database=postgresql '\
8
- '--webpack=react --skip-sprockets '\
9
- "--skip-turbolinks -m #{File.dirname __dir__}/granule/template.rb".freeze
11
+ DEFAULT_OPTIONS = '--skip-bundle --skip-webpack-install --skip-test --database=postgresql '\
12
+ '--webpack=react'\
13
+ "--skip-turbolinks -m #{File.dirname __dir__}/granule/new/base.rb"
10
14
 
11
15
  desc 'new DIRECTORY', 'Create a new rails app'
12
-
13
16
  def new(name)
14
17
  cmd = "rails new #{name} #{DEFAULT_OPTIONS}"
15
18
 
@@ -19,5 +22,17 @@ module Granule
19
22
  run(cmd)
20
23
  end
21
24
  end
25
+
26
+ desc 'feature NAME', 'available: semantic-devise'
27
+ def feature(name)
28
+ service = {
29
+ "semantic-react": Granule::Feature::SemanticReact,
30
+ "semantic-devise": Granule::Feature::DeviseSemantic
31
+ }[name.to_sym]
32
+
33
+ return unless service
34
+
35
+ service.new.call
36
+ end
22
37
  end
23
38
  end
@@ -0,0 +1,65 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ email_changed:
27
+ subject: "Email Changed"
28
+ password_change:
29
+ subject: "Password Changed"
30
+ omniauth_callbacks:
31
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32
+ success: "Successfully authenticated from %{kind} account."
33
+ passwords:
34
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37
+ updated: "Your password has been changed successfully. You are now signed in."
38
+ updated_not_active: "Your password has been changed successfully."
39
+ registrations:
40
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41
+ signed_up: "Welcome! You have signed up successfully."
42
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46
+ updated: "Your account has been updated successfully."
47
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
48
+ sessions:
49
+ signed_in: "Signed in successfully."
50
+ signed_out: "Signed out successfully."
51
+ already_signed_out: "Signed out successfully."
52
+ unlocks:
53
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56
+ errors:
57
+ messages:
58
+ already_confirmed: "was already confirmed, please try signing in"
59
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60
+ expired: "has expired, please request a new one"
61
+ not_found: "not found"
62
+ not_locked: "was not locked"
63
+ not_saved:
64
+ one: "1 error prohibited this %{resource} from being saved:"
65
+ other: "%{count} errors prohibited this %{resource} from being saved:"