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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c63ae0fa9d97e7519b9e84c9ccaec90f2be8f5cfef5e8b25729debfe5d0dd374
4
- data.tar.gz: 8de43d13ff473dee04f9130f9d22497412a3a67dc77fa7d7bdfb2fbfaefa94c1
3
+ metadata.gz: 223e8d9bdedf22d2c25b6c515df5af7fe8f33980318bd87888a92e21b5d54cb7
4
+ data.tar.gz: c27d78e827bdb5528a7a05dd9a8c452ea63952655dc85fd20fa0bb0a340f21d3
5
5
  SHA512:
6
- metadata.gz: aa3fe513e335e98f6c498969dc442847533efffa87536801e3bdcc3626c6f4e0b3b19fa87fedfd436b4a8f9d2da3e8f2fa2636b0913c237a84d071215f9b98f5
7
- data.tar.gz: d9e67100e2b6619bf69f8ce170a6e7325cd85e20e2109eefe479869f1b416c2ebe06a83a61ee44b7af921e7c16191d1fe3f925b4a89d26150349db1a6c47dc3b
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
+ [![CircleCI](https://img.shields.io/circleci/build/github/nebulab/rails_console_toolkit/master?logo=circleci)](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/aliases'
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/aliases'
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]: http://nebulab.it/
175
- [nebulab-logo]: http://nebulab.it/assets/images/public/logo.svg
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
- Rails::ConsoleMethods.define_method(name, &block)
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 ||= klass.find(key) if key.is_a? Numeric
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
 
@@ -1,3 +1,3 @@
1
1
  module RailsConsoleToolkit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-07-05 00:00:00.000000000 Z
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