trailblazer 0.3.3 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGES.md +12 -0
- data/Gemfile +2 -1
- data/README.md +73 -38
- data/Rakefile +1 -1
- data/lib/trailblazer/autoloading.rb +4 -1
- data/lib/trailblazer/endpoint.rb +7 -13
- data/lib/trailblazer/operation.rb +54 -40
- data/lib/trailblazer/operation/builder.rb +26 -0
- data/lib/trailblazer/operation/collection.rb +1 -2
- data/lib/trailblazer/operation/controller.rb +36 -48
- data/lib/trailblazer/operation/dispatch.rb +11 -11
- data/lib/trailblazer/operation/model.rb +50 -0
- data/lib/trailblazer/operation/model/dsl.rb +29 -0
- data/lib/trailblazer/operation/model/external.rb +34 -0
- data/lib/trailblazer/operation/policy.rb +87 -0
- data/lib/trailblazer/operation/policy/guard.rb +34 -0
- data/lib/trailblazer/operation/representer.rb +33 -12
- data/lib/trailblazer/operation/resolver.rb +30 -0
- data/lib/trailblazer/operation/responder.rb +0 -1
- data/lib/trailblazer/operation/worker.rb +24 -7
- data/lib/trailblazer/version.rb +1 -1
- data/test/collection_test.rb +2 -1
- data/test/{crud_test.rb → model_test.rb} +17 -35
- data/test/operation/builder_test.rb +41 -0
- data/test/operation/dsl/callback_test.rb +108 -0
- data/test/operation/dsl/contract_test.rb +104 -0
- data/test/operation/dsl/representer_test.rb +143 -0
- data/test/operation/external_model_test.rb +71 -0
- data/test/operation/guard_test.rb +97 -0
- data/test/operation/policy_test.rb +97 -0
- data/test/operation/resolver_test.rb +83 -0
- data/test/operation_test.rb +7 -75
- data/test/rails/__respond_test.rb +20 -0
- data/test/rails/controller_test.rb +4 -102
- data/test/rails/endpoint_test.rb +7 -47
- data/test/rails/fake_app/controllers.rb +16 -21
- data/test/rails/fake_app/rails_app.rb +5 -0
- data/test/rails/fake_app/song/operations.rb +11 -4
- data/test/rails/respond_test.rb +95 -0
- data/test/responder_test.rb +6 -6
- data/test/rollback_test.rb +2 -2
- data/test/worker_test.rb +13 -9
- data/trailblazer.gemspec +2 -2
- metadata +38 -15
- data/lib/trailblazer/operation/crud.rb +0 -82
- data/lib/trailblazer/rails/railtie.rb +0 -34
- data/test/rails/fake_app/views/bands/show.html.erb +0 -1
@@ -1,34 +0,0 @@
|
|
1
|
-
module Trailblazer
|
2
|
-
class Railtie < Rails::Railtie
|
3
|
-
def self.autoload_operations(app)
|
4
|
-
Dir.glob("app/concepts/**/crud.rb") do |f|
|
5
|
-
path = f.sub("app/concepts/", "")
|
6
|
-
model = path.sub("/crud.rb", "")
|
7
|
-
|
8
|
-
require_dependency "#{app.root}/app/models/#{model}" # load the model file, first (thing.rb).
|
9
|
-
require_dependency "#{app.root}/#{f}" # load app/concepts/{concept}/crud.rb (Thing::Create, Thing::Update, and so on).
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.autoload_cells(app)
|
14
|
-
Dir.glob("app/concepts/**/*cell.rb") do |f|
|
15
|
-
require_dependency "#{app.root}/#{f}" # load app/concepts/{concept}/cell.rb.
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# This is to autoload Operation::Dispatch, etc. I'm simply assuming people find this helpful in Rails.
|
20
|
-
initializer "trailblazer.library_autoloading" do
|
21
|
-
require "trailblazer/autoloading"
|
22
|
-
end
|
23
|
-
|
24
|
-
# thank you, http://stackoverflow.com/a/17573888/465070
|
25
|
-
initializer 'trailblazer.install', after: :load_config_initializers do |app|
|
26
|
-
# the trb autoloading has to be run after initializers have been loaded, so we can tweak inclusion of features in
|
27
|
-
# initializers.
|
28
|
-
ActionDispatch::Reloader.to_prepare do
|
29
|
-
Trailblazer::Railtie.autoload_operations(app)
|
30
|
-
Trailblazer::Railtie.autoload_cells(app)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
bands/show.html: <%= [@klass, @model.class, @form.is_a?(Reform::Form), @operation.class, @locality].join(",") %>
|