rails_console_toolkit 0.1.0 → 0.2.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/config.yml +32 -0
- data/README.md +7 -4
- data/lib/rails_console_toolkit.rb +5 -7
- data/lib/rails_console_toolkit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 223e8d9bdedf22d2c25b6c515df5af7fe8f33980318bd87888a92e21b5d54cb7
|
4
|
+
data.tar.gz: c27d78e827bdb5528a7a05dd9a8c452ea63952655dc85fd20fa0bb0a340f21d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 040261a34dd02e4685b5b3df338d9b3a9d728192696a2923a9195ae1766643794eaf67b5ec42629807ddf53cef1b134b85e3a8c250b49584cf4983e412218a81
|
7
|
+
data.tar.gz: 84546672daa15fb371d058785cfb12bcd22feab96990d2608c379fe94ee6d1c08bfb70a9379e179b3d61a04c226992aad2ae21b40b0a0462427ef5187b2100d7
|
@@ -0,0 +1,32 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.6
|
6
|
+
|
7
|
+
working_directory: ~/repo
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
|
12
|
+
- restore_cache:
|
13
|
+
keys:
|
14
|
+
- v1-dependencies-{{ checksum "Gemfile" }}
|
15
|
+
- v1-dependencies-
|
16
|
+
|
17
|
+
- run:
|
18
|
+
name: install dependencies
|
19
|
+
command: |
|
20
|
+
gem install bundler
|
21
|
+
bundle update --jobs=4 --retry=3 --path tmp/bundle || \
|
22
|
+
bundle install --jobs=4 --retry=3 --path tmp/bundle
|
23
|
+
|
24
|
+
- save_cache:
|
25
|
+
paths:
|
26
|
+
- ./tmp/bundle
|
27
|
+
key: v1-dependencies-{{ checksum "Gemfile" }}
|
28
|
+
|
29
|
+
- run:
|
30
|
+
name: run tests
|
31
|
+
command: |
|
32
|
+
bundle exec rake
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
Find records faster, add custom helpers, improve your console life by 100%.
|
6
6
|
|
7
|
+
[](https://circleci.com/gh/nebulab/rails_console_toolkit)
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
@@ -42,7 +44,7 @@ require 'rails_console_toolkit/aliases'
|
|
42
44
|
```ruby
|
43
45
|
# config/initializers/console.rb
|
44
46
|
|
45
|
-
require 'rails_console_toolkit/
|
47
|
+
require 'rails_console_toolkit/utils'
|
46
48
|
```
|
47
49
|
|
48
50
|
```
|
@@ -59,7 +61,7 @@ foo (3000.6ms)
|
|
59
61
|
```ruby
|
60
62
|
# config/initializers/console.rb
|
61
63
|
|
62
|
-
require 'rails_console_toolkit/
|
64
|
+
require 'rails_console_toolkit/solidus'
|
63
65
|
```
|
64
66
|
|
65
67
|
```
|
@@ -171,5 +173,6 @@ This project is funded and maintained by the [Nebulab][nebulab] team.
|
|
171
173
|
We firmly believe in the power of open-source. [Contact us][contact-us] if you
|
172
174
|
like our work and you need help with your project design or development.
|
173
175
|
|
174
|
-
[nebulab]:
|
175
|
-
[nebulab-logo]:
|
176
|
+
[nebulab]: https://nebulab.it/
|
177
|
+
[nebulab-logo]: https://nebulab.it/assets/images/public/logo.svg
|
178
|
+
[contact-us]: https://nebulab.it/contact-us/
|
@@ -6,11 +6,11 @@ module RailsConsoleToolkit
|
|
6
6
|
|
7
7
|
class Error < StandardError; end
|
8
8
|
|
9
|
-
def install!
|
9
|
+
def install!(target_module = Rails::ConsoleMethods)
|
10
10
|
require 'rails/console/app'
|
11
11
|
|
12
12
|
helper_methods.each do |name, block|
|
13
|
-
|
13
|
+
target_module.define_method(name, &block)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -27,13 +27,11 @@ module RailsConsoleToolkit
|
|
27
27
|
record = nil # use the closure as a cache
|
28
28
|
|
29
29
|
helper method_name do |key = nil|
|
30
|
-
unless cached
|
31
|
-
record = nil
|
32
|
-
raise("missing key for #{key}") unless key
|
33
|
-
end
|
30
|
+
record = nil unless cached
|
34
31
|
|
35
32
|
if key
|
36
|
-
record
|
33
|
+
record = nil
|
34
|
+
record ||= klass.find(key) if Numeric === key
|
37
35
|
attribute_names.find { |name| record ||= klass.find_by(name => key) }
|
38
36
|
end
|
39
37
|
|
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.2.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: 2019-
|
11
|
+
date: 2019-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -74,6 +74,7 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".circleci/config.yml"
|
77
78
|
- ".gitignore"
|
78
79
|
- ".travis.yml"
|
79
80
|
- Gemfile
|