cch 0.6.1 → 0.6.2
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 +8 -8
- data/README.md +44 -15
- data/cch.gemspec +2 -2
- data/lib/cch.rb +10 -1
- data/lib/cch/commands/file_system.rb +3 -1
- data/lib/cch/config/runners.rb +4 -0
- data/lib/cch/loggers/level.rb +1 -1
- data/lib/cch/runner.rb +3 -3
- data/lib/cch/setup.rb +15 -3
- data/lib/cch/version.rb +1 -1
- metadata +2 -4
- data/bin/cch_install +0 -14
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjNmMGRhYmFmY2QzNDg4ZGM5N2FhMzQwNTdlMWEzMTI2MmE5YWZiOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODdlYzFiMDE4NDQ1MzJhNTAwYWFiNzdmOWVlMjUzYzdlYzdiNzE1OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Mzc3ZjhmZDFlZTYyMGVkODUxZWIxOTFlOTEzMWMwMDI5YjY2ODQ2YWE0MjM3
|
10
|
+
OGE3OGIzM2ViNTRiMzQwMDUwMDNkM2I0MWI3OTdkZDFiMDkwZTVmZjczMjRm
|
11
|
+
MjUwN2Q5OWYyODM5NzY5MmU0MGM3NTJhNjI1YzUwMGIzZDIwMDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2RiNTdiOTQxMDE1YWViNDNhNmQ0MGExM2E5NWVhZTRjNThkOGM4MTQ2N2Qx
|
14
|
+
YWFjNjY4MTY1YjI1N2VjMWFjNTc3NzE5YTkwMWFiMTYwNTEzYzllMjUzM2I0
|
15
|
+
MjkzMGFlYjBmODZkMThjZDJkZmIyNDE3NmQ3NDQyOWNiYmVjZDc=
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# cch
|
2
|
-
CCH - Check on changes for ruby projects
|
2
|
+
**CCH** - Check on changes for ruby projects
|
3
|
+
|
4
|
+
**cch** will list all files that has been changed so far and run what you need with them (tests, code lints, etc).
|
5
|
+
|
6
|
+
In order words, it will use `git` to see the changes and then run a command like `rspec` with this files.
|
3
7
|
|
4
8
|
## gem status
|
5
9
|
|
@@ -16,18 +20,6 @@ CCH - Check on changes for ruby projects
|
|
16
20
|
gem install cch
|
17
21
|
```
|
18
22
|
|
19
|
-
Generates a `Cchfile` for your project configuration:
|
20
|
-
|
21
|
-
```shell
|
22
|
-
cch_install
|
23
|
-
```
|
24
|
-
|
25
|
-
Configure through the `Cchfile` what you want to run by **cch**:
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
Cch::Runner.run [:rubocop, :haml_lint, :rspec]
|
29
|
-
```
|
30
|
-
|
31
23
|
## Usage
|
32
24
|
|
33
25
|
```shell
|
@@ -40,6 +32,28 @@ Or on run time, you can specify the runners:
|
|
40
32
|
cch rspec rubocop
|
41
33
|
```
|
42
34
|
|
35
|
+
## Configuration
|
36
|
+
|
37
|
+
After running **cch** for the first time, the script will create a config file for you: `cchfile.rb`.
|
38
|
+
|
39
|
+
Configure through the `cchfile.rb` what you want to run by **cch**:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
Cch::Runner.run [:rubocop, :haml_lint, :rspec, :cucumber]
|
43
|
+
```
|
44
|
+
|
45
|
+
**Cch** comes with some basic configuration for:
|
46
|
+
|
47
|
+
- rspec
|
48
|
+
- rubocop
|
49
|
+
- haml_lint
|
50
|
+
- cucumber
|
51
|
+
|
52
|
+
You can create your own configuration in your `cchfile.rb`. Use the following configuration files as the base for it:
|
53
|
+
|
54
|
+
- [watcher](https://github.com/vnegrisolo/cch/blob/master/lib/cch/config/watchers.rb)
|
55
|
+
- [runners](https://github.com/vnegrisolo/cch/blob/master/lib/cch/config/runners.rb)
|
56
|
+
|
43
57
|
## Development
|
44
58
|
|
45
59
|
1. checking out the repo
|
@@ -48,9 +62,24 @@ cch rspec rubocop
|
|
48
62
|
|
49
63
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
50
64
|
|
51
|
-
|
65
|
+
### Install locally
|
66
|
+
|
67
|
+
```
|
68
|
+
bundle exec rake install
|
69
|
+
gem install --local pkg/cch*.gem
|
70
|
+
```
|
71
|
+
|
72
|
+
### Release a new version
|
73
|
+
|
74
|
+
Change `version.rb` file, commit, push and then:
|
75
|
+
|
76
|
+
```
|
77
|
+
bundle exec rake release
|
78
|
+
git push origin master
|
79
|
+
git push origin --tags
|
80
|
+
```
|
52
81
|
|
53
|
-
|
82
|
+
This will deploy a new release on [rubygems.org](https://rubygems.org/gems/cch).
|
54
83
|
|
55
84
|
## Contributing
|
56
85
|
|
data/cch.gemspec
CHANGED
@@ -23,10 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
end
|
24
24
|
|
25
25
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
-
f.match(%r{^(test|spec|features)/}) || f.match(
|
26
|
+
f.match(%r{^(test|spec|features)/}) || f.match('cchfile.rb')
|
27
27
|
end
|
28
28
|
spec.bindir = 'bin'
|
29
|
-
spec.executables = %w(cch
|
29
|
+
spec.executables = %w(cch)
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler'
|
data/lib/cch.rb
CHANGED
@@ -23,7 +23,16 @@ module Cch
|
|
23
23
|
setup.configure
|
24
24
|
|
25
25
|
files = Watcher.files
|
26
|
-
|
26
|
+
|
27
|
+
runners(args).each { |runner| runner.run(files) }
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def runners(args)
|
33
|
+
names = args.flatten.compact
|
34
|
+
query = names.any? ? { name: names } : { on?: true }
|
35
|
+
Runner.where(query)
|
27
36
|
end
|
28
37
|
end
|
29
38
|
end
|
@@ -15,7 +15,9 @@ module Cch
|
|
15
15
|
def find_matched_files(files, pattern, transform)
|
16
16
|
files.flat_map do |file|
|
17
17
|
matched = file.match(pattern)
|
18
|
-
|
18
|
+
if matched
|
19
|
+
transform ? transform.call(matched) : file
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
data/lib/cch/config/runners.rb
CHANGED
data/lib/cch/loggers/level.rb
CHANGED
data/lib/cch/runner.rb
CHANGED
@@ -20,10 +20,10 @@ module Cch
|
|
20
20
|
runners.values
|
21
21
|
end
|
22
22
|
|
23
|
-
def where(
|
23
|
+
def where(query = {})
|
24
24
|
runners = all
|
25
|
-
runners = runners.select(&:on) if
|
26
|
-
if (names = [
|
25
|
+
runners = runners.select(&:on) if query[:on?]
|
26
|
+
if (names = [query[:name]].flatten.compact).any?
|
27
27
|
runners = runners.select { |r| names.include?(r.name.to_s) }
|
28
28
|
end
|
29
29
|
|
data/lib/cch/setup.rb
CHANGED
@@ -1,11 +1,23 @@
|
|
1
1
|
module Cch
|
2
2
|
class Setup
|
3
|
+
LOCAL_CONFIG_FILE = '.cchfile.rb'.freeze
|
4
|
+
CONFIG_FILES = %w(watchers runners).freeze
|
5
|
+
|
3
6
|
def configure
|
4
|
-
|
5
|
-
require "cch/config/#{
|
7
|
+
CONFIG_FILES.each do |file|
|
8
|
+
require "cch/config/#{file}"
|
6
9
|
end
|
7
10
|
|
8
|
-
|
11
|
+
generate_local_config unless File.exist?(LOCAL_CONFIG_FILE)
|
12
|
+
|
13
|
+
load(LOCAL_CONFIG_FILE, true)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def generate_local_config
|
19
|
+
file_content = "#{Runner.name}.run #{Runner.runners.keys}"
|
20
|
+
File.open(LOCAL_CONFIG_FILE, 'w') { |f| f.write file_content }
|
9
21
|
end
|
10
22
|
end
|
11
23
|
end
|
data/lib/cch/version.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.6.
|
4
|
+
version: 0.6.2
|
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: 2016-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,7 +99,6 @@ email:
|
|
99
99
|
- vinicius.negrisolo@gmail.com
|
100
100
|
executables:
|
101
101
|
- cch
|
102
|
-
- cch_install
|
103
102
|
extensions: []
|
104
103
|
extra_rdoc_files: []
|
105
104
|
files:
|
@@ -115,7 +114,6 @@ files:
|
|
115
114
|
- README.md
|
116
115
|
- Rakefile
|
117
116
|
- bin/cch
|
118
|
-
- bin/cch_install
|
119
117
|
- bin/console
|
120
118
|
- bin/setup
|
121
119
|
- cch.gemspec
|
data/bin/cch_install
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
5
|
-
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
6
|
-
|
7
|
-
file_content = <<STRING
|
8
|
-
# Cch.logger.threshold = :info
|
9
|
-
# Cch.logger.implementation = Cch::Loggers::Stdout.new
|
10
|
-
|
11
|
-
Cch::Runner.run [:rubocop, :haml_lint, :rspec]
|
12
|
-
STRING
|
13
|
-
|
14
|
-
File.open('Cchfile', 'w') { |file| file.write file_content }
|