hilight 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +78 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +28 -0
- data/Gemfile.lock +163 -0
- data/Guardfile +37 -0
- data/README.md +102 -0
- data/Rakefile +56 -0
- data/bin/add +25 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/hilight +56 -0
- data/hilight.gemspec +24 -0
- data/lib/hilight.rb +22 -0
- data/lib/hilight/version.rb +3 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 202e8bb8be4f33a846320b5886d4980d579e424031709355bb58b1d08cd31bb4
|
4
|
+
data.tar.gz: 39e33ae06908234fe0b22418804eae4d07fe06b4580f119863284dc2fa228e8e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22fb9a5669cc23b6d6bfb8fb8f3bcbde5169fd3078013a2fba344af85bead59e6f9963969118b8e7ffc59af2b2fe45fb83baf91558967d4b3612fa669b0d2c70
|
7
|
+
data.tar.gz: f545db37b768481a1bedb10c7c0b4adc58553f93b5cb2660bbfa496aa561926d02e5df7d3c128433b6ff606b2cd17b8197c9192c4209f0ca263f2607a0d2d139
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.4.0
|
5
|
+
Exclude:
|
6
|
+
- 'vendor/**/*'
|
7
|
+
- 'tmp/**/*'
|
8
|
+
- 'spec/spec_helper.rb'
|
9
|
+
|
10
|
+
# The defaults for these seem to be based on a rails env, this is not rails.
|
11
|
+
Metrics/ModuleLength:
|
12
|
+
CountComments: false
|
13
|
+
Max: 250
|
14
|
+
|
15
|
+
Metrics/ClassLength:
|
16
|
+
Max: 250
|
17
|
+
|
18
|
+
Metrics/MethodLength:
|
19
|
+
Max: 20
|
20
|
+
|
21
|
+
Metrics/AbcSize:
|
22
|
+
Max: 25
|
23
|
+
|
24
|
+
Metrics/CyclomaticComplexity:
|
25
|
+
Max: 8
|
26
|
+
|
27
|
+
Metrics/PerceivedComplexity:
|
28
|
+
Max: 10
|
29
|
+
|
30
|
+
# it's 2016, people have wide monitors.
|
31
|
+
Metrics/LineLength:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Metrics/BlockLength:
|
35
|
+
Exclude:
|
36
|
+
- 'Guardfile'
|
37
|
+
- '*.gemspec'
|
38
|
+
- 'spec/**/*'
|
39
|
+
|
40
|
+
# we exclude these two files since they are generated, the rest of our projects
|
41
|
+
# should use // style regexps.
|
42
|
+
Style/RegexpLiteral:
|
43
|
+
EnforcedStyle: slashes
|
44
|
+
AllowInnerSlashes: true
|
45
|
+
Exclude:
|
46
|
+
- 'Guardfile'
|
47
|
+
- '*.gemspec'
|
48
|
+
|
49
|
+
# Prefer single-quoted strings when you don't need string interpolation or special symbols
|
50
|
+
Style/StringLiterals:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/WordArray:
|
54
|
+
EnforcedStyle: brackets
|
55
|
+
|
56
|
+
Style/FrozenStringLiteralComment:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Style/MixinUsage:
|
60
|
+
Exclude:
|
61
|
+
- 'bin/*'
|
62
|
+
|
63
|
+
# Specs don't need inline documentation.
|
64
|
+
Style/Documentation:
|
65
|
+
Enabled: true
|
66
|
+
Exclude:
|
67
|
+
- 'spec/**/*'
|
68
|
+
|
69
|
+
RSpec/NamedSubject:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Lint/Debugger:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
# Purty hashes.
|
76
|
+
Layout/AlignHash:
|
77
|
+
EnforcedHashRocketStyle: table
|
78
|
+
EnforcedColonStyle: table
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
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.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
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
|
22
|
+
|
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 ebrodeur@ujami.net. 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
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'bump'
|
7
|
+
gem "bundler"
|
8
|
+
gem "rake"
|
9
|
+
gem "rspec"
|
10
|
+
gem 'rubocop'
|
11
|
+
gem 'rubocop-rspec'
|
12
|
+
gem 'simplecov'
|
13
|
+
gem 'simplecov-console'
|
14
|
+
gem 'yard'
|
15
|
+
end
|
16
|
+
|
17
|
+
group :development, optional: true do
|
18
|
+
gem 'guard'
|
19
|
+
gem 'guard-bundler'
|
20
|
+
gem 'guard-rspec'
|
21
|
+
gem 'guard-rubocop'
|
22
|
+
gem 'guard-shell'
|
23
|
+
gem 'guard-yard'
|
24
|
+
gem 'oj'
|
25
|
+
gem 'pry'
|
26
|
+
gem 'pry-debundle'
|
27
|
+
gem 'solargraph'
|
28
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hilight (0.1.0)
|
5
|
+
term-ansicolor
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ansi (1.5.0)
|
11
|
+
ast (2.4.0)
|
12
|
+
backport (0.3.0)
|
13
|
+
bump (0.8.0)
|
14
|
+
coderay (1.1.2)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
docile (1.3.1)
|
17
|
+
ffi (1.10.0)
|
18
|
+
formatador (0.2.5)
|
19
|
+
guard (2.15.0)
|
20
|
+
formatador (>= 0.2.4)
|
21
|
+
listen (>= 2.7, < 4.0)
|
22
|
+
lumberjack (>= 1.0.12, < 2.0)
|
23
|
+
nenv (~> 0.1)
|
24
|
+
notiffany (~> 0.0)
|
25
|
+
pry (>= 0.9.12)
|
26
|
+
shellany (~> 0.0)
|
27
|
+
thor (>= 0.18.1)
|
28
|
+
guard-bundler (2.2.1)
|
29
|
+
bundler (>= 1.3.0, < 3)
|
30
|
+
guard (~> 2.2)
|
31
|
+
guard-compat (~> 1.1)
|
32
|
+
guard-compat (1.2.1)
|
33
|
+
guard-rspec (4.7.3)
|
34
|
+
guard (~> 2.1)
|
35
|
+
guard-compat (~> 1.1)
|
36
|
+
rspec (>= 2.99.0, < 4.0)
|
37
|
+
guard-rubocop (1.3.0)
|
38
|
+
guard (~> 2.0)
|
39
|
+
rubocop (~> 0.20)
|
40
|
+
guard-shell (0.7.1)
|
41
|
+
guard (>= 2.0.0)
|
42
|
+
guard-compat (~> 1.0)
|
43
|
+
guard-yard (2.2.1)
|
44
|
+
guard (>= 1.1.0)
|
45
|
+
yard (>= 0.7.0)
|
46
|
+
hirb (0.7.3)
|
47
|
+
htmlentities (4.3.4)
|
48
|
+
jaro_winkler (1.5.2)
|
49
|
+
json (2.2.0)
|
50
|
+
kramdown (1.17.0)
|
51
|
+
listen (3.1.5)
|
52
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
53
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
54
|
+
ruby_dep (~> 1.2)
|
55
|
+
lumberjack (1.0.13)
|
56
|
+
method_source (0.9.2)
|
57
|
+
mini_portile2 (2.4.0)
|
58
|
+
nenv (0.3.0)
|
59
|
+
nokogiri (1.10.1)
|
60
|
+
mini_portile2 (~> 2.4.0)
|
61
|
+
notiffany (0.1.1)
|
62
|
+
nenv (~> 0.1)
|
63
|
+
shellany (~> 0.0)
|
64
|
+
oj (3.7.9)
|
65
|
+
parallel (1.14.0)
|
66
|
+
parser (2.6.0.0)
|
67
|
+
ast (~> 2.4.0)
|
68
|
+
powerpack (0.1.2)
|
69
|
+
pry (0.12.2)
|
70
|
+
coderay (~> 1.1.0)
|
71
|
+
method_source (~> 0.9.0)
|
72
|
+
pry-debundle (0.8)
|
73
|
+
pry
|
74
|
+
psych (3.1.0)
|
75
|
+
rainbow (3.0.0)
|
76
|
+
rake (12.3.2)
|
77
|
+
rb-fsevent (0.10.3)
|
78
|
+
rb-inotify (0.10.0)
|
79
|
+
ffi (~> 1.0)
|
80
|
+
reverse_markdown (1.1.0)
|
81
|
+
nokogiri
|
82
|
+
rspec (3.8.0)
|
83
|
+
rspec-core (~> 3.8.0)
|
84
|
+
rspec-expectations (~> 3.8.0)
|
85
|
+
rspec-mocks (~> 3.8.0)
|
86
|
+
rspec-core (3.8.0)
|
87
|
+
rspec-support (~> 3.8.0)
|
88
|
+
rspec-expectations (3.8.2)
|
89
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
90
|
+
rspec-support (~> 3.8.0)
|
91
|
+
rspec-mocks (3.8.0)
|
92
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
93
|
+
rspec-support (~> 3.8.0)
|
94
|
+
rspec-support (3.8.0)
|
95
|
+
rubocop (0.65.0)
|
96
|
+
jaro_winkler (~> 1.5.1)
|
97
|
+
parallel (~> 1.10)
|
98
|
+
parser (>= 2.5, != 2.5.1.1)
|
99
|
+
powerpack (~> 0.1)
|
100
|
+
psych (>= 3.1.0)
|
101
|
+
rainbow (>= 2.2.2, < 4.0)
|
102
|
+
ruby-progressbar (~> 1.7)
|
103
|
+
unicode-display_width (~> 1.4.0)
|
104
|
+
rubocop-rspec (1.32.0)
|
105
|
+
rubocop (>= 0.60.0)
|
106
|
+
ruby-progressbar (1.10.0)
|
107
|
+
ruby_dep (1.5.0)
|
108
|
+
shellany (0.0.1)
|
109
|
+
simplecov (0.16.1)
|
110
|
+
docile (~> 1.1)
|
111
|
+
json (>= 1.8, < 3)
|
112
|
+
simplecov-html (~> 0.10.0)
|
113
|
+
simplecov-console (0.4.2)
|
114
|
+
ansi
|
115
|
+
hirb
|
116
|
+
simplecov
|
117
|
+
simplecov-html (0.10.2)
|
118
|
+
solargraph (0.31.3)
|
119
|
+
backport (~> 0.3)
|
120
|
+
htmlentities (~> 4.3, >= 4.3.4)
|
121
|
+
jaro_winkler (~> 1.5)
|
122
|
+
kramdown (~> 1.16)
|
123
|
+
parser (~> 2.3)
|
124
|
+
reverse_markdown (~> 1.0, >= 1.0.5)
|
125
|
+
rubocop (~> 0.52)
|
126
|
+
thor (~> 0.19, >= 0.19.4)
|
127
|
+
tilt (~> 2.0)
|
128
|
+
yard (~> 0.9)
|
129
|
+
term-ansicolor (1.7.1)
|
130
|
+
tins (~> 1.0)
|
131
|
+
thor (0.20.3)
|
132
|
+
tilt (2.0.9)
|
133
|
+
tins (1.20.2)
|
134
|
+
unicode-display_width (1.4.1)
|
135
|
+
yard (0.9.18)
|
136
|
+
|
137
|
+
PLATFORMS
|
138
|
+
ruby
|
139
|
+
|
140
|
+
DEPENDENCIES
|
141
|
+
bump
|
142
|
+
bundler
|
143
|
+
guard
|
144
|
+
guard-bundler
|
145
|
+
guard-rspec
|
146
|
+
guard-rubocop
|
147
|
+
guard-shell
|
148
|
+
guard-yard
|
149
|
+
hilight!
|
150
|
+
oj
|
151
|
+
pry
|
152
|
+
pry-debundle
|
153
|
+
rake
|
154
|
+
rspec
|
155
|
+
rubocop
|
156
|
+
rubocop-rspec
|
157
|
+
simplecov
|
158
|
+
simplecov-console
|
159
|
+
solargraph
|
160
|
+
yard
|
161
|
+
|
162
|
+
BUNDLED WITH
|
163
|
+
2.0.1
|
data/Guardfile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
clearing :on
|
2
|
+
directories [".", "tmp"]
|
3
|
+
|
4
|
+
guard(:shell, timeout: 30) do
|
5
|
+
watch("exe/hilight") { puts `ruby exe/hilight` }
|
6
|
+
end
|
7
|
+
|
8
|
+
group :main, halt_on_fail: true do
|
9
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
10
|
+
require "guard/rspec/dsl"
|
11
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
12
|
+
rspec = dsl.rspec
|
13
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
15
|
+
watch(rspec.spec_files)
|
16
|
+
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
20
|
+
|
21
|
+
guard :rubocop, all_on_start: false, cli: ['--extra-details', '-P', '--display-style-guide', '--fail-level=e'] do
|
22
|
+
watch(/.+\.rb$/)
|
23
|
+
watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
guard :bundler do
|
28
|
+
require 'guard/bundler'
|
29
|
+
require 'guard/bundler/verify'
|
30
|
+
helper = Guard::Bundler::Verify.new
|
31
|
+
|
32
|
+
files = ['Gemfile']
|
33
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
34
|
+
|
35
|
+
# Assume files are symlinked from somewhere
|
36
|
+
files.each { |file| watch(helper.real_path(file)) }
|
37
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
# Hilight
|
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/hilight`. 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
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'hilight'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install hilight
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
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
|
+
|
31
|
+
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
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/erniebrodeur/hilight. 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.
|
36
|
+
|
37
|
+
## Code of Conduct
|
38
|
+
|
39
|
+
Everyone interacting in the Hilight project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/erniebrodeur/hilight/blob/master/CODE_OF_CONDUCT.md).
|
40
|
+
|
41
|
+
["patterns"].map { |m| Match.new m["regexp"],m["sub_string"] }
|
42
|
+
|
43
|
+
``` yaml
|
44
|
+
:cmd: rspec
|
45
|
+
:patterns:
|
46
|
+
- :regexp: (?<green>\\d+) examples, (?<red>\\d+) failures, (?<yellow>\\d+) pending
|
47
|
+
:sub_string: \\k<green> examples, \\k<red> failures, \\k<yellow> pending
|
48
|
+
- :regexp: (?<blue>\\d+\\.\\d+)
|
49
|
+
:sub_string: \\k<blue>
|
50
|
+
- :regexp: (?<green>.*?)\"|\'(?<green>.*?)\'
|
51
|
+
:sub_string: \\k<green>
|
52
|
+
- :regexp: "# (?<red>.*):(?<yellow>\d+)"
|
53
|
+
:sub_string: \\k<red>:\\k<yellow>
|
54
|
+
```
|
55
|
+
|
56
|
+
``` ruby
|
57
|
+
{
|
58
|
+
"cmd" => "rspec",
|
59
|
+
"patterns" =>[
|
60
|
+
{
|
61
|
+
"regexp" => %r{(?<green>\d+) examples, (?<red>\d+) failures, (?<yellow>\d+) pending},
|
62
|
+
"sub_string" =>'\k<green> examples, \k<red> failures, \k<yellow> pending'
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"regexp" => %r{(?<blue>\d+\.\d+)},
|
66
|
+
"sub_string" =>'\k<blue>'
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"regexp" => %r{"(?<green>.*?)"|'(?<green>.*?)'},
|
70
|
+
"sub_string" =>'\k<green>'
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"regexp" => %r{# (?<red>.*):(?<yellow>\d+)},
|
74
|
+
"sub_string" =>'\k<red>:\k<yellow>'
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
```
|
79
|
+
|
80
|
+
|
81
|
+
``` json
|
82
|
+
{
|
83
|
+
":cmd":"rspec",
|
84
|
+
":patterns":[
|
85
|
+
{
|
86
|
+
":regexp":"(?<green>\\d+) examples, (?<red>\\d+) failures, (?<yellow>\\d+) pending",
|
87
|
+
":sub_string":"\\k<green> examples, \\k<red> failures, \\k<yellow> pending"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
":regexp":"(?<blue>\\d+\\.\\d+)",
|
91
|
+
":sub_string":"\\k<blue>"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
":regexp":"(?<green>.*?)\\\"|'(?<green>.*?)'",
|
95
|
+
":sub_string":"\\k<green>"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
":regexp":"\\# (?<red>.*):(?<yellow>\\d+)",
|
99
|
+
":sub_string":"\\k<red>:\\k<yellow>"
|
100
|
+
}
|
101
|
+
]
|
102
|
+
}```
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "open-uri"
|
4
|
+
### Configurables
|
5
|
+
|
6
|
+
files = {
|
7
|
+
Gemfile: 'https://gist.githubusercontent.com/erniebrodeur/5a5518f5051210f1828a0712bf623dc8/raw',
|
8
|
+
Rakefile: 'https://gist.githubusercontent.com/erniebrodeur/afc92b72158413aa1f85d8d1facd267a/raw',
|
9
|
+
Rubocop: 'https://gist.githubusercontent.com/erniebrodeur/f7f63996ef1e017aee9bf9d8e680a1df/raw',
|
10
|
+
Tasks: 'https://gist.githubusercontent.com/erniebrodeur/03573fecf4f274101c14f6802abdbe83/raw',
|
11
|
+
BinAdd: 'https://gist.githubusercontent.com/erniebrodeur/a815ee4d8bd9ccc54d91025a5543ebb8/raw'
|
12
|
+
}
|
13
|
+
|
14
|
+
# spec
|
15
|
+
RSpec::Core::RakeTask.new(:spec)
|
16
|
+
task default: :spec
|
17
|
+
|
18
|
+
# automagical updating
|
19
|
+
desc "updates for various bits of the development environment."
|
20
|
+
|
21
|
+
namespace :update do
|
22
|
+
desc "update everything (multitasked)"
|
23
|
+
multitask(all: %i[gemfile rakefile rubocop tasks])
|
24
|
+
|
25
|
+
desc 'Update Gemfile from gist'
|
26
|
+
task :gemfile do
|
27
|
+
grab_file 'Gemfile', files[:Gemfile]
|
28
|
+
end
|
29
|
+
|
30
|
+
desc 'Update Rakefile from gist'
|
31
|
+
task :rakefile do
|
32
|
+
grab_file 'Rakefile', files[:Rakefile]
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Update .rubocop.yml from gist'
|
36
|
+
task :rubocop do
|
37
|
+
grab_file '.rubocop.yml', files[:Rubocop]
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Update .vscode/tasks.json from gist'
|
41
|
+
task :tasks do
|
42
|
+
mkdir_p '.vscode'
|
43
|
+
grab_file '.vscode/tasks.json', files[:Tasks]
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Add a new lib and spec file (binary)'
|
47
|
+
task :binadd do
|
48
|
+
mkdir_p 'bin'
|
49
|
+
grab_file 'bin/add', files[:BinAdd]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def grab_file(filename, uri)
|
54
|
+
File.write filename, open(uri).read
|
55
|
+
puts "Updated #{filename} from: #{uri}"
|
56
|
+
end
|
data/bin/add
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'bundler'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
# add files to lib and spec
|
6
|
+
# takes one arg, the path from lib/spec + base filename
|
7
|
+
# example: add models/something
|
8
|
+
|
9
|
+
unless ARGV[0]
|
10
|
+
puts "example: add models/something"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
file = ARGV[0].dup
|
15
|
+
root = Bundler.root.split.last.to_s
|
16
|
+
|
17
|
+
file.chomp!(".rb")
|
18
|
+
|
19
|
+
lib = "lib/#{root}/#{file}.rb"
|
20
|
+
spec = "spec/#{root}/#{file}_spec.rb"
|
21
|
+
|
22
|
+
[lib, spec].each do |s|
|
23
|
+
FileUtils.mkdir_p(File.dirname(s))
|
24
|
+
puts "created: #{FileUtils.touch(s).first}"
|
25
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "hilight"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/hilight
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "hilight"
|
4
|
+
require 'term/ansicolor'
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
include Hilight #rubocop:disable all
|
8
|
+
|
9
|
+
Filter = Struct.new(:cmd, :patterns)
|
10
|
+
|
11
|
+
filters = [
|
12
|
+
Filter["rspec", Patterns[[
|
13
|
+
Pattern[/(?<green>\d+) examples, (?<red>\d+) failures, (?<yellow>\d+) pending/, '\k<green> examples, \k<red> failures, \k<yellow> pending'],
|
14
|
+
Pattern[/(?<blue>\d+\.\d+)/, '\k<blue>'],
|
15
|
+
Pattern[/\"(?<green>.*?)\"|\'(?<green>.*?)\'/, '\k<green>'],
|
16
|
+
Pattern[/# (?<red>.*):(?<yellow>\d+)/, '\k<red>:\k<yellow>']
|
17
|
+
]]],
|
18
|
+
Filter[/-h|--help|help/, Patterns[[
|
19
|
+
Pattern[/(?<green>\[.*?\])|(?<magenta>(?:--(?:\[no-\]|)(?:\w|-)+)|-[A-Za-z])/, '\k<green>\k<magenta>']
|
20
|
+
]]],
|
21
|
+
Filter["git", Patterns[[Pattern[/(?<green>'.*')|(?<blue>".*")/, '\k<green>\k<blue>']]]],
|
22
|
+
Filter["ruby", Patterns[[
|
23
|
+
Pattern[/(.*from |)(?<red>.*):(?<blue>\d+)(?::in )(?<yellow>`.*')/, '\k<red>\k<blue>\k<yellow>']
|
24
|
+
]]],
|
25
|
+
Filter["default", Patterns[[
|
26
|
+
Pattern[/(?<green>'.*')|(?<blue>".*")/, '\k<green>\k<blue>']
|
27
|
+
]]]
|
28
|
+
]
|
29
|
+
|
30
|
+
Filter.define_method(:match?) do |string|
|
31
|
+
case cmd
|
32
|
+
when (String || Symbol) then (cmd.to_s == string.to_s)
|
33
|
+
when Regexp then (cmd.match? string.to_s)
|
34
|
+
else false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
filters.define_singleton_method(:find) do |string|
|
39
|
+
each { |f| return f if f.match? string }
|
40
|
+
filters.find "default"
|
41
|
+
end
|
42
|
+
|
43
|
+
filters.define_singleton_method(:run) do
|
44
|
+
arg_string = ARGV.join(' ')
|
45
|
+
|
46
|
+
f = filters.find arg_string
|
47
|
+
|
48
|
+
output, process = Open3.capture2e(arg_string)
|
49
|
+
|
50
|
+
abort process.exitstatus if process.exitstatus.positive?
|
51
|
+
|
52
|
+
puts f.patterns.output(output)
|
53
|
+
end
|
54
|
+
|
55
|
+
abort 'hilight <cmd>' unless ARGV.any?
|
56
|
+
filters.run
|
data/hilight.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "hilight/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "hilight"
|
7
|
+
spec.version = Hilight::VERSION
|
8
|
+
spec.authors = ["Ernie Brodeur"]
|
9
|
+
spec.email = ["ebrodeur@ujami.net"]
|
10
|
+
|
11
|
+
spec.summary = "hilight"
|
12
|
+
spec.description = "hilight all the things."
|
13
|
+
|
14
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
15
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
end
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'term-ansicolor'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
24
|
+
end
|
data/lib/hilight.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "hilight/version"
|
2
|
+
require 'term/ansicolor'
|
3
|
+
|
4
|
+
Hilight::Pattern = Struct.new :regexp, :replacement
|
5
|
+
Hilight::Pattern.define_method(:output) do |input|
|
6
|
+
# map our colors in to the matches
|
7
|
+
regexp.names.map { |n| replacement.gsub!("\\k<#{n}>") { |s| Term::ANSIColor.color(n, s) } }
|
8
|
+
# map our input into the output, return the original if it doesn't map (replace) anything.
|
9
|
+
input.gsub!(regexp, replacement) || input
|
10
|
+
end
|
11
|
+
|
12
|
+
Hilight::Patterns = Struct.new :patterns
|
13
|
+
Hilight::Patterns.define_method(:output) do |input|
|
14
|
+
patterns.each { |pattern| input = pattern.output(input) }
|
15
|
+
input
|
16
|
+
end
|
17
|
+
|
18
|
+
Hilight.define_singleton_method(:load) do |filename|
|
19
|
+
return Kernel.load filename if File.exist? filename
|
20
|
+
|
21
|
+
Kernel.load "#{Dir.home}/.config/hilight/patterns/#{filename}"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hilight
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ernie Brodeur
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: term-ansicolor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
description: hilight all the things.
|
42
|
+
email:
|
43
|
+
- ebrodeur@ujami.net
|
44
|
+
executables:
|
45
|
+
- hilight
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".rubocop.yml"
|
52
|
+
- ".travis.yml"
|
53
|
+
- CODE_OF_CONDUCT.md
|
54
|
+
- Gemfile
|
55
|
+
- Gemfile.lock
|
56
|
+
- Guardfile
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- bin/add
|
60
|
+
- bin/console
|
61
|
+
- bin/setup
|
62
|
+
- exe/hilight
|
63
|
+
- hilight.gemspec
|
64
|
+
- lib/hilight.rb
|
65
|
+
- lib/hilight/version.rb
|
66
|
+
homepage:
|
67
|
+
licenses: []
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.0.1
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: hilight
|
88
|
+
test_files: []
|