action_args 2.7.1 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +27 -52
- data/Gemfile +24 -0
- data/README.md +2 -2
- data/lib/action_args/abstract_controller.rb +9 -1
- data/lib/action_args/params_handler.rb +2 -0
- data/lib/action_args/version.rb +1 -1
- data/lib/generators/rails/templates/api_controller.rb +51 -0
- data/lib/generators/rails/templates/controller.rb +3 -3
- metadata +4 -12
- data/gemfiles/rails_41.gemfile +0 -16
- data/gemfiles/rails_42.gemfile +0 -16
- data/gemfiles/rails_50.gemfile +0 -15
- data/gemfiles/rails_51.gemfile +0 -15
- data/gemfiles/rails_52.gemfile +0 -15
- data/gemfiles/rails_60.gemfile +0 -16
- data/gemfiles/rails_61.gemfile +0 -16
- data/gemfiles/rails_70.gemfile +0 -17
- data/gemfiles/rails_edge.gemfile +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64423c6ed81fa656828710aa765b9e434226bad08103bbdb6359f5dc94a7039d
|
4
|
+
data.tar.gz: f5d0630db055169bb86a1cff64640e225440f516bdce1082912675b7cd8f6b6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96def3bb5f6cb866492f61377fec76df9ba1a0cbad0f2836107672083a036d0f99a360f277353f916e39318104d9c5fad7a0a7ea16d8b10102a79cc56609ab24
|
7
|
+
data.tar.gz: a18c64b3d4321cd5fcd96ded285ef80cdced877a55a4302881a96f71081690b2b5fd5a396f3baaf0d39a630c0569c1f0c6c135e982c771b82578f606805d4eab
|
data/.github/workflows/main.yml
CHANGED
@@ -1,88 +1,63 @@
|
|
1
1
|
name: build
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
schedule:
|
7
|
+
- cron: '22 22 * * *'
|
4
8
|
|
5
9
|
jobs:
|
6
10
|
build:
|
7
11
|
strategy:
|
8
12
|
matrix:
|
9
|
-
|
10
|
-
|
11
|
-
gemfile: gemfiles/rails_edge.gemfile
|
12
|
-
allow_failures: 'true'
|
13
|
-
- ruby_version: '3.0'
|
14
|
-
gemfile: gemfiles/rails_70.gemfile
|
15
|
-
allow_failures: 'true'
|
16
|
-
- ruby_version: '3.0'
|
17
|
-
gemfile: gemfiles/rails_61.gemfile
|
18
|
-
allow_failures: 'true'
|
19
|
-
|
20
|
-
- ruby_version: '3.0'
|
21
|
-
gemfile: gemfiles/rails_edge.gemfile
|
22
|
-
allow_failures: 'true'
|
23
|
-
- ruby_version: '3.0'
|
24
|
-
gemfile: gemfiles/rails_70.gemfile
|
25
|
-
- ruby_version: '3.0'
|
26
|
-
gemfile: gemfiles/rails_61.gemfile
|
27
|
-
- ruby_version: '3.0'
|
28
|
-
gemfile: gemfiles/rails_60.gemfile
|
29
|
-
|
30
|
-
- ruby_version: jruby
|
31
|
-
gemfile: gemfiles/rails_61.gemfile
|
32
|
-
allow_failures: 'true'
|
33
|
-
- ruby_version: jruby
|
34
|
-
gemfile: gemfiles/rails_70.gemfile
|
35
|
-
allow_failures: 'true'
|
36
|
-
|
37
|
-
- ruby_version: '2.7'
|
38
|
-
gemfile: gemfiles/rails_edge.gemfile
|
39
|
-
allow_failures: 'true'
|
40
|
-
- ruby_version: '2.7'
|
41
|
-
gemfile: gemfiles/rails_70.gemfile
|
42
|
-
- ruby_version: '2.7'
|
43
|
-
gemfile: gemfiles/rails_61.gemfile
|
13
|
+
ruby_version: [ruby-head, '3.2', '3.1', '3.0', '2.7', 'jruby']
|
14
|
+
rails_version: [edge, '7.0', '6.1', '6.0']
|
44
15
|
|
16
|
+
include:
|
17
|
+
- ruby_version: '2.6'
|
18
|
+
rails_version: '6.1'
|
45
19
|
- ruby_version: '2.6'
|
46
|
-
|
20
|
+
rails_version: '6.0'
|
47
21
|
- ruby_version: '2.6'
|
48
|
-
|
22
|
+
rails_version: '5.2'
|
49
23
|
- ruby_version: '2.6'
|
50
|
-
|
24
|
+
rails_version: '5.1'
|
51
25
|
- ruby_version: '2.6'
|
52
|
-
|
26
|
+
rails_version: '5.0'
|
53
27
|
|
54
28
|
- ruby_version: '2.5'
|
55
|
-
|
29
|
+
rails_version: '6.1'
|
56
30
|
- ruby_version: '2.5'
|
57
|
-
|
31
|
+
rails_version: '5.2'
|
58
32
|
|
59
33
|
- ruby_version: '2.4'
|
60
|
-
|
34
|
+
rails_version: '5.2'
|
61
35
|
|
62
36
|
- ruby_version: '2.3'
|
63
|
-
|
37
|
+
rails_version: '5.2'
|
64
38
|
|
65
39
|
- ruby_version: '2.2'
|
66
|
-
|
40
|
+
rails_version: '4.2'
|
67
41
|
- ruby_version: '2.2'
|
68
|
-
|
42
|
+
rails_version: '4.1'
|
69
43
|
|
70
44
|
- ruby_version: '2.1'
|
71
|
-
|
45
|
+
rails_version: '4.2'
|
72
46
|
|
73
|
-
runs-on: ubuntu-
|
47
|
+
runs-on: ubuntu-20.04
|
74
48
|
|
75
49
|
env:
|
76
|
-
|
50
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
77
51
|
|
78
52
|
steps:
|
79
|
-
- uses: actions/checkout@
|
53
|
+
- uses: actions/checkout@v3
|
80
54
|
|
81
55
|
- uses: ruby/setup-ruby@v1
|
82
56
|
with:
|
83
57
|
ruby-version: ${{ matrix.ruby_version }}
|
58
|
+
rubygems: ${{ matrix.ruby_version < '2.6' && 'default' || 'latest' }}
|
84
59
|
bundler-cache: true
|
85
|
-
continue-on-error: ${{ matrix.
|
60
|
+
continue-on-error: ${{ (matrix.ruby_version == 'ruby-head') || (matrix.ruby_version == 'jruby') || (matrix.rails_version == 'edge') }}
|
86
61
|
|
87
62
|
- run: bundle exec rake
|
88
|
-
continue-on-error: ${{ matrix.
|
63
|
+
continue-on-error: ${{ (matrix.ruby_version == 'ruby-head') || (matrix.ruby_version == 'jruby') || (matrix.rails_version == 'edge') }}
|
data/Gemfile
CHANGED
@@ -4,3 +4,27 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in action_args.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
9
|
+
gem 'rails', git: 'https://github.com/rails/rails.git'
|
10
|
+
elsif ENV['RAILS_VERSION']
|
11
|
+
gem 'rails', "~> #{ENV['RAILS_VERSION']}.0"
|
12
|
+
else
|
13
|
+
gem 'rails'
|
14
|
+
end
|
15
|
+
|
16
|
+
rails_version = ENV['RAILS_VERSION'] || '∞'
|
17
|
+
|
18
|
+
platforms :ruby do
|
19
|
+
gem 'sqlite3', rails_version >= '5.1' ? '>= 1.4' : '< 1.4'
|
20
|
+
end
|
21
|
+
platforms :jruby do
|
22
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
23
|
+
end
|
24
|
+
|
25
|
+
gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
|
26
|
+
gem 'loofah', RUBY_VERSION < '2.5' ? '~> 2.20.0' : '>= 2.20'
|
27
|
+
|
28
|
+
gem 'selenium-webdriver' if rails_version >= '6.1'
|
29
|
+
|
30
|
+
gem 'net-smtp' if RUBY_VERSION >= '3.1'
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# action_args
|
2
|
-
[![Build Status](https://github.com/asakusarb/action_args/actions/workflows/main.yml/badge.svg)](https://github.com/asakusarb/action_args/actions
|
2
|
+
[![Build Status](https://github.com/asakusarb/action_args/actions/workflows/main.yml/badge.svg)](https://github.com/asakusarb/action_args/actions)
|
3
3
|
|
4
4
|
Controller action arguments parameterizer for Rails
|
5
5
|
|
@@ -247,7 +247,7 @@ You may notice that
|
|
247
247
|
|
248
248
|
## Supported Versions
|
249
249
|
|
250
|
-
* Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.0.x, 3.1 (trunk), JRuby, & Rubinius with 2.0+ mode
|
250
|
+
* Ruby 2.0.0, 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.0.x, 3.1.x, 3.2.x, 3.3 (trunk), JRuby, & Rubinius with 2.0+ mode
|
251
251
|
|
252
252
|
* Rails 4.1.x, 4.2.x, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1 (edge)
|
253
253
|
|
@@ -6,7 +6,15 @@ using ActionArgs::ParamsHandler
|
|
6
6
|
module ActionArgs
|
7
7
|
module AbstractControllerMethods
|
8
8
|
def send_action(method_name, *args)
|
9
|
-
|
9
|
+
unless args.empty?
|
10
|
+
kwargs = args.extract_options!
|
11
|
+
if kwargs.any?
|
12
|
+
return super(method_name, *args, **kwargs)
|
13
|
+
else
|
14
|
+
return super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
10
18
|
return super if !defined?(params) || params.nil?
|
11
19
|
|
12
20
|
strengthen_params! method_name
|
data/lib/action_args/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
2
|
+
<% if defined? ActionController::StrongParameters -%>
|
3
|
+
permits <%= attributes.map {|a| ":#{a.name}" }.join(', ') %>
|
4
|
+
|
5
|
+
<% end -%>
|
6
|
+
# GET <%= route_url %>
|
7
|
+
def index
|
8
|
+
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
9
|
+
|
10
|
+
render json: <%= "@#{plural_table_name}" %>
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET <%= route_url %>/1
|
14
|
+
def show(id)
|
15
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
|
16
|
+
|
17
|
+
render json: <%= "@#{singular_table_name}" %>
|
18
|
+
end
|
19
|
+
|
20
|
+
# POST <%= route_url %>
|
21
|
+
def create(<%= singular_table_name %>)
|
22
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, singular_table_name) %>
|
23
|
+
|
24
|
+
if @<%= orm_instance.save %>
|
25
|
+
render json: <%= "@#{singular_table_name}" %>, status: :created, location: <%= "@#{singular_table_name}" %>
|
26
|
+
else
|
27
|
+
render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# PATCH/PUT <%= route_url %>/1
|
32
|
+
def update(id, <%= singular_table_name %>)
|
33
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
|
34
|
+
|
35
|
+
<% if orm_instance.respond_to? :update -%>
|
36
|
+
if @<%= orm_instance.update(singular_table_name) %>
|
37
|
+
<% else -%>
|
38
|
+
if @<%= orm_instance.update_attributes(singular_table_name) %>
|
39
|
+
<% end -%>
|
40
|
+
render json: <%= "@#{singular_table_name}" %>
|
41
|
+
else
|
42
|
+
render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# DELETE <%= route_url %>/1
|
47
|
+
def destroy(id)
|
48
|
+
@<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
|
49
|
+
@<%= orm_instance.destroy %>
|
50
|
+
end
|
51
|
+
end
|
@@ -30,11 +30,11 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
30
30
|
if @<%= orm_instance.save %>
|
31
31
|
redirect_to @<%= singular_table_name %>, notice: '<%= human_name %> was successfully created.'
|
32
32
|
else
|
33
|
-
render :new
|
33
|
+
render :new, status: :unprocessable_entity
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
# PUT <%= route_url %>/1
|
37
|
+
# PATCH/PUT <%= route_url %>/1
|
38
38
|
def update(id, <%= singular_table_name %>)
|
39
39
|
@<%= singular_table_name %> = <%= orm_class.find(class_name, 'id') %>
|
40
40
|
|
@@ -45,7 +45,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
45
45
|
<% end -%>
|
46
46
|
redirect_to @<%= singular_table_name %>, notice: '<%= human_name %> was successfully updated.'
|
47
47
|
else
|
48
|
-
render :edit
|
48
|
+
render :edit, status: :unprocessable_entity
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_args
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,21 +67,13 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- action_args.gemspec
|
70
|
-
- gemfiles/rails_41.gemfile
|
71
|
-
- gemfiles/rails_42.gemfile
|
72
|
-
- gemfiles/rails_50.gemfile
|
73
|
-
- gemfiles/rails_51.gemfile
|
74
|
-
- gemfiles/rails_52.gemfile
|
75
|
-
- gemfiles/rails_60.gemfile
|
76
|
-
- gemfiles/rails_61.gemfile
|
77
|
-
- gemfiles/rails_70.gemfile
|
78
|
-
- gemfiles/rails_edge.gemfile
|
79
70
|
- lib/action_args.rb
|
80
71
|
- lib/action_args/abstract_controller.rb
|
81
72
|
- lib/action_args/callbacks.rb
|
82
73
|
- lib/action_args/params_handler.rb
|
83
74
|
- lib/action_args/version.rb
|
84
75
|
- lib/generators/rails/action_args_scaffold_controller_generator.rb
|
76
|
+
- lib/generators/rails/templates/api_controller.rb
|
85
77
|
- lib/generators/rails/templates/controller.rb
|
86
78
|
homepage: http://asakusa.rubyist.net/
|
87
79
|
licenses:
|
@@ -103,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
95
|
- !ruby/object:Gem::Version
|
104
96
|
version: '0'
|
105
97
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.5.0.dev
|
107
99
|
signing_key:
|
108
100
|
specification_version: 4
|
109
101
|
summary: Controller action arguments parameterizer for Rails 4+ & Ruby 2.0+
|
data/gemfiles/rails_41.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 4.1.0'
|
6
|
-
gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
|
7
|
-
|
8
|
-
gemspec :path => '../'
|
9
|
-
|
10
|
-
platforms :ruby do
|
11
|
-
gem 'sqlite3', '~> 1.3.6'
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :jruby do
|
15
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
-
end
|
data/gemfiles/rails_42.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 4.2.0'
|
6
|
-
gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
|
7
|
-
|
8
|
-
gemspec :path => '../'
|
9
|
-
|
10
|
-
platforms :ruby do
|
11
|
-
gem 'sqlite3', '~> 1.3.6'
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :jruby do
|
15
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
-
end
|
data/gemfiles/rails_50.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 5.0.1'
|
6
|
-
|
7
|
-
gemspec :path => '../'
|
8
|
-
|
9
|
-
platforms :ruby do
|
10
|
-
gem 'sqlite3', '~> 1.3.6'
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :jruby do
|
14
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
15
|
-
end
|
data/gemfiles/rails_51.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 5.1.0'
|
6
|
-
|
7
|
-
gemspec :path => '../'
|
8
|
-
|
9
|
-
platforms :ruby do
|
10
|
-
gem 'sqlite3', '~> 1.3.6'
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :jruby do
|
14
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
15
|
-
end
|
data/gemfiles/rails_52.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 5.2.0'
|
6
|
-
|
7
|
-
gemspec :path => '../'
|
8
|
-
|
9
|
-
platforms :ruby do
|
10
|
-
gem 'sqlite3', '~> 1.3.6'
|
11
|
-
end
|
12
|
-
|
13
|
-
platforms :jruby do
|
14
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
15
|
-
end
|
data/gemfiles/rails_60.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 6.0.0'
|
6
|
-
gem 'selenium-webdriver'
|
7
|
-
|
8
|
-
gemspec path: '../'
|
9
|
-
|
10
|
-
platforms :ruby do
|
11
|
-
gem 'sqlite3'
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :jruby do
|
15
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
-
end
|
data/gemfiles/rails_61.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 6.1.0'
|
6
|
-
gem 'selenium-webdriver'
|
7
|
-
|
8
|
-
gemspec path: '../'
|
9
|
-
|
10
|
-
platforms :ruby do
|
11
|
-
gem 'sqlite3'
|
12
|
-
end
|
13
|
-
|
14
|
-
platforms :jruby do
|
15
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
16
|
-
end
|
data/gemfiles/rails_70.gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
gem 'rails', '~> 7.0.0'
|
6
|
-
gem 'net-smtp'
|
7
|
-
gem 'selenium-webdriver'
|
8
|
-
|
9
|
-
gemspec path: '../'
|
10
|
-
|
11
|
-
platforms :ruby do
|
12
|
-
gem 'sqlite3'
|
13
|
-
end
|
14
|
-
|
15
|
-
platforms :jruby do
|
16
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
17
|
-
end
|
data/gemfiles/rails_edge.gemfile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
git_source(:github) do |repo_name|
|
5
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
6
|
-
"https://github.com/#{repo_name}.git"
|
7
|
-
end
|
8
|
-
|
9
|
-
gem 'rails', github: 'rails/rails'
|
10
|
-
gem 'net-smtp'
|
11
|
-
gem 'selenium-webdriver'
|
12
|
-
|
13
|
-
gemspec :path => '../'
|
14
|
-
|
15
|
-
platforms :ruby do
|
16
|
-
gem 'sqlite3'
|
17
|
-
end
|
18
|
-
|
19
|
-
platforms :jruby do
|
20
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
21
|
-
end
|