rails_console_toolkit 0.5.3 → 0.6.0
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 +4 -4
- data/{.circleci → .github}/config.yml +0 -0
- data/.github/workflows/build.yml +47 -0
- data/README.md +2 -1
- data/lib/rails_console_toolkit/helpers.rb +7 -3
- data/lib/rails_console_toolkit/solidus.rb +8 -8
- data/lib/rails_console_toolkit/version.rb +1 -1
- metadata +4 -4
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7923cd1b5ca7ce01c1a58372c4d568c348c88f0d351aa4d784eef148328c8700
|
4
|
+
data.tar.gz: ea1aaa9db79ced4baee7b73bb9e7652c059f8ca81a585758628bc2087f2e9afc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f64a1c43c9571509e3280e8eee86bccf571046e8a426b6b464d8f4f5eedfd2a643e2d96702f3ccc52182f4c4278b9d39b596f55ce0b9999394c281502f4ef53
|
7
|
+
data.tar.gz: 8c1b5186da25dea915ce02f1f3be6e58c32c115d617bd86f934d193245cdf20027928826e74504cc70bc2a6862cc181448bd6fa3dbd0f9b881faa1bae6602fd3
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
- "*/ci-check"
|
8
|
+
pull_request:
|
9
|
+
branches:
|
10
|
+
- master
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
rake:
|
14
|
+
name: ${{ matrix.combo.name }}
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
combo:
|
19
|
+
- name: current-ruby
|
20
|
+
ruby: 3.0
|
21
|
+
- name: previous-ruby
|
22
|
+
ruby: 2.7
|
23
|
+
- name: older-ruby
|
24
|
+
ruby: 2.6
|
25
|
+
|
26
|
+
runs-on: 'ubuntu-latest'
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.combo.ruby }}
|
32
|
+
bundler-cache: false
|
33
|
+
- run: bundle lock
|
34
|
+
- uses: actions/cache@v2
|
35
|
+
with:
|
36
|
+
path: ./vendor/bundle
|
37
|
+
key: ${{ runner.os }}-${{ matrix.combo.ruby }}-gems-${{ github.ref }}-${{ hashFiles('**/Gemfile.lock') }}
|
38
|
+
restore-keys: |
|
39
|
+
${{ runner.os }}-${{ matrix.combo.ruby }}-gems-${{ github.ref }}
|
40
|
+
${{ runner.os }}-${{ matrix.combo.ruby }}-gems-master
|
41
|
+
${{ runner.os }}-${{ matrix.combo.ruby }}-gems-
|
42
|
+
- name: bundle install
|
43
|
+
run: |
|
44
|
+
bundle config path $PWD/vendor/bundle
|
45
|
+
bundle install --jobs 4 --retry 3
|
46
|
+
bundle clean
|
47
|
+
- run: bundle exec rake
|
data/README.md
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
Find records faster, add custom helpers, improve your console life by 100%.
|
6
6
|
|
7
|
-
[](https://github.com/nebulab/rails_console_toolkit/actions?query=workflow%3Abuild)
|
8
|
+
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
|
@@ -19,14 +19,18 @@ module RailsConsoleToolkit::Helpers
|
|
19
19
|
helper_methods[name.to_sym] = block
|
20
20
|
end
|
21
21
|
|
22
|
-
def model_helper(
|
23
|
-
|
24
|
-
|
22
|
+
def model_helper(klass_name, as: nil, by: nil, cached: true)
|
23
|
+
unless String === klass_name
|
24
|
+
raise TypeError, "The class name is expected to be a String, got #{klass_name.inspect} (#{klass_name.class}) instead."
|
25
|
+
end
|
26
|
+
|
27
|
+
method_name = as || klass_name.gsub('::', '_').underscore
|
25
28
|
attribute_names = by || []
|
26
29
|
|
27
30
|
record = nil # use the closure as a cache
|
28
31
|
|
29
32
|
helper method_name do |key = nil|
|
33
|
+
klass = klass_name.constantize
|
30
34
|
record = nil unless cached
|
31
35
|
|
32
36
|
if key
|
@@ -5,12 +5,12 @@ RailsConsoleToolkit.helper :load_factories do
|
|
5
5
|
Rails::ConsoleMethods.send :include, ::FactoryBot::Syntax::Methods
|
6
6
|
end
|
7
7
|
|
8
|
-
RailsConsoleToolkit.model_helper Spree::Product, as: :product, by: [:slug, :name]
|
9
|
-
RailsConsoleToolkit.model_helper Spree::Variant, as: :variant, by: [:sku]
|
10
|
-
RailsConsoleToolkit.model_helper Spree::Taxon, as: :taxon, by: [:permalink]
|
11
|
-
RailsConsoleToolkit.model_helper Spree::Order, as: :order, by: [:number]
|
12
|
-
RailsConsoleToolkit.model_helper Spree::User, as: :user, by: [:email]
|
13
|
-
RailsConsoleToolkit.model_helper Spree::Country, as: :country, by: [:iso, :iso3, :iso_name, :name]
|
14
|
-
RailsConsoleToolkit.model_helper Spree::Role, as: :role, by: [:name]
|
15
|
-
RailsConsoleToolkit.model_helper Spree::Promotion, as: :promotion, by: [:name]
|
8
|
+
RailsConsoleToolkit.model_helper "Spree::Product", as: :product, by: [:slug, :name]
|
9
|
+
RailsConsoleToolkit.model_helper "Spree::Variant", as: :variant, by: [:sku]
|
10
|
+
RailsConsoleToolkit.model_helper "Spree::Taxon", as: :taxon, by: [:permalink]
|
11
|
+
RailsConsoleToolkit.model_helper "Spree::Order", as: :order, by: [:number]
|
12
|
+
RailsConsoleToolkit.model_helper "Spree::User", as: :user, by: [:email]
|
13
|
+
RailsConsoleToolkit.model_helper "Spree::Country", as: :country, by: [:iso, :iso3, :iso_name, :name]
|
14
|
+
RailsConsoleToolkit.model_helper "Spree::Role", as: :role, by: [:name]
|
15
|
+
RailsConsoleToolkit.model_helper "Spree::Promotion", as: :promotion, by: [:name]
|
16
16
|
RailsConsoleToolkit.alias_helper :promo, :promotion
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_console_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -74,9 +74,9 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".
|
77
|
+
- ".github/config.yml"
|
78
|
+
- ".github/workflows/build.yml"
|
78
79
|
- ".gitignore"
|
79
|
-
- ".travis.yml"
|
80
80
|
- Gemfile
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|