trailblazer-rails 0.2.4 → 2.4.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
- SHA1:
3
- metadata.gz: 93855e0efc7d1d8d2454efdd46583c953f99beab
4
- data.tar.gz: f964147eafc35f2e6d2ce659c46ae5af1defcfc7
2
+ SHA256:
3
+ metadata.gz: 1ac9dffebfdbbac3059ac33b30b6b3fc58958d10af2de83c0113c634e4def667
4
+ data.tar.gz: 74a09ebe5100532430d532c83c69ab5e7dccfe21bf0fdfbbf407af6268652cef
5
5
  SHA512:
6
- metadata.gz: f7f65220a011dca733b6fedb823a4d02cbf8cad0d25fe22c45c57f080e1302c809bfac70b7281c58597651fe25d26a3b864e0e8b7c6ad52f88448c3ada406adb
7
- data.tar.gz: 1e3bef536a79d3bebb4217a7e2513c4199d8da6613dd1b14a196d414dbfbc227155cc68a7b95c90997b56b932b27e75be132cb0ec7519252f4574d502604fb75
6
+ metadata.gz: dfd30ba60691fa98acd40e32498dd75a768a23783fd6f62dbf5fce4cfd67684b35bbf2b6ae384112a1acbad1ac65eb60d1c21d305c24c6c0f98fbefb6ae36a33
7
+ data.tar.gz: e95e9d4e38226bba64a06fb9483e815373ac5ed58ff41d8e5ae279042d5db3feac18e1cec4e06ea1784488d9e01ff044049a3b4472cd0b24f40d84e3a1f4d460
@@ -0,0 +1,32 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ branches:
8
+ - master
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: [2.7, '3.0']
15
+ gemfile:
16
+ - rails_7.0
17
+ - rails_6.1
18
+ - rails_6.0
19
+ - rails_5.2
20
+ exclude:
21
+ - ruby: '3.0'
22
+ gemfile: rails_5.2
23
+ runs-on: ubuntu-latest
24
+ env:
25
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
32
+ - run: bundle exec rake db:create db:schema:load test
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
- /.bundle/
1
+ .idea
2
+ .rakeTasks
3
+ .bundle/
2
4
  /.yardoc
3
5
  /Gemfile.lock
4
6
  /_yardoc/
@@ -7,4 +9,8 @@
7
9
  /pkg/
8
10
  /spec/reports/
9
11
  /tmp/
10
- test/fake_app/log/*.log
12
+ test/**/*.log
13
+ test/**/Gemfile.lock
14
+ *.iml
15
+ *.sqlite3
16
+ .tool-versions
data/Appraisals ADDED
@@ -0,0 +1,19 @@
1
+ appraise "rails-6.0" do
2
+ gem "actionpack", "~> 6.0.0"
3
+ gem "activerecord", "~> 6.0.0"
4
+ end
5
+ appraise "rails-6.1" do
6
+ gem "actionpack", "~> 6.1.0"
7
+ gem "activerecord", "~> 6.1.0"
8
+ end
9
+ appraise "rails-7.0" do
10
+ gem "actionpack", "~> 7.0.0"
11
+ gem "activerecord", "~> 7.0.0"
12
+ gem "sqlite3", "~> 1.4.0"
13
+ end
14
+
15
+ appraise "rails-5.2" do
16
+ gem "actionpack", "~> 5.2.0"
17
+ gem "activerecord", "~> 5.2.0"
18
+ gem "sqlite3", "~> 1.3.8"
19
+ end
data/CHANGES.md CHANGED
@@ -1,3 +1,133 @@
1
+ # 2.4.1
2
+
3
+ * Pass keyword arguments to the success result block
4
+
5
+ # 2.4.0
6
+ * Remove legacy code belonging to the old `trailblazer-loader` gem.
7
+ * Use ActionController::API in addition to ActionController::Base to add the `run` method.
8
+
9
+ # 2.3.0
10
+ * Remove loader support (no longer needed as zeitwerk is now a better alternative)
11
+
12
+ # 2.2.0
13
+
14
+ * Allow passing ctx variables to `Controller#run`.
15
+ * Introduce `Controller#options_for_cell` to customize cell options such as `:layout` on the controller level.
16
+
17
+ # 2.1.9
18
+
19
+ * Drop support for Rails < 5.2
20
+ * Add Test for Rails 6.1
21
+
22
+ # 2.1.7
23
+
24
+ * Bug: Deprecation warning for use_loader always called (fixed)
25
+ * Run rubocop in travis only for ruby 2.5
26
+
27
+ # 2.1.6
28
+
29
+ * Dependency for `railties` >= 4.0.0
30
+ * Config flag use_loader renamed with enable_loader
31
+
32
+ # 2.1.5
33
+
34
+ * Add dependency `railties` >= 5.0.7
35
+ * rename `run` to `run_v21` and alias it to `run` only if it not already defined
36
+
37
+ # 2.1.4
38
+
39
+ * Remove Gemfile.lock in the test folders to make travis CI to work (this time will work!)
40
+
41
+ # 2.1.3
42
+
43
+ * Update Gemfile.lock in the test folders to make travis CI to work again
44
+
45
+ # 2.1.2
46
+
47
+ * `Trailblazer::Rails::Railtie` divided in 2 modules:
48
+ * `Loader` -> require_dependecy `concepts`
49
+ * `ExtendApplicationController` -> include `run` and `render` in controllers
50
+
51
+ # 2.1.1
52
+
53
+ * Fixed issue for rails 5.2rc2 when loading model's files
54
+ * Rubocop introduced
55
+ * Allow enabling tracing when using `run` via `config.trailblazer.enable_tracing = true`
56
+
57
+ # 2.1.0
58
+
59
+ * Drop deprecated syntax for controller `run`
60
+ * Allow disabling of the Trailblazer loader via `config.trailblazer.use_loader = false`
61
+
62
+ # 2.0.0
63
+
64
+ * Support Trailblazer 2.1.0+
65
+ * Drop support for older version of Trailblazer
66
+
67
+ # 1.0.9
68
+
69
+ * `Trailblazer::Rails::Railtie` divided in 2 modules:
70
+ * `Loader` -> require_dependecy `concepts`
71
+ * `ExtendApplicationController` -> include `run` and `render` in controllers
72
+ * Remove Gemfile.lock in the test folders to make travis CI to work
73
+
74
+ # 1.0.8
75
+
76
+ * Fixed Circular dependency detected in rails 5.2
77
+
78
+ # 1.0.7
79
+
80
+ * Fixed typo error in use_loader config flag
81
+
82
+ # 1.0.6 (revoked)
83
+
84
+ * Introduce use_loader config flag
85
+
86
+ # 1.0.5
87
+
88
+ * Hook trailblazer application_controller initializer to finisher_hook
89
+
90
+ # 1.0.4
91
+
92
+ * Make `Railtie::extend_application_controller!` overwriteable via a module.
93
+
94
+ # 1.0.3
95
+
96
+ * Return the computed application controller constant from `Railtie::extend_application_controller!` to make `compat` code simpler.
97
+
98
+ # 1.0.2
99
+
100
+ * Allow configuring `ApplicationController` constant via `config.trailblazer.application_controller`.
101
+
102
+ # 1.0.1
103
+
104
+ * Allow using this gem without `cells,` by loading cells support only when the `cells` gem got detected. Thanks to @promisedlandt.
105
+
106
+ # 1.0.0
107
+
108
+ * Runs only with >= Trailblazer 2.0.0.
109
+ * Removed `Controller#form`, `#present` and `#respond`. The latter is now [replaced with `Endpoint`](https://github.com/trailblazer/trailblazer-endpoint/). The only operation trigger is `Controller#run`.
110
+ * Added support for explicit `render cell(Artist::Cell::Index, model)`.
111
+ * Autoloading got replaced with explicit requires.
112
+
113
+ # 0.4.0
114
+
115
+ * Better engines support.
116
+ * Fix `Responder#errors` by simply removing it and letting `Operation#errors` return the contract errors.
117
+
118
+ # 0.3.2
119
+
120
+ * Make it work with Rails 3.x, again.
121
+
122
+ # 0.3.1
123
+
124
+ * Fix loading of `reform-rails`.
125
+
126
+ # 0.3.0
127
+
128
+ * Require `reform-rails` as a static dependency. This simplifies the user's setup significantly.
129
+ * Run the `Railtie` after `reform.form_extensions` and allow reform-rails to do its setup work, then load concepts.
130
+
1
131
  # 0.2.4
2
132
 
3
133
  * Require `trailblazer-loader-0.0.7`.
data/Gemfile CHANGED
@@ -1,9 +1,15 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in trailblazer-rails.gemspec
4
4
  gemspec
5
5
 
6
- gem "trailblazer", path: "../trailblazer"
7
- # gem "trailblazer", github: "apotonick/trailblazer"
8
- # gem "trailblazer-loader", github: "trailblazer/trailblazer-loader"
9
- # gem "trailblazer-loader", path: "../trailblazer-loader"
6
+ gem "cells-erb"
7
+ gem "cells-rails"
8
+ gem "reform-rails"
9
+ gem "trailblazer"
10
+ gem "trailblazer-cells"
11
+ gem "trailblazer-loader"
12
+ gem "sqlite3"
13
+ gem "minitest-capybara"
14
+
15
+ gem "appraisal"
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Nick Sutterer
3
+ Copyright (c) 2015-2021 Nick Sutterer
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,20 +1,25 @@
1
1
  # Trailblazer::Rails
2
2
 
3
- ## Railtie
3
+ *Trailblazer in your Rails controllers.*
4
4
 
5
+ [![TRB Newsletter](https://img.shields.io/badge/TRB-newsletter-lightgrey.svg)](http://trailblazer.to/newsletter/)
6
+ ![Build
7
+ Status](https://github.com/trailblazer/trailblazer-rails/actions/workflows/ci.yml/badge.svg?branch=master)
8
+ [![Gem Version](https://badge.fury.io/rb/trailblazer-rails.svg)](http://badge.fury.io/rb/trailblazer-rails)
5
9
 
6
- This will go through `app/concepts/`, find all the `crud.rb` files, autoload their corresponding namespace (e.g. `Thing`, which is a model) and then load the `crud.rb` file.
10
+ ## Endpoint
7
11
 
8
- ## Form::model_name
12
+ This gem is slowly being superseded by TRB's [`endpoint` gem](https://trailblazer.to/2.1/docs/endpoint.html). Endpoints are "controller operations" that invoke your business logic operation. They are much easier to use and customize and are explained in part II of the [BUILDALIB book](https://leanpub.com/buildalib).
9
13
 
10
- Automatically sets `model` on operation's contract when `Operation::Model` is included in operation.
14
+ ## Overview
11
15
 
16
+ `trailblazer-rails` helps you with the following.
12
17
 
13
- ## Planned
14
-
15
- * Adds autoloading, etc.
16
- * Automatic rendering of a controller cell instead of primitive view.
18
+ * Running operations in your controller actions.
19
+ * Minimalistic integration tests ("smoke tests") to test controller/operation wiring.
20
+ * Rendering cells instead of an ActionView in a controller action.
17
21
 
22
+ Please refer to the [full documentation for more](https://trailblazer.to/2.1/docs/trailblazer.html#trailblazer-rails).
18
23
 
19
24
  ## Installation
20
25
 
@@ -24,6 +29,13 @@ Add this line to your application's Gemfile:
24
29
  gem 'trailblazer-rails'
25
30
  ```
26
31
 
32
+ Note that the 2.x version only runs with TRB >= 2.1.0.
33
+
34
+ ## Setting flags
35
+
36
+ * `config.trailblazer.enable_loader = false` to disable Trailblazer loader (default TRUE)
37
+ * `config.trailblazer.enable_tracing = true` to enable tracing when using `run` (default FALSE)
38
+
27
39
  ## License
28
40
 
29
41
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,10 +1,18 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
+ ENV["RAILS_ENV"] = "test"
3
4
 
4
5
  Rake::TestTask.new(:test) do |t|
5
6
  t.libs << "test"
6
7
  t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
+ t.test_files = FileList["test/**/*_test.rb"]
8
9
  end
9
10
 
10
- task :default => :test
11
+ begin
12
+ require File.expand_path("test/dummy/config/application", __dir__)
13
+ Rails.application.load_tasks
14
+ rescue LoadError
15
+ end
16
+
17
+ desc "Running Tests"
18
+ task default: :test
data/TESTING.md ADDED
@@ -0,0 +1,9 @@
1
+ Trailblazer-Rails supports rails 5.2.0 and up.
2
+
3
+ To run the tests, you need to have the run the following command:
4
+ ```
5
+ bundle install
6
+ bundle exec appraisal install # This will install the different version of rails
7
+ bundle exec appraisal rake db:create db:schema:load test # Run tests in all versions
8
+ bundle exec appraisal rails-7.0 rake db:create db:schema:load test # Run tests in rails 7.0 only
9
+ ```
@@ -0,0 +1,17 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "cells-erb"
6
+ gem "cells-rails"
7
+ gem "reform-rails"
8
+ gem "trailblazer"
9
+ gem "trailblazer-cells"
10
+ gem "trailblazer-loader"
11
+ gem "sqlite3", "~> 1.3.8"
12
+ gem "minitest-capybara"
13
+ gem "appraisal"
14
+ gem "actionpack", "~> 5.2.0"
15
+ gem "activerecord", "~> 5.2.0"
16
+
17
+ gemspec path: "../"
@@ -0,0 +1,187 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ trailblazer-rails (2.4.1)
5
+ railties (>= 5.2.0)
6
+ trailblazer (>= 2.1.0, < 2.2.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (5.2.6)
12
+ actionview (= 5.2.6)
13
+ activesupport (= 5.2.6)
14
+ rack (~> 2.0, >= 2.0.8)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (5.2.6)
19
+ activesupport (= 5.2.6)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
+ activemodel (5.2.6)
25
+ activesupport (= 5.2.6)
26
+ activerecord (5.2.6)
27
+ activemodel (= 5.2.6)
28
+ activesupport (= 5.2.6)
29
+ arel (>= 9.0)
30
+ activesupport (5.2.6)
31
+ concurrent-ruby (~> 1.0, >= 1.0.2)
32
+ i18n (>= 0.7, < 2)
33
+ minitest (~> 5.1)
34
+ tzinfo (~> 1.1)
35
+ addressable (2.8.0)
36
+ public_suffix (>= 2.0.2, < 5.0)
37
+ appraisal (2.4.1)
38
+ bundler
39
+ rake
40
+ thor (>= 0.14.0)
41
+ arel (9.0.0)
42
+ builder (3.2.4)
43
+ capybara (3.36.0)
44
+ addressable
45
+ matrix
46
+ mini_mime (>= 0.1.3)
47
+ nokogiri (~> 1.8)
48
+ rack (>= 1.6.0)
49
+ rack-test (>= 0.6.3)
50
+ regexp_parser (>= 1.5, < 3.0)
51
+ xpath (~> 3.2)
52
+ cells (4.1.7)
53
+ declarative-builder (< 0.2.0)
54
+ declarative-option (< 0.2.0)
55
+ tilt (>= 1.4, < 3)
56
+ uber (< 0.2.0)
57
+ cells-erb (0.1.0)
58
+ cells (~> 4.0)
59
+ erbse (>= 0.1.1)
60
+ cells-rails (0.1.4)
61
+ actionpack (>= 5.0)
62
+ cells (>= 4.1.6, < 5.0.0)
63
+ concurrent-ruby (1.1.9)
64
+ crass (1.0.6)
65
+ declarative (0.0.20)
66
+ declarative-builder (0.1.0)
67
+ declarative-option (< 0.2.0)
68
+ declarative-option (0.1.0)
69
+ disposable (0.6.2)
70
+ declarative (>= 0.0.9, < 1.0.0)
71
+ representable (>= 3.1.1, < 3.2.0)
72
+ erbse (0.1.4)
73
+ temple
74
+ erubi (1.10.0)
75
+ hashie (5.0.0)
76
+ hirb (0.7.3)
77
+ i18n (1.8.11)
78
+ concurrent-ruby (~> 1.0)
79
+ loofah (2.12.0)
80
+ crass (~> 1.0.2)
81
+ nokogiri (>= 1.5.9)
82
+ matrix (0.4.2)
83
+ method_source (1.0.0)
84
+ mini_mime (1.1.2)
85
+ minitest (5.14.4)
86
+ minitest-capybara (0.9.0)
87
+ capybara
88
+ minitest (~> 5.0)
89
+ rake
90
+ nokogiri (1.12.5-x86_64-darwin)
91
+ racc (~> 1.4)
92
+ nokogiri (1.12.5-x86_64-linux)
93
+ racc (~> 1.4)
94
+ public_suffix (4.0.6)
95
+ racc (1.6.0)
96
+ rack (2.2.3)
97
+ rack-test (1.1.0)
98
+ rack (>= 1.0, < 3)
99
+ rails-dom-testing (2.0.3)
100
+ activesupport (>= 4.2.0)
101
+ nokogiri (>= 1.6)
102
+ rails-html-sanitizer (1.4.2)
103
+ loofah (~> 2.3)
104
+ railties (5.2.6)
105
+ actionpack (= 5.2.6)
106
+ activesupport (= 5.2.6)
107
+ method_source
108
+ rake (>= 0.8.7)
109
+ thor (>= 0.19.0, < 2.0)
110
+ rake (13.0.6)
111
+ reform (2.6.1)
112
+ disposable (>= 0.5.0, < 1.0.0)
113
+ representable (>= 3.1.1, < 3.2.0)
114
+ uber (< 0.2.0)
115
+ reform-rails (0.2.3)
116
+ activemodel (>= 5.0)
117
+ reform (>= 2.3.1, < 3.0.0)
118
+ regexp_parser (2.2.0)
119
+ representable (3.1.1)
120
+ declarative (< 0.1.0)
121
+ trailblazer-option (>= 0.1.1, < 0.2.0)
122
+ uber (< 0.2.0)
123
+ sqlite3 (1.3.13)
124
+ temple (0.8.2)
125
+ thor (1.1.0)
126
+ thread_safe (0.3.6)
127
+ tilt (2.0.10)
128
+ trailblazer (2.1.0)
129
+ trailblazer-macro (>= 2.1.0, < 2.2.0)
130
+ trailblazer-macro-contract (>= 2.1.0, < 2.2.0)
131
+ trailblazer-operation
132
+ trailblazer-activity (0.12.2)
133
+ trailblazer-context (~> 0.5.0)
134
+ trailblazer-option (~> 0.1.0)
135
+ trailblazer-activity-dsl-linear (0.4.3)
136
+ trailblazer-activity (>= 0.12.2, < 0.13.0)
137
+ trailblazer-cells (0.0.3)
138
+ cells (>= 4.1.0.rc1, < 5.0.0)
139
+ trailblazer-context (0.5.0)
140
+ hashie (>= 3.0.0)
141
+ trailblazer-developer (0.0.22)
142
+ hirb
143
+ representable (>= 3.1.1, < 4.0.0)
144
+ trailblazer-activity (>= 0.12.2, < 1.0.0)
145
+ trailblazer-activity-dsl-linear (>= 0.4.1, < 1.0.0)
146
+ trailblazer-loader (0.1.2)
147
+ trailblazer-macro (2.1.7)
148
+ trailblazer-activity-dsl-linear (>= 0.4.0, < 0.5.0)
149
+ trailblazer-operation (>= 0.7.0)
150
+ trailblazer-macro-contract (2.1.1)
151
+ reform (>= 2.2.0, < 3.0.0)
152
+ trailblazer-activity-dsl-linear (>= 0.4.0, < 0.5.0)
153
+ trailblazer-operation (0.7.5)
154
+ trailblazer-activity (>= 0.12.2, < 1.0.0)
155
+ trailblazer-activity-dsl-linear (>= 0.4.1, < 1.0.0)
156
+ trailblazer-developer (>= 0.0.21, < 1.0.0)
157
+ trailblazer-option (0.1.2)
158
+ tzinfo (1.2.9)
159
+ thread_safe (~> 0.1)
160
+ uber (0.1.0)
161
+ xpath (3.2.0)
162
+ nokogiri (~> 1.8)
163
+
164
+ PLATFORMS
165
+ x86_64-darwin-19
166
+ x86_64-darwin-21
167
+ x86_64-linux
168
+
169
+ DEPENDENCIES
170
+ actionpack (~> 5.2.0)
171
+ activerecord (~> 5.2.0)
172
+ appraisal
173
+ bundler
174
+ cells-erb
175
+ cells-rails
176
+ minitest
177
+ minitest-capybara
178
+ rake
179
+ reform-rails
180
+ sqlite3 (~> 1.3.8)
181
+ trailblazer
182
+ trailblazer-cells
183
+ trailblazer-loader
184
+ trailblazer-rails!
185
+
186
+ BUNDLED WITH
187
+ 2.3.11
@@ -0,0 +1,17 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "cells-erb"
6
+ gem "cells-rails"
7
+ gem "reform-rails"
8
+ gem "trailblazer"
9
+ gem "trailblazer-cells"
10
+ gem "trailblazer-loader"
11
+ gem "sqlite3"
12
+ gem "minitest-capybara"
13
+ gem "appraisal"
14
+ gem "actionpack", "~> 6.0.0"
15
+ gem "activerecord", "~> 6.0.0"
16
+
17
+ gemspec path: "../"