super_awesome_print 0.1.1 → 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/README.md +13 -2
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/lib/super_awesome_print.rb +44 -7
- data/lib/super_awesome_print/configuration.rb +9 -0
- data/lib/super_awesome_print/version.rb +1 -1
- data/super_awesome_print.gemspec +12 -12
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f278fe4412a4ff7d18230b15cd8d5a36780ce476
|
4
|
+
data.tar.gz: 814ec19746437935d831a4ffcc1748ec4cf0b26a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d59f52d0c7aa9e9bf3213fe13c038ddae55c4df0fe76e69171cc90355678423b8d71d0f34086af5af2d43e1f8e0427ffaf09b69234f877d9d981e87ed3320a
|
7
|
+
data.tar.gz: ac5cc4430a541b092e4eaa3d161ad9a14af26c59955566c581281c44abe580cc54020cd0c2506447ccef24099f63aded79c825fcc98fd5a5d984e33e85568d83
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
Add this line to your application's Gemfile:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem 'super_awesome_print'
|
18
|
+
gem 'super_awesome_print'
|
19
19
|
```
|
20
20
|
|
21
21
|
And then execute:
|
@@ -26,6 +26,17 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
$ gem install super_awesome_print
|
28
28
|
|
29
|
+
You can optionally customize configuration in an initializer.<br/>
|
30
|
+
In Rails, you can add the following to `config/initializers/super_awesome_print.rb`:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
SuperAwesomePrint.configure do |config|
|
34
|
+
config.caller_lines = 3 # defaults to 1
|
35
|
+
config.blank_lines_top = 2 # defaults to 0
|
36
|
+
config.blank_lines_bottom = 2 # defaults to 0
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
29
40
|
## Usage
|
30
41
|
|
31
42
|
Just use `sap` global function to print any variable.
|
@@ -38,7 +49,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
38
49
|
|
39
50
|
## Contributing
|
40
51
|
|
41
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/olegantonyan/super_awesome_print. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://www.contributor-covenant.org) code of conduct.
|
42
53
|
|
43
54
|
|
44
55
|
## License
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'super_awesome_print'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "super_awesome_print"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/lib/super_awesome_print.rb
CHANGED
@@ -1,13 +1,50 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'super_awesome_print/version'
|
2
|
+
require 'super_awesome_print/configuration'
|
3
|
+
require 'awesome_print'
|
3
4
|
|
4
|
-
def sap
|
5
|
-
|
6
|
-
|
7
|
-
ap
|
5
|
+
def sap(msg)
|
6
|
+
SuperAwesomePrint.blank_lines_top
|
7
|
+
ap "*** #{Time.now} ***", color: { string: :green }
|
8
|
+
ap msg.class if msg.respond_to?(:class)
|
9
|
+
SuperAwesomePrint.print_caller_lines(caller)
|
8
10
|
ap msg
|
9
|
-
ap '*** END ***', color: {string: :green}
|
11
|
+
ap '*** END ***', color: { string: :green }
|
12
|
+
SuperAwesomePrint.blank_lines_bottom
|
10
13
|
end
|
11
14
|
|
12
15
|
module SuperAwesomePrint
|
16
|
+
class << self
|
17
|
+
attr_writer :configuration
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.print_caller_lines(caller_array)
|
21
|
+
number_of_lines = config.caller_lines
|
22
|
+
lines = caller_array[0...number_of_lines].map do |line|
|
23
|
+
line.gsub(Rails.root.to_s + '/', '')
|
24
|
+
end
|
25
|
+
lines.each { |line| ap line, color: { string: :purpleish } }
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.blank_lines_top
|
29
|
+
# The first puts has no visible effect
|
30
|
+
# So we want to puts once regardless of config
|
31
|
+
puts
|
32
|
+
config.blank_lines_top.times { puts }
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.blank_lines_bottom
|
36
|
+
config.blank_lines_bottom.times { puts }
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.config
|
40
|
+
SuperAwesomePrint.configuration
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.configuration
|
44
|
+
@configuration ||= Configuration.new
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.configure
|
48
|
+
yield configuration
|
49
|
+
end
|
13
50
|
end
|
data/super_awesome_print.gemspec
CHANGED
@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'super_awesome_print/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'super_awesome_print'
|
8
8
|
spec.version = SuperAwesomePrint::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Oleg Antonyan']
|
10
|
+
spec.email = ['oleg.b.antonyan@gmail.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'Simple wrapper around awesome_print for easier look in long log'
|
13
|
+
spec.description = "Add colored '*********', time and line number around printed value"
|
14
|
+
spec.homepage = 'http://github.com/olegantonyan/super_awesome_print'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_runtime_dependency
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_runtime_dependency 'awesome_print'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_awesome_print
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Antonyan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,9 +70,10 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- lib/super_awesome_print.rb
|
73
|
+
- lib/super_awesome_print/configuration.rb
|
73
74
|
- lib/super_awesome_print/version.rb
|
74
75
|
- super_awesome_print.gemspec
|
75
|
-
homepage: http://github.com/olegantonyan/
|
76
|
+
homepage: http://github.com/olegantonyan/super_awesome_print
|
76
77
|
licenses:
|
77
78
|
- MIT
|
78
79
|
metadata: {}
|