stimpack 0.3.0 → 0.6.0
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.
- checksums.yaml +4 -4
- data/README.md +16 -5
- data/bin/tapioca +29 -0
- data/lib/stimpack/integrations/rspec.rb +7 -0
- data/lib/stimpack/pack/configuration.rb +7 -1
- data/lib/stimpack/packs.rb +3 -2
- data/lib/stimpack/railtie.rb +2 -0
- data/lib/stimpack/version.rb +1 -1
- data/lib/stimpack.rb +1 -0
- metadata +51 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6ad8e03da3ba828985b82eccb3840f6f4122d5fe38bcbc7905734a566c7d4cc
|
4
|
+
data.tar.gz: cba30db4834bd3e056ea19c76067945d73378c799b603f1cc931d43ac409cf59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d38f3c326b2fa6f327de5b0d2da6e77c1ea58e54c28df8e51887247743699ad3f8cc5e4dc5f769c50eaa80011a6ee8374fd21c4173e3c5c0b59a26ebb9609f82
|
7
|
+
data.tar.gz: 20bd2048490efd0eaa00380263c31c98e1eededa46458e61195c62b4f2c2f4102db1f080eb03efaf3f9496bd5d1777ec06f48109d1cf2dab52332900e41cde98
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Stimpack
|
2
2
|
|
3
|
-
`stimpack`
|
3
|
+
`stimpack` establishes and implements a set of conventions for splitting up large monoliths built on top of [`packwerk`](https://github.com/Shopify/packwerk). With `stimpack`, new packages' autoload paths are automatically added to Rails, so your code will immediately become usable and loadable without additional configuration.
|
4
4
|
|
5
5
|
Here is an example application that uses `stimpack`:
|
6
6
|
```
|
@@ -24,12 +24,12 @@ packs/
|
|
24
24
|
some_other_non_namespaced_private_model.rb # this works too
|
25
25
|
my_domain/
|
26
26
|
my_private_namespacd_model.rb
|
27
|
-
config/
|
28
|
-
initializers/ # Initializers can live in packs and load as expected
|
29
27
|
controllers/
|
30
28
|
views/
|
31
|
-
|
32
|
-
|
29
|
+
config/
|
30
|
+
initializers/ # Initializers can live in packs and load as expected
|
31
|
+
lib/
|
32
|
+
tasks/
|
33
33
|
spec/ # With stimpack, specs for a pack live next to the pack
|
34
34
|
public/
|
35
35
|
my_domain_spec.rb
|
@@ -71,6 +71,17 @@ module MyCoolApp
|
|
71
71
|
end
|
72
72
|
```
|
73
73
|
|
74
|
+
### Splitting routes
|
75
|
+
`stimpack` allows you to split your application routes for every pack. You just have to create a file describing your routes and then `draw` them in your root `config/routes.rb` file.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
# packs/my_domain/config/routes/my_domain.rb
|
79
|
+
resources :my_resource
|
80
|
+
|
81
|
+
# config/routes.rb
|
82
|
+
draw(:my_domain)
|
83
|
+
```
|
84
|
+
|
74
85
|
### Making your Package an Engine
|
75
86
|
Add `engine: true` to your `package.yml` to make it an actual Rails engine:
|
76
87
|
```yml
|
data/bin/tapioca
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'tapioca' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("tapioca", "tapioca")
|
@@ -3,6 +3,13 @@ module Stimpack
|
|
3
3
|
class RSpec
|
4
4
|
def self.install(app)
|
5
5
|
return unless defined?(::RSpec)
|
6
|
+
# Sometimes, the `rspec-rails` gem is installed in the development
|
7
|
+
# group. This means the ::RSpec module will be defined. However, this
|
8
|
+
# doesn't mean that we've loaded rspec-core, or even about to run tests.
|
9
|
+
# Let's make sure we are actually loading the test environment before
|
10
|
+
# installing our integration. An easy of doing this is seeing of the
|
11
|
+
# configuration method exists on RSpec.
|
12
|
+
return unless ::RSpec.respond_to?(:configuration)
|
6
13
|
|
7
14
|
Packs.each do |pack|
|
8
15
|
::RSpec.configuration.pattern.concat(",#{pack.relative_path.join("spec/**/*_spec.rb")}")
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "yaml"
|
4
|
+
|
3
5
|
module Stimpack
|
4
6
|
class Pack
|
5
7
|
class Configuration
|
@@ -17,7 +19,11 @@ module Stimpack
|
|
17
19
|
private
|
18
20
|
|
19
21
|
def data
|
20
|
-
@data ||=
|
22
|
+
@data ||= begin
|
23
|
+
contents = YAML.respond_to?(:safe_load_file) ? YAML.safe_load_file(@path) : YAML.load_file(@path)
|
24
|
+
contents ||= {}
|
25
|
+
contents.fetch(KEY, {}).freeze
|
26
|
+
end
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
data/lib/stimpack/packs.rb
CHANGED
@@ -12,8 +12,9 @@ module Stimpack
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def resolve
|
15
|
-
# Gather all the packs
|
16
|
-
root.
|
15
|
+
# Gather all the parent packs and the children packs.
|
16
|
+
package_locations = root.glob('*/{package.yml,*/package.yml}').map(&:dirname)
|
17
|
+
package_locations.sort!.each do |path|
|
17
18
|
next unless pack = Pack.create(path)
|
18
19
|
@packs[pack.name] = pack
|
19
20
|
end
|
data/lib/stimpack/railtie.rb
CHANGED
@@ -4,6 +4,8 @@ module Stimpack
|
|
4
4
|
class Railtie < Rails::Railtie
|
5
5
|
config.before_configuration do |app|
|
6
6
|
Stimpack.load(app)
|
7
|
+
# This is not used within stimpack. Rather, this allows OTHER tools to
|
8
|
+
# hook into Stimpack via ActiveSupport hooks.
|
7
9
|
ActiveSupport.run_load_hooks(:stimpack, Packs)
|
8
10
|
end
|
9
11
|
end
|
data/lib/stimpack/version.rb
CHANGED
data/lib/stimpack.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ngan Pham
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,7 +52,50 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: debug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sorbet
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: tapioca
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: stimpack establishes and implements a set of conventions for splitting
|
98
|
+
up large monoliths.
|
56
99
|
email:
|
57
100
|
- gusto-opensource-buildkite@gusto.com
|
58
101
|
executables: []
|
@@ -62,6 +105,7 @@ files:
|
|
62
105
|
- README.md
|
63
106
|
- bin/console
|
64
107
|
- bin/setup
|
108
|
+
- bin/tapioca
|
65
109
|
- lib/stimpack.rb
|
66
110
|
- lib/stimpack/integrations.rb
|
67
111
|
- lib/stimpack/integrations/factory_bot.rb
|
@@ -79,7 +123,7 @@ metadata:
|
|
79
123
|
homepage_uri: https://github.com/Gusto/stimpack
|
80
124
|
source_code_uri: https://github.com/Gusto/stimpack
|
81
125
|
changelog_uri: https://github.com/Gusto/stimpack/blob/master/CHANGELOG.md
|
82
|
-
post_install_message:
|
126
|
+
post_install_message:
|
83
127
|
rdoc_options: []
|
84
128
|
require_paths:
|
85
129
|
- lib
|
@@ -94,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
138
|
- !ruby/object:Gem::Version
|
95
139
|
version: '0'
|
96
140
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
-
signing_key:
|
141
|
+
rubygems_version: 3.3.7
|
142
|
+
signing_key:
|
99
143
|
specification_version: 4
|
100
144
|
summary: A Rails helper to package your code.
|
101
145
|
test_files: []
|