jets-railtie 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bb95f516f40e2a75ca4e23dba4c6eee74da459bbf40c4fd0e44f876e24bb975
4
- data.tar.gz: 91e46983a2a84bb03ea541968b070063bd7291eb41a1d1aaabd37dfbd7442113
3
+ metadata.gz: 00d4d29cdd04a8e856cacc269780141d118483015e3fe7ed3ab9bec6cd28e002
4
+ data.tar.gz: 6aefe043bf6070c6b4eea6126b0750cb201b9ce579e3cdc56e6c8237eb3cd6df
5
5
  SHA512:
6
- metadata.gz: '0917fb15c56177c43faada8f91ea6fe5c587ba8aece29f13c7a8658db0c1eb8524679bdfac81dd93c6c6a8ed01febc554643bc4c682e354a0af114aca2aaf228'
7
- data.tar.gz: c592fa22da8e510a55892397330e1934d2461068ee24958d031a6300fee487f4b3b7d1a2e80791e029756caba46b0231d15be1b19a7edfe43839d68eacfa0a01
6
+ metadata.gz: a7c7e987600ef48095b9b7ab2ad195322381b956ef186aa1a0ef1c8dee4b31909e8fefb1585c9cc65e6bef82ec24ea15d6f9d8ed52d48a3705f8c30daf4b84e2
7
+ data.tar.gz: 9757b2e3a5953e7e217d4183a8d36d907d536b04ee4460ca668bca6dd2fb3decf14f8a4ead3fc3d3d3bcc1d70e613514545517b73c292c9a5cdcec2433a607b6
@@ -8,6 +8,7 @@ require "jets/rails/version"
8
8
  Gem::Specification.new do |spec|
9
9
  spec.name = "jets-railtie"
10
10
  spec.authors = ["Lauri Jutila"]
11
+ spec.email = "ruby@laurijutila.com"
11
12
  spec.license = "MIT"
12
13
  spec.version = Jets::Rails::VERSION.dup
13
14
 
@@ -26,6 +27,11 @@ Gem::Specification.new do |spec|
26
27
 
27
28
  spec.required_ruby_version = ">= 2.7.0"
28
29
 
30
+ spec.add_runtime_dependency "jets-bundler", "~> 0.1"
31
+ spec.add_runtime_dependency "jets-factory", "~> 0.1"
32
+ spec.add_runtime_dependency "jets-testing", "~> 0.1"
33
+ spec.add_runtime_dependency "jets-rubocop", "~> 0.1"
34
+
29
35
  # to update dependencies edit project.yml
30
36
 
31
37
  spec.add_development_dependency "bundler", "~> 2"
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module Jets
6
+ module Generators
7
+ class EngineGenerator < ::Rails::Generators::NamedBase
8
+ namespace "jets:engine"
9
+ source_root File.expand_path("templates", __dir__)
10
+
11
+ desc "Generates a Rails engine with given NAME with Jets conventions " \
12
+ "and configurations. \n\n"
13
+
14
+ def create_engine_file
15
+ directory(".", "engines/#{name}")
16
+
17
+ chmod "engines/#{name}/bin/console", 0o755, verbose: false
18
+ chmod "engines/#{name}/bin/rails", 0o755, verbose: false
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
4
+
5
+ require "<%= name %>/version"
6
+
7
+ # Use Rails version from the project's root
8
+ rails_version = File.read(File.join(__dir__, "../../.rails-version"))
9
+
10
+ Gem::Specification.new do |s|
11
+ s.name = "<%= name %>"
12
+ s.version = <%= class_name %>::VERSION
13
+ s.authors = ["TODO"]
14
+ s.summary = "TODO:"
15
+ s.description = "TODO:"
16
+
17
+ s.files = Dir["{app,config,db,lib}/**/*"]
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency "rails", rails_version
21
+ s.add_dependency "pg", "~> 1.0"
22
+
23
+ s.add_development_dependency "brakeman", "~> 4.7"
24
+ s.add_development_dependency "bundler", ">= 2.0"
25
+ s.add_development_dependency "pry-byebug", ">= 3.4"
26
+ s.add_development_dependency "rake", "~> 13.0"
27
+
28
+ # Internal
29
+ s.add_development_dependency "jets-rubocop"
30
+ s.add_development_dependency "jets-testing"
31
+ end
@@ -0,0 +1,19 @@
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"
16
+
17
+ # Speed up application code loading
18
+ # https://github.com/Shopify/bootsnap
19
+ gem "bootsnap", ">= 1.4.3", require: false
@@ -0,0 +1,3 @@
1
+ # <%= class_name %> Engine
2
+
3
+ TODO: Write the purpose and description of this engine.
@@ -0,0 +1,9 @@
1
+ require "bundler/setup"
2
+ require "<%= name %>"
3
+ require_relative "spec/rails_helper"
4
+
5
+ begin
6
+ require "rspec/core/rake_task"
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ rescue LoadError
9
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "pry"
6
+ require "<%= name %>"
7
+ require_relative "../spec/rails_helper"
8
+
9
+ Pry.start
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+
6
+ ENGINE_ROOT = File.expand_path("..", __dir__)
7
+ ENGINE_PATH = File.expand_path("../lib/<%= name %>/engine", __dir__)
8
+
9
+ require_relative "../spec/rails_helper"
10
+
11
+ require "rails/engine/commands"
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+
5
+ require "<%= name %>/version"
6
+
7
+ module <%= class_name %>
8
+ class << self
9
+ # Configure table_name_prefix for all the models from the engine
10
+ # if there could be a collision with other engines, or the main
11
+ # app models.
12
+ #
13
+ # This is useful during the gradual migration to component-based
14
+ # architecture.
15
+
16
+ def table_name_prefix
17
+ ""
18
+ end
19
+ end
20
+ end
21
+
22
+ require "<%= name %>/engine"
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/engine"
4
+
5
+ module <%= class_name %>
6
+ class << self
7
+ def configure
8
+ yield Engine.config
9
+ end
10
+ end
11
+
12
+ class Engine < ::Rails::Engine
13
+ isolate_namespace <%= class_name %>
14
+
15
+ config.autoload_paths += Dir["#{config.root}/app/**/concerns"]
16
+
17
+ initializer "<%= name %>" do |app|
18
+ app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
19
+
20
+ # For migration_context (used for checking if migrations are pending)
21
+ ActiveRecord::Migrator.migrations_path += config.paths["db/migrate"].expanded.flatten
22
+
23
+ engine_factories_path = root.join("spec", "factories")
24
+
25
+ # This hook is provided by `jets-factory` gem
26
+ ActiveSupport.on_load(:factory_bot) do
27
+ FactoryBot.definition_file_paths.unshift engine_factories_path
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module <%= class_name %>
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,6 @@
1
+ test:
2
+ adapter: postgresql
3
+ url: <%%= ENV["DATABASE_URL"].sub("postgres://", "postgis://") %>
4
+ pool: <%%= ENV["DB_POOL_SIZE"] || 5 %>
5
+ timeout: 5000
6
+ database: engine_<%= name %>_test
@@ -0,0 +1,3 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("../../tmp/storage") %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ ActiveRecord::Schema.define do
4
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Engine root is used by rails_configuration to correctly
4
+ # load fixtures and support files
5
+
6
+ ENGINE_ROOT = Pathname.new(File.expand_path("..", __dir__))
7
+
8
+ ENV["RAILS_ENV"] = "test"
9
+ ENV["BOOTSNAP_CACHE_DIR"] = File.join(ENGINE_ROOT, "spec", "internal", "tmp", "cache")
10
+
11
+ require "bootsnap/setup"
12
+
13
+ require "combustion"
14
+ require "jets/testing/ext/combustion_bundler_patch"
15
+
16
+ begin
17
+ # Customize your Combustion test application.
18
+ # Combustion.initialize! :active_record, :active_job, :active_storage, :action_mailer, :action_controller
19
+ Combustion.initialize! :active_record, bundler_groups: :<%= name %> do
20
+ config.logger = Logger.new(nil)
21
+ config.log_level = :fatal
22
+
23
+ config.autoloader = :zeitwerk
24
+
25
+ # Always use test adapter for active_job
26
+ # config.active_job.queue_adapter = :test
27
+ #
28
+ # Always use test service to active_storage
29
+ # config.active_storage.service = :test
30
+ #
31
+ # Enable verbose logging for active_record
32
+ # config.active_record.verbose_query_logs = true
33
+ end
34
+ rescue => e
35
+ # Fail fast if application couldn't be loaded
36
+ $stdout.puts "Failed to load the app: #{e.message}\n#{e.backtrace.take(5).join("\n")}"
37
+ exit(1)
38
+ end
39
+
40
+ # if you need url helpers (e.g. with active storage)
41
+ # Rails.application.default_url_options[:host] = "localhost"
42
+ # <%= class_name %>::Engine.routes.default_url_options[:host] = "localhost"
43
+
44
+ require "jets/testing/rails_configuration"
45
+
46
+ # action_policy helpers
47
+ # require "action_policy/rspec"
48
+ # require "action_policy/rspec/dsl"
49
+
50
+ # Additional RSpec configuration
51
+ #
52
+ # RSpec.configure do |config|
53
+ # config.after(:suite) do
54
+ # # Cleanup attachments generated during tests
55
+ # FileUtils.rm_rf(ActiveStorage::Blob.service.root)
56
+ # end
57
+ # end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+ require "pry-byebug"
5
+
6
+ require "jets/testing/rspec_configuration"
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module Jets
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+ namespace "jets:install"
9
+ source_root File.expand_path("templates", __dir__)
10
+
11
+ desc "Sets up your Rails application to use Jets. \n\n"
12
+
13
+ def set_rails_version
14
+ template ".rails-version", "./.rails-version"
15
+ end
16
+ end
17
+ end
18
+ end
File without changes
@@ -9,7 +9,8 @@ module Jets
9
9
  # @api public
10
10
  class Railtie < ::Rails::Railtie
11
11
  generators do
12
- require "jets/generators/engine_generator"
12
+ require "generators/jets/engine/engine_generator"
13
+ require "generators/jets/install/install_generator"
13
14
  end
14
15
  end
15
16
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jets
4
4
  module Rails
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets-railtie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Jutila
@@ -10,6 +10,62 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jets-bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jets-factory
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jets-testing
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jets-rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.1'
13
69
  - !ruby/object:Gem::Dependency
14
70
  name: bundler
15
71
  requirement: !ruby/object:Gem::Requirement
@@ -96,14 +152,31 @@ dependencies:
96
152
  version: '0.4'
97
153
  description: jets-railtie provides the official integration of Jets gems with Ruby
98
154
  on Rails framework.
99
- email:
155
+ email: ruby@laurijutila.com
100
156
  executables: []
101
157
  extensions: []
102
158
  extra_rdoc_files: []
103
159
  files:
104
160
  - README.md
105
161
  - jets-railtie.gemspec
106
- - lib/jets-rails.rb
162
+ - lib/generators/jets/engine/engine_generator.rb
163
+ - lib/generators/jets/engine/templates/%name%.gemspec.tt
164
+ - lib/generators/jets/engine/templates/Gemfile
165
+ - lib/generators/jets/engine/templates/Gemfile.runtime
166
+ - lib/generators/jets/engine/templates/README.md.tt
167
+ - lib/generators/jets/engine/templates/Rakefile.tt
168
+ - lib/generators/jets/engine/templates/bin/console.tt
169
+ - lib/generators/jets/engine/templates/bin/rails.tt
170
+ - lib/generators/jets/engine/templates/lib/%name%.rb.tt
171
+ - lib/generators/jets/engine/templates/lib/%name%/engine.rb.tt
172
+ - lib/generators/jets/engine/templates/lib/%name%/version.rb.tt
173
+ - lib/generators/jets/engine/templates/spec/internal/config/database.yml.tt
174
+ - lib/generators/jets/engine/templates/spec/internal/config/storage.yml.tt
175
+ - lib/generators/jets/engine/templates/spec/internal/db/schema.rb
176
+ - lib/generators/jets/engine/templates/spec/rails_helper.rb.tt
177
+ - lib/generators/jets/engine/templates/spec/spec_helper.rb
178
+ - lib/generators/jets/install/install_generator.rb
179
+ - lib/jets-railtie.rb
107
180
  - lib/jets/rails.rb
108
181
  - lib/jets/rails/railtie.rb
109
182
  - lib/jets/rails/version.rb