log_marker 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: 2c4562ff9d4c28819b7c39a98ece4983e3c885ab
4
- data.tar.gz: a37b6f7e754cd0905bc1ddfcd4ce0ce9c797c759
3
+ metadata.gz: 901259ddef5ec66b1a33351ddb322349b189b272
4
+ data.tar.gz: e0ccdcc2fd3218989be8bbeb12640abfac8458bc
5
5
  SHA512:
6
- metadata.gz: f9ff261851c35535722bcaa76492f25af61d830585ec67a8baa120c45a58383be25ac0ff9dd805bcd783cfb183918fe81308ab4d27ec45e9e5013a37be9e085e
7
- data.tar.gz: 494059321c3af625d4f68a2884bde20740c41e3f363f40cd4038ea24d06322087b09af8fbc86453b7f63990bee102efe5718cd2d767e29e847fac02f9fa2a229
6
+ metadata.gz: e292ef7a6df46d67dbe983f84b54be54810e4ec56f1988d1a613b67e9b8f02260b540a592330b1fb819b91f0b3048ec0c406538b04e7ae603834d508121de131
7
+ data.tar.gz: 195caf3cabaffab88fabe8c0ea29adb5905ff8245ef54547ed8f38941c652b6e44608f22846ef5eb95f017cbb2d05c4e8cc05a6d5ef75fa68cb748a23b02c98e
data/.gitignore CHANGED
@@ -1,9 +1,11 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
8
  /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --format documentation
2
2
  --color
3
+ --require spec_helper
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  rvm:
3
- - 2.0.0
4
- before_install: gem install bundler -v 1.10.5
4
+ - 2.4.2
5
+ before_install: gem install bundler -v 1.16.0
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,13 +1,74 @@
1
- # Contributor Code of Conduct
1
+ # Contributor Covenant Code of Conduct
2
2
 
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
3
+ ## Our Pledge
4
4
 
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
6
11
 
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
12
+ ## Our Standards
8
13
 
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
10
16
 
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
12
22
 
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jun.okada0203@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
2
4
 
3
5
  # Specify your gem's dependencies in log_marker.gemspec
4
6
  gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ log_marker (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.8.0)
12
+ rspec-core (~> 3.8.0)
13
+ rspec-expectations (~> 3.8.0)
14
+ rspec-mocks (~> 3.8.0)
15
+ rspec-core (3.8.0)
16
+ rspec-support (~> 3.8.0)
17
+ rspec-expectations (3.8.2)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.8.0)
20
+ rspec-mocks (3.8.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.8.0)
23
+ rspec-support (3.8.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.16)
30
+ log_marker!
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 1.16.0
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 TODO: Write your name
3
+ Copyright (c) 2019 Jun0kada
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # LogMarker
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/log_marker`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ debug logging with marker
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,20 +20,130 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ log_marker methods
24
+ `ml`, `p!`, `pp!`, `puts!`
25
+
26
+ ```ruby
27
+ ml 'Hello my debug log'
28
+ # => ======================================================================================================================================================
29
+ # ======================================================================================================================================================
30
+ # ======================================================================================================================================================
31
+ # ======================================================================================================================================================
32
+ # ======================================================================================================================================================
33
+ #
34
+ #
35
+ #
36
+ #
37
+ #
38
+ # "Hello my debug log"
39
+ #
40
+ #
41
+ #
42
+ #
43
+ #
44
+ # ======================================================================================================================================================
45
+ # ======================================================================================================================================================
46
+ # ======================================================================================================================================================
47
+ # ======================================================================================================================================================
48
+ # ======================================================================================================================================================
49
+
50
+ p! 'Hello my debug log'
51
+ # => ======================================================================================================================================================
52
+ # ======================================================================================================================================================
53
+ # ======================================================================================================================================================
54
+ # ======================================================================================================================================================
55
+ # ======================================================================================================================================================
56
+ #
57
+ #
58
+ #
59
+ #
60
+ #
61
+ # "Hello my debug log"
62
+ #
63
+ #
64
+ #
65
+ #
66
+ #
67
+ # ======================================================================================================================================================
68
+ # ======================================================================================================================================================
69
+ # ======================================================================================================================================================
70
+ # ======================================================================================================================================================
71
+ # ======================================================================================================================================================
72
+
73
+ puts! 'Hello my debug log'
74
+ # => ======================================================================================================================================================
75
+ # ======================================================================================================================================================
76
+ # ======================================================================================================================================================
77
+ # ======================================================================================================================================================
78
+ # ======================================================================================================================================================
79
+ #
80
+ #
81
+ #
82
+ #
83
+ #
84
+ # Hello my debug log
85
+ #
86
+ #
87
+ #
88
+ #
89
+ #
90
+ # ======================================================================================================================================================
91
+ # ======================================================================================================================================================
92
+ # ======================================================================================================================================================
93
+ # ======================================================================================================================================================
94
+ # ======================================================================================================================================================
95
+
96
+ pp! ['Hello my debug log'] * 5
97
+ # => ======================================================================================================================================================
98
+ # ======================================================================================================================================================
99
+ # ======================================================================================================================================================
100
+ # ======================================================================================================================================================
101
+ # ======================================================================================================================================================
102
+ #
103
+ #
104
+ #
105
+ #
106
+ #
107
+ # ["Hello my debug log",
108
+ # "Hello my debug log",
109
+ # "Hello my debug log",
110
+ # "Hello my debug log",
111
+ # "Hello my debug log"]
112
+ #
113
+ #
114
+ #
115
+ #
116
+ #
117
+ # ======================================================================================================================================================
118
+ # ======================================================================================================================================================
119
+ # ======================================================================================================================================================
120
+ # ======================================================================================================================================================
121
+ # ======================================================================================================================================================
122
+ ```
123
+
124
+ ## Config
125
+
126
+ ```ruby
127
+ LogMarker.config do |config|
128
+ config.ml_alias = :p!
129
+ config.marker = -> { (['=' * 150] * 5).join("\n") }
130
+ end
131
+ ```
26
132
 
27
133
  ## Development
28
134
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
135
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
136
 
31
137
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
138
 
33
139
  ## Contributing
34
140
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/log_marker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
-
141
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/log_marker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
37
142
 
38
143
  ## License
39
144
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
145
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
146
+
147
+ ## Code of Conduct
41
148
 
149
+ Everyone interacting in the LogMarker project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/log_marker/blob/master/CODE_OF_CONDUCT.md).
data/bin/console CHANGED
@@ -11,4 +11,4 @@ require "log_marker"
11
11
  # Pry.start
12
12
 
13
13
  require "irb"
14
- IRB.start
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,6 +1,7 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
+ set -vx
4
5
 
5
6
  bundle install
6
7
 
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LogMarker
4
+ class << self
5
+ attr_accessor :ml_alias, :marker
6
+
7
+ def config
8
+ yield self
9
+ end
10
+ end
11
+
12
+ @ml_alias = :p!
13
+ @marker = -> { (['=' * 150] * 5).join("\n") }
14
+ end
@@ -1,3 +1,3 @@
1
1
  module LogMarker
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
data/lib/log_marker.rb CHANGED
@@ -1,2 +1,40 @@
1
- require "log_marker/version"
2
- require "log_marker/extention/active_support/object"
1
+ # frozen_string_literal: true
2
+
3
+ require 'pp'
4
+ require 'log_marker/version'
5
+ require 'log_marker/config'
6
+
7
+ module LogMarker
8
+ MARK_METHODS = %w(p pp puts)
9
+
10
+ MARK_METHODS.each do |name|
11
+ define_method("#{name}!") do |*args|
12
+ logging_with_marker do
13
+ send(name, *args)
14
+ end
15
+ end
16
+ end
17
+
18
+ def logging_with_marker(&block)
19
+ puts marker
20
+
21
+ result = block.call
22
+
23
+ puts marker.reverse
24
+
25
+ result
26
+ end
27
+
28
+ def marker
29
+ [
30
+ LogMarker.marker.respond_to?(:call) ? LogMarker.marker.call : LogMarker.marker.to_s,
31
+ "\n" * 5
32
+ ]
33
+ end
34
+
35
+ def ml(*args)
36
+ send(LogMarker.ml_alias, *args)
37
+ end
38
+ end
39
+
40
+ Object.include LogMarker
data/log_marker.gemspec CHANGED
@@ -1,28 +1,26 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'log_marker/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "log_marker"
6
+ spec.name = 'log_marker'
8
7
  spec.version = LogMarker::VERSION
9
- spec.authors = ["JunOkada"]
10
- spec.email = ["jun.okada0203@gmail.com"]
8
+ spec.authors = ['Jun0kada']
9
+ spec.email = ['jun.0kada.dev@gmail.com']
11
10
 
12
- spec.summary = %q{Add marker to debug logs}
13
- spec.description = %q{Add marker to debug logs}
14
- spec.homepage = ""
15
- spec.license = "MIT"
11
+ spec.summary = 'Add marker to debug logs'
12
+ spec.description = 'Add marker to debug logs'
13
+ spec.homepage = 'https://github.com/Jun0kada/log_marker'
14
+ spec.license = 'MIT'
16
15
 
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
-
20
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = "exe"
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = 'exe'
22
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ["lib"]
21
+ spec.require_paths = ['lib']
24
22
 
25
- spec.add_development_dependency "bundler", "~> 1.10"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "rspec"
23
+ spec.add_development_dependency 'bundler', '~> 1.16'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
26
  end
metadata CHANGED
@@ -1,79 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_marker
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
- - JunOkada
7
+ - Jun0kada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-05 00:00:00.000000000 Z
11
+ date: 2019-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '1.16'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '1.16'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.0'
55
55
  description: Add marker to debug logs
56
56
  email:
57
- - jun.okada0203@gmail.com
57
+ - jun.0kada.dev@gmail.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .rspec
64
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
65
  - CODE_OF_CONDUCT.md
66
66
  - Gemfile
67
+ - Gemfile.lock
67
68
  - LICENSE.txt
68
69
  - README.md
69
70
  - Rakefile
70
71
  - bin/console
71
72
  - bin/setup
72
73
  - lib/log_marker.rb
73
- - lib/log_marker/extention/active_support/object.rb
74
+ - lib/log_marker/config.rb
74
75
  - lib/log_marker/version.rb
75
76
  - log_marker.gemspec
76
- homepage: ''
77
+ homepage: https://github.com/Jun0kada/log_marker
77
78
  licenses:
78
79
  - MIT
79
80
  metadata: {}
@@ -83,17 +84,17 @@ require_paths:
83
84
  - lib
84
85
  required_ruby_version: !ruby/object:Gem::Requirement
85
86
  requirements:
86
- - - '>='
87
+ - - ">="
87
88
  - !ruby/object:Gem::Version
88
89
  version: '0'
89
90
  required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  requirements:
91
- - - '>='
92
+ - - ">="
92
93
  - !ruby/object:Gem::Version
93
94
  version: '0'
94
95
  requirements: []
95
96
  rubyforge_project:
96
- rubygems_version: 2.4.6
97
+ rubygems_version: 2.6.13
97
98
  signing_key:
98
99
  specification_version: 4
99
100
  summary: Add marker to debug logs
@@ -1,7 +0,0 @@
1
- class Object
2
- def lm(*arg)
3
- puts "\e[31m" + '■'*10 + '<debug>' + '■'*10 + "\e[0m"
4
- p *arg
5
- puts "\e[31m" + '■'*10 + '</debug>' + '■'*10 + "\e[0m"
6
- end
7
- end