stimpack 1.0.0.alpha2 → 1.0.0.alpha3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f1a2559d1ce6dbda9c791511625886e294c42ae3cd1d4b14181650ce9e172f7
4
- data.tar.gz: ed17d0246bd96094171f8b37fdf7d796eae515470ed5196df858814efed245bc
3
+ metadata.gz: 0ea2ffb8a9efd6a3cbfa52d91072a1a1f7d4c853bcd7f0caed17d67565941c3d
4
+ data.tar.gz: fb9a47e3e6fcf899979d161e1859560dc28d0c9317316e551205cddb08c772fa
5
5
  SHA512:
6
- metadata.gz: b97dfda1cc33019bb5c763499b6b40e21b5d9494c2c8b4e72c965c587af2c343ea3893006866f8fa3f13a873e81f7a55125fb66429ac444cc71e0387885aa965
7
- data.tar.gz: bea0f9d029b0d1b09f3ec7e6b84b137f995d4683198bde2e3fbcd1635521d7bd176b2de5893463466bca8b51fb13969bf64cdf732fee1183d1adcbe0251f066e
6
+ metadata.gz: 8a69a1f67af1db2eabaab480ad380330f0d0d35e95a1ab552a5303a9dec4c5956547b4c134d5af1b70758f712b3203aa327729b48a6d0d7e54d2db8ee135164a
7
+ data.tar.gz: 0bf2816d1acd26f852caaa4399bd3feaad5b4c30ab4b15065291dfcf1c00571c7cbb08fae92664e52a6732ad998ec08d1cc375330cd53f7b731bc0b4fef400fb
data/lib/stimpack.rb CHANGED
@@ -4,13 +4,13 @@ require "rails"
4
4
  module Stimpack
5
5
  extend ActiveSupport::Autoload
6
6
 
7
- autoload :Integrations
7
+ # autoload :Require
8
8
  autoload :Autoloaders
9
+ autoload :Integrations
9
10
  autoload :Packs
11
+ autoload :Railtie
10
12
  autoload :Settings
11
13
  autoload :Stim
12
- autoload :Railtie
13
- # autoload :Require
14
14
  autoload :ZeitwerkProxy
15
15
 
16
16
  class Error < StandardError; end
@@ -5,7 +5,6 @@ require "rails"
5
5
  module Stimpack
6
6
  module Packs
7
7
  PATH = Pathname.new("packs").freeze
8
- PACK_CLASS = "Pack".freeze
9
8
 
10
9
  class << self
11
10
  def resolve
@@ -16,9 +15,9 @@ module Stimpack
16
15
  end
17
16
 
18
17
  def create(name, path)
19
- namespace = create_namespace(name)
18
+ pack_class = ActiveSupport::Inflector.camelize(name).gsub("::", "_")
20
19
  stim = Stim.new(path)
21
- @packs[name] = namespace.const_set(PACK_CLASS, Class.new(Rails::Engine)).include(stim)
20
+ @packs[name] = const_set(pack_class, Class.new(Rails::Engine)).include(stim)
22
21
  end
23
22
 
24
23
  def find(path)
@@ -36,19 +35,6 @@ module Stimpack
36
35
  def each(*args, &block)
37
36
  @packs.each_value(*args, &block)
38
37
  end
39
-
40
- private
41
-
42
- def create_namespace(name)
43
- namespace = ActiveSupport::Inflector.camelize(name)
44
- namespace.split("::").reduce(Object) do |base, mod|
45
- if base.const_defined?(mod)
46
- base.const_get(mod)
47
- else
48
- base.const_set(mod, Module.new)
49
- end
50
- end
51
- end
52
38
  end
53
39
 
54
40
  @packs = {}
@@ -33,7 +33,7 @@ module Stimpack
33
33
  # alias_method :implicit_namespace?, :implicit_namespace
34
34
 
35
35
  def isolate_namespace
36
- @config.fetch("isolate_namespace", true)
36
+ @config.fetch("isolate_namespace", false)
37
37
  end
38
38
  alias_method :isolate_namespace?, :isolate_namespace
39
39
  end
@@ -1,3 +1,3 @@
1
1
  module Stimpack
2
- VERSION = "1.0.0.alpha2".freeze
2
+ VERSION = "1.0.0.alpha3".freeze
3
3
  end
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: 1.0.0.alpha2
4
+ version: 1.0.0.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-20 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -64,13 +64,10 @@ files:
64
64
  - bin/setup
65
65
  - lib/stimpack.rb
66
66
  - lib/stimpack/autoloaders.rb
67
- - lib/stimpack/instance.rb
68
67
  - lib/stimpack/integrations.rb
69
68
  - lib/stimpack/integrations/factory_bot.rb
70
69
  - lib/stimpack/integrations/rspec.rb
71
70
  - lib/stimpack/kernel.rb
72
- - lib/stimpack/package.rb
73
- - lib/stimpack/packages.rb
74
71
  - lib/stimpack/packs.rb
75
72
  - lib/stimpack/railtie.rb
76
73
  - lib/stimpack/require.rb
@@ -1,14 +0,0 @@
1
- require "pathname"
2
- require "active_support/inflector"
3
-
4
- module Stimpack
5
- class Instance
6
- def initialize
7
- Pathname.new("packages").glob("*/package.yml").each do |path|
8
- path = path.realpath.dirname
9
- name = ActiveSupport::Inflector.classify(path.basename)
10
- Stimpack::Packages.create(name, path)
11
- end
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- require "rails"
2
- require "active_support/core_ext/module/delegation"
3
-
4
- module Stimpack
5
- class Package < ::Rails::Engine
6
- class << self
7
- delegate :subclasses, to: :superclass
8
-
9
- def find_root(from)
10
- Packages.paths[module_parent.name]
11
- end
12
- end
13
- end
14
- end
@@ -1,35 +0,0 @@
1
- require "rails"
2
-
3
- module Stimpack
4
- module Packages
5
- def self.paths
6
- @paths ||= {}
7
- end
8
-
9
- def self.create(name, path)
10
- paths[name] = path
11
-
12
- class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
13
- module ::#{name}
14
- class Engine < ::Stimpack::Package
15
- end
16
- end
17
- RUBY
18
-
19
- engine = const_get("::#{name}::Engine")
20
- # Isolate the package namespace.
21
- engine.isolate_namespace(engine.module_parent)
22
-
23
- # Disable Railtie initializers for Packages.
24
- engine.paths["config/initializers"] = nil
25
-
26
- engine.paths["lib/tasks"] = "tasks"
27
- engine.paths["db/migrate"] = "migrations"
28
- engine.paths["config/routes.rb"] = "routes.rb"
29
-
30
- if engine.paths["db/migrate"].existent.any?
31
- ActiveRecord::Migrator.migrations_paths << engine.paths["db/migrate"].first
32
- end
33
- end
34
- end
35
- end