jets-railtie 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/generators/jets/engine/USAGE +5 -0
- data/lib/generators/jets/engine/engine_generator.rb +8 -0
- data/lib/generators/jets/engine/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
- data/lib/generators/jets/engine/templates/config/routes.rb.tt +2 -0
- data/lib/generators/jets/engine/templates/lib/%name%/engine.rb.tt +18 -0
- data/lib/generators/jets/engine/templates/spec/internal/config/database.yml.tt +1 -1
- data/lib/generators/jets/engine/templates/spec/rails_helper.rb.tt +9 -2
- data/lib/generators/jets/engine/templates/spec/spec_helper.rb +1 -1
- data/lib/generators/jets/gem/USAGE +5 -0
- data/lib/generators/jets/gem/gem_generator.rb +21 -0
- data/lib/generators/jets/gem/templates/%name%.gemspec.tt +24 -0
- data/lib/generators/jets/gem/templates/Gemfile +15 -0
- data/lib/generators/jets/gem/templates/Gemfile.runtime +0 -0
- data/lib/generators/jets/gem/templates/README.md.tt +29 -0
- data/lib/generators/jets/gem/templates/Rakefile.tt +8 -0
- data/lib/generators/jets/gem/templates/bin/console.tt +8 -0
- data/lib/generators/jets/gem/templates/lib/%name%.rb.tt +3 -0
- data/lib/generators/jets/gem/templates/lib/%name%/version.rb.tt +5 -0
- data/lib/generators/jets/gem/templates/spec/rails_helper.rb +5 -0
- data/lib/generators/jets/gem/templates/spec/spec_helper.rb +6 -0
- data/lib/generators/jets/install/install_generator.rb +5 -0
- data/lib/jets/rails/railtie.rb +1 -0
- data/lib/jets/rails/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d88132a962ea916b76cb977db82b70ec9911e6331b46686ad32d5b81fa273d5
|
4
|
+
data.tar.gz: 600db5cb2897447a3a26df713338b9b0e17f8261fb40382d02c6abfe2588abc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f4aace375c8ae534a1afb2b1b4515895331c86452dca29bed5e5a9375ce16be137d67e0326cd1b2ed7aacf67482c651773c9807e7b8a68ccbcd993e4d0f1a29
|
7
|
+
data.tar.gz: acd0ab0b46ca22140e66aca065c4330406a158b6da74672bdc2bd3af460bcbec847582726cb7b580ba062c09cf401602033dbcadf46335b178c91b3e6665b642
|
data/README.md
CHANGED
@@ -16,3 +16,15 @@ This library officially supports the following Ruby versions:
|
|
16
16
|
## License
|
17
17
|
|
18
18
|
See `LICENSE` file.
|
19
|
+
|
20
|
+
## Credits
|
21
|
+
|
22
|
+
Original inspiration for the Jets project comes from [Vladimir Dementyev's](https://github.com/palkan)
|
23
|
+
excellent presentation on component-based Rails monolith applications and his [Engems](https://github.com/palkan/engems)
|
24
|
+
showcase repository.
|
25
|
+
|
26
|
+
Code:
|
27
|
+
- [Engems](https://github.com/palkan/engems)
|
28
|
+
|
29
|
+
Talks:
|
30
|
+
- [Between monoliths and microservices](https://noti.st/palkan/VWPOSd/between-monoliths-and-microservices)
|
@@ -17,6 +17,14 @@ module Jets
|
|
17
17
|
chmod "engines/#{name}/bin/console", 0o755, verbose: false
|
18
18
|
chmod "engines/#{name}/bin/rails", 0o755, verbose: false
|
19
19
|
end
|
20
|
+
|
21
|
+
def mount_engine_to_routes
|
22
|
+
route "mount #{class_name}::Engine, at: \"/\", as: :#{name}_root"
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_engine_to_gemfile_as_component
|
26
|
+
append_to_file "Gemfile", "component \"#{name}\""
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
22
30
|
end
|
@@ -14,6 +14,9 @@ module <%= class_name %>
|
|
14
14
|
|
15
15
|
config.autoload_paths += Dir["#{config.root}/app/**/concerns"]
|
16
16
|
|
17
|
+
# Specify the application controller base class, defaults to main application's ApplicationController
|
18
|
+
config.application_controller = "ApplicationController"
|
19
|
+
|
17
20
|
initializer "<%= name %>" do |app|
|
18
21
|
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
|
19
22
|
|
@@ -27,5 +30,20 @@ module <%= class_name %>
|
|
27
30
|
FactoryBot.definition_file_paths.unshift engine_factories_path
|
28
31
|
end
|
29
32
|
end
|
33
|
+
|
34
|
+
initialize "<%= name %>.subscribe_to_events" do
|
35
|
+
ActiveSupport.on_load :active_event_store do |store|
|
36
|
+
# async subscriber is invoked from a background job, enqueued after the transaction commits
|
37
|
+
# store.subscribe MyEventHandler, to: EventHappened
|
38
|
+
|
39
|
+
# anonymous handler
|
40
|
+
# store.subscribe(to: EventHappened, sync: true) do |event|
|
41
|
+
# # do something
|
42
|
+
# end
|
43
|
+
|
44
|
+
# subscribes to EventHappened automatically
|
45
|
+
# store.subscribe OnEventHappened::DoThat
|
46
|
+
end
|
47
|
+
end
|
30
48
|
end
|
31
49
|
end
|
@@ -3,7 +3,9 @@
|
|
3
3
|
# Engine root is used by rails_configuration to correctly
|
4
4
|
# load fixtures and support files
|
5
5
|
|
6
|
-
|
6
|
+
unless defined?(ENGINE_ROOT)
|
7
|
+
ENGINE_ROOT = Pathname.new(File.expand_path("..", __dir__))
|
8
|
+
end
|
7
9
|
|
8
10
|
ENV["RAILS_ENV"] = "test"
|
9
11
|
ENV["BOOTSNAP_CACHE_DIR"] = File.join(ENGINE_ROOT, "spec", "internal", "tmp", "cache")
|
@@ -41,7 +43,12 @@ end
|
|
41
43
|
# Rails.application.default_url_options[:host] = "localhost"
|
42
44
|
# <%= class_name %>::Engine.routes.default_url_options[:host] = "localhost"
|
43
45
|
|
44
|
-
|
46
|
+
module Jets
|
47
|
+
module Testing
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
require "jets/testing/rails"
|
45
52
|
|
46
53
|
# action_policy helpers
|
47
54
|
# require "action_policy/rspec"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators"
|
4
|
+
|
5
|
+
module Jets
|
6
|
+
module Generators
|
7
|
+
class GemGenerator < ::Rails::Generators::NamedBase
|
8
|
+
namespace "jets:gem"
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
10
|
+
|
11
|
+
desc "Generates a gem with given NAME with Jets conventions " \
|
12
|
+
"and configurations. \n\n"
|
13
|
+
|
14
|
+
def create_gem_file
|
15
|
+
directory(".", "gems/#{name}")
|
16
|
+
|
17
|
+
chmod "engines/#{name}/bin/console", 0o755, verbose: false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
4
|
+
|
5
|
+
require "<%= name %>/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "<%= name %>"
|
9
|
+
s.version = <%= class_name %>::VERSION
|
10
|
+
s.authors = ["TODO"]
|
11
|
+
s.summary = "TODO:"
|
12
|
+
s.description = "TODO:"
|
13
|
+
|
14
|
+
s.files = Dir["{config,lib}/**/*", "Rakefile"]
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_development_dependency "bundler", "~> 2"
|
18
|
+
s.add_development_dependency "pry-byebug", "~> 3.4"
|
19
|
+
s.add_development_dependency "rake", "~> 13.0"
|
20
|
+
|
21
|
+
# Internal
|
22
|
+
s.add_development_dependency "jets-rubocop", "~> 0.1"
|
23
|
+
s.add_development_dependency "jets-testing", "~> 0.1"
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
git_source(:github) do |repo_name|
|
6
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
7
|
+
"https://github.com/#{repo_name}.git"
|
8
|
+
end
|
9
|
+
|
10
|
+
gemspec
|
11
|
+
|
12
|
+
eval_gemfile "./Gemfile.runtime"
|
13
|
+
|
14
|
+
gem "jets-testing"
|
15
|
+
gem "jets-rubocop"
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# <%= class_name %>
|
2
|
+
|
3
|
+
## Purpose
|
4
|
+
|
5
|
+
TODO: Purpose of this gem.
|
6
|
+
|
7
|
+
## Architecture
|
8
|
+
|
9
|
+
TODO: Define the architecture of this gem.
|
10
|
+
|
11
|
+
## Development Environment
|
12
|
+
|
13
|
+
TODO: Write instructions how to set up a development environment for this gem.
|
14
|
+
|
15
|
+
## Test Environment
|
16
|
+
|
17
|
+
TODO: Write instructions how to set up a test environment for this gem.
|
18
|
+
|
19
|
+
## Production Environment
|
20
|
+
|
21
|
+
TODO: Write instructions how to use this gem in production.
|
22
|
+
|
23
|
+
## Continuous Integration
|
24
|
+
|
25
|
+
TODO: Write instructions on how this gem is continuously integrated.
|
26
|
+
|
27
|
+
## Coding Style
|
28
|
+
|
29
|
+
TODO: Define coding style for this gem.
|
@@ -13,6 +13,11 @@ module Jets
|
|
13
13
|
def set_rails_version
|
14
14
|
template ".rails-version", "./.rails-version"
|
15
15
|
end
|
16
|
+
|
17
|
+
def modify_gemfile
|
18
|
+
prepend_to_file "Gemfile", 'require "bundler/component"'
|
19
|
+
prepend_to_file "Gemfile", 'require "bundler/eval_gemfile"'
|
20
|
+
end
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|
data/lib/jets/rails/railtie.rb
CHANGED
data/lib/jets/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets-railtie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lauri Jutila
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jets-bundler
|
@@ -159,14 +159,17 @@ extra_rdoc_files: []
|
|
159
159
|
files:
|
160
160
|
- README.md
|
161
161
|
- jets-railtie.gemspec
|
162
|
+
- lib/generators/jets/engine/USAGE
|
162
163
|
- lib/generators/jets/engine/engine_generator.rb
|
163
164
|
- lib/generators/jets/engine/templates/%name%.gemspec.tt
|
164
165
|
- lib/generators/jets/engine/templates/Gemfile
|
165
166
|
- lib/generators/jets/engine/templates/Gemfile.runtime
|
166
167
|
- lib/generators/jets/engine/templates/README.md.tt
|
167
168
|
- lib/generators/jets/engine/templates/Rakefile.tt
|
169
|
+
- lib/generators/jets/engine/templates/app/controllers/%name%/application_controller.rb.tt
|
168
170
|
- lib/generators/jets/engine/templates/bin/console.tt
|
169
171
|
- lib/generators/jets/engine/templates/bin/rails.tt
|
172
|
+
- lib/generators/jets/engine/templates/config/routes.rb.tt
|
170
173
|
- lib/generators/jets/engine/templates/lib/%name%.rb.tt
|
171
174
|
- lib/generators/jets/engine/templates/lib/%name%/engine.rb.tt
|
172
175
|
- lib/generators/jets/engine/templates/lib/%name%/version.rb.tt
|
@@ -175,6 +178,18 @@ files:
|
|
175
178
|
- lib/generators/jets/engine/templates/spec/internal/db/schema.rb
|
176
179
|
- lib/generators/jets/engine/templates/spec/rails_helper.rb.tt
|
177
180
|
- lib/generators/jets/engine/templates/spec/spec_helper.rb
|
181
|
+
- lib/generators/jets/gem/USAGE
|
182
|
+
- lib/generators/jets/gem/gem_generator.rb
|
183
|
+
- lib/generators/jets/gem/templates/%name%.gemspec.tt
|
184
|
+
- lib/generators/jets/gem/templates/Gemfile
|
185
|
+
- lib/generators/jets/gem/templates/Gemfile.runtime
|
186
|
+
- lib/generators/jets/gem/templates/README.md.tt
|
187
|
+
- lib/generators/jets/gem/templates/Rakefile.tt
|
188
|
+
- lib/generators/jets/gem/templates/bin/console.tt
|
189
|
+
- lib/generators/jets/gem/templates/lib/%name%.rb.tt
|
190
|
+
- lib/generators/jets/gem/templates/lib/%name%/version.rb.tt
|
191
|
+
- lib/generators/jets/gem/templates/spec/rails_helper.rb
|
192
|
+
- lib/generators/jets/gem/templates/spec/spec_helper.rb
|
178
193
|
- lib/generators/jets/install/install_generator.rb
|
179
194
|
- lib/jets-railtie.rb
|
180
195
|
- lib/jets/rails.rb
|