console_utils 0.1.0 → 0.1.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
2
  SHA1:
3
- metadata.gz: e5dbc7f627c5c02f9c9075f44a1146e7d35e2039
4
- data.tar.gz: ecc4433de0aaebbf0b7a3bae68939a1773cb8ac5
3
+ metadata.gz: db3cc812c5661b7c40bc42c28bf05b6e76a42edb
4
+ data.tar.gz: 6bd072010709a36781fd9f699ccede62917d1b01
5
5
  SHA512:
6
- metadata.gz: 2fd7b962b54208e49932a4e9ff4caf4005443a10562bc8cac0efab42cabad1d766e2b032f469e39d3d9a22f3d14a066566c1bc4df3486c432d14fe8aa9284332
7
- data.tar.gz: fb9aeb8c86251d0abac713e2e0a61cd103fb6aa2590556eb65200a6f52df6e13badf72f635cd982407915a06089dee0e728e6918c5239554479b4b11aecc29d3
6
+ metadata.gz: d0201a12347ff3f30cda294fcd1e83132aa7ff3309eeb11f780f4982c369bb3cb2ff893c5c7d05eeb82b321aa13cdf34c706a13a25137d45d29694904b3103c4
7
+ data.tar.gz: eb94b91e56d4a1b5739a6789a4487b3a12168a33f081e019bb3f42d3bf6dd2e19dc4570cd601f79077284fcc6810567f1babec89053a9ce69f82c0d1500d5d2e
data/README.md CHANGED
@@ -1,34 +1,36 @@
1
+ [![Code Climate](https://codeclimate.com/github/estum/console_utils/badges/gpa.svg)](https://codeclimate.com/github/estum/console_utils)
2
+
1
3
  # Rails Console Utils
2
4
 
3
5
  ConsoleUtils gem provides several handy tools to use in Rails Console. It includes following modules:
4
6
 
5
- 1. **[RequestUtils](#requestutils)**
6
- the collection of methods to make either local or remote JSON API requests.
7
- Provides response body formatting and auto-token authentication feature
7
+ 1. **[RequestUtils](#requestutils)**
8
+ the collection of methods to make either local or remote JSON API requests.
9
+ Provides response body formatting and auto-token authentication feature
8
10
  (currently supports only params tokens).
9
- 2. **[BenchUtils](#benchutils)**
11
+ 2. **[BenchUtils](#benchutils)**
10
12
  benchmark shorthands
11
- 3. **[ActiveRecordUtils](#activerecordutils)**
13
+ 3. **[ActiveRecordUtils](#activerecordutils)**
12
14
  useful console methods for ActiveRecord::Base models
13
- 4. **[OtherUtils](#otherutils)**
15
+ 4. **[OtherUtils](#otherutils)**
14
16
  uncategorized methods
15
17
 
16
18
  The gem was collected from several **very *(very-very)* raw** modules used in different projects in different time. The code was refactored, but currently there are no specs or complete docs (sowwy ^_^), but they are *coming soon*.
17
19
 
18
20
  ## Installation
19
21
 
20
- Add this lines to your application's Gemfile.
22
+ Add this lines to your application's Gemfile.
21
23
  **Note**: when using with `pry-rails` gem, make sure to depend it before this gem.
22
24
 
23
25
  ```ruby
24
26
  group :development do
25
- \## to enable inspecting procs' sources, uncomment next lines:
26
- \# gem 'term-ansicolor', '1.1.5'
27
- \# gem 'sourcify', '~> 0.6.0.rc4', require: false
28
-
29
- \## when using `pry-rails`, it should be somewhere here:
27
+ ## to enable inspecting procs' sources, uncomment next lines:
28
+ # gem 'term-ansicolor', '1.1.5'
29
+ # gem 'sourcify', '~> 0.6.0.rc4', require: false
30
+
31
+ ## when using `pry-rails`, it should be somewhere here:
30
32
  # gem 'pry-rails'
31
-
33
+
32
34
  gem 'console_utils'
33
35
  end
34
36
  ```
@@ -116,7 +118,7 @@ Just add reports:
116
118
  ```ruby
117
119
  chips.("merge") { the_hash.merge(other_hash) }
118
120
  chips.("merge!") { the_hash.merge!(other_hash) }
119
- \# => x.report(..) { ... }
121
+ # => x.report(..) { ... }
120
122
  ```
121
123
 
122
124
  ... and compare!
@@ -171,7 +173,7 @@ Includes methods to query a random record:
171
173
  User.random # => reorder("RANDOM()")
172
174
  User.anyone # get a random record (like [].sample method)
173
175
  User.active.anyone # works under a scope - get a random active record
174
- User.anyid # get random id of an existing record
176
+ User.anyid # get an id of some existing record
175
177
  ```
176
178
 
177
179
  Also provides shorthand to find any user by id: `usr(id)`
@@ -204,7 +206,7 @@ Converts array to proc with chained calls of items. Every item can be either a m
204
206
  ```ruby
205
207
  the_hash = { :one => "One", :two => "Two", :three => 3, :four => nil }
206
208
  the_hash.select(&[[:[], 1], [:is_a?, String]])
207
- \# => { :one => "One", :two => "Two" }
209
+ # => { :one => "One", :two => "Two" }
208
210
  ```
209
211
 
210
212
  Pretty good, huh? ;)
@@ -214,7 +216,7 @@ See again:
214
216
  ```ruby
215
217
  mapping = { "one" => "1", "two" => "2", "" => "0" }
216
218
  the_hash.values.map(&[:to_s, :downcase, [:sub, /one|two|$^/, mapping]])
217
- \# => ["1", "2", "3", "0"]
219
+ # => ["1", "2", "3", "0"]
218
220
  ```
219
221
 
220
222
  Avoid to use it in production, seriously.
@@ -1,5 +1,3 @@
1
- #:nodoc: all
2
-
3
1
  begin
4
2
  require "sourcify"
5
3
  rescue LoadError
@@ -7,10 +7,10 @@ require "console_utils/version"
7
7
  begin
8
8
  require "awesome_print"
9
9
  rescue LoadError
10
+ else
11
+ require "awesome_print/proc" if defined?(AwesomePrint)
10
12
  end
11
13
 
12
- require "awesome_print/proc" if defined?(AwesomePrint)
13
-
14
14
  # = Rails Console Utils
15
15
  # Collection of utilities to use in Rails Console.
16
16
  #
@@ -112,8 +112,8 @@ module ConsoleUtils::RequestUtils #:nodoc:
112
112
  @_size = nil
113
113
  end
114
114
 
115
- private_constant :REQUEST_METHODS, :AUTOAUTH_FORMAT, :DEFAULT_UID,
116
- :PBCOPY_MESSAGE, :NO_RESPONSE, :COMPLETE_IN, :TRANSFERED,
115
+ private_constant :REQUEST_METHODS, :AUTOAUTH_FORMAT, :PBCOPY_MESSAGE,
116
+ :NO_RESPONSE, :COMPLETE_IN, :TRANSFERED,
117
117
  :INFO_FORMAT
118
118
  # -
119
119
 
@@ -1,3 +1,3 @@
1
1
  module ConsoleUtils
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton