contex 0.0.1 → 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: e245bc296ac3c2f7c223632504c157f8a389936edac6eb9a492479eac801a685
4
- data.tar.gz: 91bae85023f540ceecab9aa563cf84f5d83d6d86bed1d8323db4538427033443
3
+ metadata.gz: 753c7606ba8f5f0db765a14eb2d3722f75beca34ea78f402a70e47652c5d810a
4
+ data.tar.gz: 86a890f462dac5d07f4037d0fc55b2e3514df8a15992b4b2cf6b3de15e5af819
5
5
  SHA512:
6
- metadata.gz: 60cd130fd01be41f59c9a990bbc299fa72fe735f82ce123211428a113adf0c732dd3fd3c63fbf0242ebf90d7661f05444dbdca6f99f90ccb4be1ae4ef69ab303
7
- data.tar.gz: cb18640df6b56f1e4d044b6170309ce7831d80ef5abeb8dfe57732f543c3ff19922490e802a89bbd102e2f4409f0b6df837bc4d068988db433183369ab1e498f
6
+ metadata.gz: ab5f871d26af666a0b32821cd7b5aa054e28d006a169a4b48483c09bea03848a094a6c04ca446faf0e4ec8cda7e942406d0358385a2d1838a8a9cd3c3bc5d681
7
+ data.tar.gz: 389f620b28c4fbedb23a4930da0c1c6bf80e28a2a027e527fbda6a8a06dca06a7322c61dce3d3ca2a65888064a4d9aedf5cbdb4ec594cd98e2e3bd34052ed491
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in contex.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 tmartin314
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Contex
2
+
3
+ An opinionated, bounded context library for Rails.
4
+
5
+ Currently a WIP
6
+
7
+ # TODO
8
+ - add specs
9
+ - flesh out details for assets/webpacker
10
+ - test against different rails versions
11
+ - get reloader working for context paths
12
+
13
+ ## Contributing
14
+
15
+ Bug reports and pull requests are welcome on GitHub at https://github.com/devato/contex
16
+
17
+ ## License
18
+
19
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
20
+
21
+
22
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "contex"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/contex.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "contex/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "contex"
7
+ spec.version = Contex::VERSION
8
+ spec.authors = ["Troy Martin"]
9
+ spec.email = ["troy@devato.com"]
10
+
11
+ spec.summary = %q{An opinionated, bounded context library for Rails.}
12
+ spec.description = %q{An opinionated, bounded context library for Rails.}
13
+ spec.homepage = "https://github.com/devato/contex"
14
+ spec.license = "MIT"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/devato/contex"
18
+ spec.metadata["changelog_uri"] = "https://github.com/devato/contex"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.17"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ spec.add_dependency 'wisper', '~> 2.0'
33
+ spec.add_dependency 'draper', '~> 3.0'
34
+ end
data/lib/contex.rb CHANGED
@@ -1,2 +1,5 @@
1
- class Contex
2
- end
1
+ require "contex/version"
2
+ require "contex/railtie-routes"
3
+ require "contex/railtie-preload"
4
+ require "contex/railtie-postload"
5
+ require "contex/repo"
@@ -0,0 +1,11 @@
1
+ module Contex
2
+ class RailtiePostload < Rails::Railtie
3
+ initializer 'rails_context.postload' do |app|
4
+ contexts = Dir[Rails.root.join("app/contexts/*").to_s]
5
+ path_rejector = lambda { |s| s == Rails.root.join('app', 'contexts').to_s }
6
+ app.config.eager_load_paths = app.config.eager_load_paths.reject(&path_rejector)
7
+ ActiveSupport::Dependencies.autoload_paths.reject!(&path_rejector)
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,14 @@
1
+ module Contex
2
+ class RailtieAutoload < Rails::Railtie
3
+ initializer 'rails_context.autoload', before: :set_autoload_paths do |app|
4
+ contexts = Dir[Rails.root.join("app/contexts/*").to_s]
5
+ contexts.each do |context|
6
+ app.config.paths.add "#{context}/controllers", eager_load: true
7
+ app.config.paths.add "#{context}/services", eager_load: true
8
+ app.config.paths.add "#{context}/views", eager_load: true
9
+ app.config.paths.add "#{context}/repo", eager_load: true
10
+ app.config.paths["app/views"].unshift("#{context}/views")
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ module Contex
2
+ class RailtieRoutes < Rails::Railtie
3
+ initializer 'rails_context.routes', before: :set_autoload_paths do |app|
4
+ routes = Dir[Rails.root.join("app/contexts/**/config/routes.rb").to_s]
5
+ app.routes_reloader.paths.unshift(*routes)
6
+ app.config.paths["config/routes.rb"].concat(routes)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Contex
2
+ module Repo
3
+ def call(*args)
4
+ new(*args).call
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Contex
2
+ VERSION = "0.1.1"
3
+ end
metadata CHANGED
@@ -1,26 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Troy Martin
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2018-12-18 00:00:00.000000000 Z
12
- dependencies: []
13
- description: An opinionated bounded context gem
14
- email: troy@evato.com
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: wisper
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: draper
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: An opinionated, bounded context library for Rails.
84
+ email:
85
+ - troy@devato.com
15
86
  executables: []
16
87
  extensions: []
17
88
  extra_rdoc_files: []
18
89
  files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - bin/console
96
+ - bin/setup
97
+ - contex.gemspec
19
98
  - lib/contex.rb
20
- homepage: http://rubygems.org/gems/contex
99
+ - lib/contex/railtie-postload.rb
100
+ - lib/contex/railtie-preload.rb
101
+ - lib/contex/railtie-routes.rb
102
+ - lib/contex/repo.rb
103
+ - lib/contex/version.rb
104
+ homepage: https://github.com/devato/contex
21
105
  licenses:
22
106
  - MIT
23
- metadata: {}
107
+ metadata:
108
+ homepage_uri: https://github.com/devato/contex
109
+ source_code_uri: https://github.com/devato/contex
110
+ changelog_uri: https://github.com/devato/contex
24
111
  post_install_message:
25
112
  rdoc_options: []
26
113
  require_paths:
@@ -40,5 +127,5 @@ rubyforge_project:
40
127
  rubygems_version: 2.7.6
41
128
  signing_key:
42
129
  specification_version: 4
43
- summary: Contex Gem
130
+ summary: An opinionated, bounded context library for Rails.
44
131
  test_files: []