cch 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/cch.gemspec +2 -2
- data/config/Cchfile +13 -0
- data/lib/cch/commands/file_system.rb +28 -0
- data/lib/cch/runner.rb +9 -16
- data/lib/cch/version.rb +1 -1
- data/lib/cch.rb +1 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTlhZjNmMjc4OTU2ODQ1MTJhYzRlNDRhZTI0OWRiMmFhY2U0MTU4Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDBhZGFhZmQ5ZjI4ZDViZjY3NjFjZDUzN2RiZGRiZGIzNGRiYTBhYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzU4OGJlZTQyZDljZWNiMWU2ZWZhNDg2MmI2NjE4N2JlNzMwYTFlYjU0Y2Zi
|
10
|
+
Y2VkOTAzNzVhYmEwYzlhZWEzNmMwNDA1OTVlMjZlZGJiOTgwZDRlOWZkZjFl
|
11
|
+
NmRiNzIxYTA3YmRhOTY2ODhiNTU2NzFkNGIyOTEzMTkxYjc5MzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWJlMWVkNjVhNDc2OGIyNDMzY2I2YTc2ZmVlZmE4OGE1ZGYwNTNhOWIzYzJm
|
14
|
+
NGQzM2U4NTM4MmU4ZjQ3ZWI0ZGNhMTQyY2FlZjIyOTBiOGMwMTU0ZWM1OTU5
|
15
|
+
MGE5NWFkZGIyM2MwNWQ4NDdkYTAwMjRhZWI2YjBiNmZhN2JlMzc=
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,9 +4,11 @@ CCH - Check on changes for ruby projects
|
|
4
4
|
## gem status
|
5
5
|
|
6
6
|
[![Build Status](https://travis-ci.org/vnegrisolo/cch.svg)](https://travis-ci.org/vnegrisolo/cch)
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/cch.svg)](http://badge.fury.io/rb/cch)
|
7
8
|
[![Code Climate](https://codeclimate.com/github/vnegrisolo/cch/badges/gpa.svg)](https://codeclimate.com/github/vnegrisolo/cch)
|
8
9
|
[![Test Coverage](https://codeclimate.com/github/vnegrisolo/cch/badges/coverage.svg)](https://codeclimate.com/github/vnegrisolo/cch/coverage)
|
9
10
|
[![Dependency Status](https://gemnasium.com/vnegrisolo/cch.svg)](https://gemnasium.com/vnegrisolo/cch)
|
11
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/vnegrisolo/cch)
|
10
12
|
|
11
13
|
## Installation
|
12
14
|
|
@@ -18,8 +20,9 @@ Create a `Cchfile` on your project folder:
|
|
18
20
|
|
19
21
|
```ruby
|
20
22
|
Cch::Setup.tap do |setup|
|
21
|
-
setup.run :rspec
|
22
23
|
setup.run :rubocop
|
24
|
+
setup.run :haml_lint
|
25
|
+
setup.run :rspec
|
23
26
|
end
|
24
27
|
```
|
25
28
|
|
data/cch.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Vinicius Ferreira Negrisolo']
|
10
10
|
spec.email = ['vinicius.negrisolo@gmail.com']
|
11
11
|
|
12
|
-
spec.summary = 'cch - check on changes'
|
13
|
-
spec.description = 'cch - check on changes'
|
12
|
+
spec.summary = 'cch - check on changes for ruby projects'
|
13
|
+
spec.description = 'cch - check on changes for ruby projects'
|
14
14
|
spec.homepage = 'https://github.com/vnegrisolo/cch'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
data/config/Cchfile
CHANGED
@@ -12,7 +12,20 @@ Cch::Setup.tap do |setup|
|
|
12
12
|
runner.watch /\.rb$/
|
13
13
|
end
|
14
14
|
|
15
|
+
setup.add_runner :haml_lint do |runner|
|
16
|
+
runner.watch /\.haml$/
|
17
|
+
end
|
18
|
+
|
15
19
|
setup.add_runner :rspec do |runner|
|
16
20
|
runner.watch /_spec\.rb$/
|
21
|
+
|
22
|
+
runner.watch /^spec\/spec_helper.rb$/, proc { |m| %W(spec) }
|
23
|
+
runner.watch /^spec\/rails_helper.rb$/, proc { |m| %W(spec) }
|
24
|
+
runner.watch /^config\/routes.rb$/, proc { |m| %W(spec/routing) }
|
25
|
+
runner.watch /^app\/controllers\/application_controller.rb$/, proc { |m| %W(spec/controllers) }
|
26
|
+
|
27
|
+
runner.watch /^lib\/(.+)\.rb$/, proc { |m| %W(spec/#{m[1]}_spec.rb spec/lib/#{m[1]}_spec.rb) }
|
28
|
+
runner.watch /^app\/(.+)\.rb$/, proc { |m| %W(spec/#{m[1]}_spec.rb) }
|
29
|
+
runner.watch /^app\/controllers\/(.+)_(controller)\.rb$/, proc { |m| %W(spec/routing/#{m[1]}_routing_spec.rb spec/requests/#{m[1]}_spec.rb spec/features/#{m[1]}_spec.rb) }
|
17
30
|
end
|
18
31
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Cch
|
2
|
+
module Commands
|
3
|
+
module FileSystem
|
4
|
+
def filter_files(files, patterns)
|
5
|
+
filtered_files = patterns.flat_map do |pattern, transform|
|
6
|
+
find_matched_files(files, pattern, transform)
|
7
|
+
end
|
8
|
+
|
9
|
+
filtered_files = existing_files(filtered_files)
|
10
|
+
puts "=> #{filtered_files.size.to_s.color(:yellow)} files=#{filtered_files}"
|
11
|
+
filtered_files
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def find_matched_files(files, pattern, transform)
|
17
|
+
files.flat_map do |file|
|
18
|
+
matched = file.match(pattern)
|
19
|
+
transform ? transform.call(matched) : file if matched
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def existing_files(files)
|
24
|
+
files.flatten.compact.sort.uniq.select { |f| File.exist?(f) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/cch/runner.rb
CHANGED
@@ -1,35 +1,28 @@
|
|
1
1
|
module Cch
|
2
2
|
class Runner
|
3
3
|
include Commands::Shell
|
4
|
+
include Commands::FileSystem
|
4
5
|
|
5
6
|
attr_reader :name, :patterns
|
6
7
|
attr_accessor :command, :on
|
7
8
|
|
8
9
|
def initialize(name)
|
9
10
|
@name = name
|
10
|
-
@command = "bundle exec #{
|
11
|
+
@command = "bundle exec #{name} %{files}"
|
11
12
|
@on = false
|
12
|
-
@patterns =
|
13
|
+
@patterns = {}
|
13
14
|
end
|
14
15
|
|
15
|
-
def watch(pattern)
|
16
|
-
@patterns
|
16
|
+
def watch(pattern, transform = nil)
|
17
|
+
@patterns[pattern] = transform
|
17
18
|
end
|
18
19
|
|
19
20
|
def run(files)
|
20
|
-
puts "=> running #{
|
21
|
-
|
22
|
-
|
23
|
-
return unless run?(files)
|
21
|
+
puts "=> running #{name.to_s.color(:black, :green)}"
|
22
|
+
filtered_files = filter_files(files, patterns)
|
23
|
+
return unless run?(filtered_files)
|
24
24
|
|
25
|
-
system_command(
|
26
|
-
end
|
27
|
-
|
28
|
-
def filter_files(files)
|
29
|
-
filtered_files = patterns.flat_map { |pattern| files.grep(pattern) }
|
30
|
-
puts "=> filtered_files='#{filtered_files}'" if Setup.debug
|
31
|
-
|
32
|
-
filtered_files.sort.uniq.select { |f| File.exist?(f) }
|
25
|
+
system_command(command % { files: filtered_files.join(' ') })
|
33
26
|
end
|
34
27
|
|
35
28
|
def run?(files)
|
data/lib/cch/version.rb
CHANGED
data/lib/cch.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinicius Ferreira Negrisolo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: cch - check on changes
|
97
|
+
description: cch - check on changes for ruby projects
|
98
98
|
email:
|
99
99
|
- vinicius.negrisolo@gmail.com
|
100
100
|
executables:
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- cch.gemspec
|
122
122
|
- config/Cchfile
|
123
123
|
- lib/cch.rb
|
124
|
+
- lib/cch/commands/file_system.rb
|
124
125
|
- lib/cch/commands/shell.rb
|
125
126
|
- lib/cch/extensions/string.rb
|
126
127
|
- lib/cch/runner.rb
|
@@ -151,5 +152,5 @@ rubyforge_project:
|
|
151
152
|
rubygems_version: 2.4.5
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
|
-
summary: cch - check on changes
|
155
|
+
summary: cch - check on changes for ruby projects
|
155
156
|
test_files: []
|