cch 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2I3OWFlNmJhNmQ0OTljNGY3ZDNkMmEwOTkyMjQzNTQ5MTc0MjRmNg==
4
+ MjNmMGRhYmFmY2QzNDg4ZGM5N2FhMzQwNTdlMWEzMTI2MmE5YWZiOQ==
5
5
  data.tar.gz: !binary |-
6
- ZDczNTQ2ZGQxMDJhMjQ1YmQxMDJmZjhlZDY2ZmY4ZGUxYTdjNjg1Mg==
6
+ ODdlYzFiMDE4NDQ1MzJhNTAwYWFiNzdmOWVlMjUzYzdlYzdiNzE1OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Nzk5NmViZWYwNDk3YjQ3NTcyNzQ3OTc5MjViYWM0NDc4Zjc1ZDY3MjlmNDY0
10
- N2JkNGU5Y2VmYzJiMDQxNDdjYTVlNjFkNjRmYzNkNGU1ODU5YWI0NTI1MWU1
11
- YWU3MDQwNmFhNzc4NWFhMzBkZjk3MTFiZjBhYzM1ZjAyZTI0ZDk=
9
+ Mzc3ZjhmZDFlZTYyMGVkODUxZWIxOTFlOTEzMWMwMDI5YjY2ODQ2YWE0MjM3
10
+ OGE3OGIzM2ViNTRiMzQwMDUwMDNkM2I0MWI3OTdkZDFiMDkwZTVmZjczMjRm
11
+ MjUwN2Q5OWYyODM5NzY5MmU0MGM3NTJhNjI1YzUwMGIzZDIwMDU=
12
12
  data.tar.gz: !binary |-
13
- YjlmNTgzYjIyY2NkNmYzYmFmNjNhZmE0OTEzOTgwZjQyOGQ1NThkM2EzYjM3
14
- MzMwMjcyZDIyNGZlNGI5ZjM3MmEzMDA1YmIwOGVlZDI5MGUzZWNlZTE5NTBl
15
- ZDExMjZiMGRiZmJmYjMxNTU3ODYyZjY1ZDQxZmY2YWU4NDljMDc=
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
- To install this gem onto your local machine, run `bundle exec rake install`.
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
- 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/gems/cch).
82
+ This will deploy a new release on [rubygems.org](https://rubygems.org/gems/cch).
54
83
 
55
84
  ## Contributing
56
85
 
@@ -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(/^Cchfile$/)
26
+ f.match(%r{^(test|spec|features)/}) || f.match('cchfile.rb')
27
27
  end
28
28
  spec.bindir = 'bin'
29
- spec.executables = %w(cch cch_install)
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
- Runner.where(on?: true, name: args).each { |runner| runner.run(files) }
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
- transform ? transform.call(matched) : file if matched
18
+ if matched
19
+ transform ? transform.call(matched) : file
20
+ end
19
21
  end
20
22
  end
21
23
 
@@ -27,3 +27,7 @@ Cch::Runner.configure :rspec do |runner|
27
27
  end
28
28
  )
29
29
  end
30
+
31
+ Cch::Runner.configure :cucumber do |runner|
32
+ runner.watch(/\.feature$/)
33
+ end
@@ -1,7 +1,7 @@
1
1
  module Cch
2
2
  module Loggers
3
3
  class Level
4
- LEVELS = [:debug, :info, :error].freeze
4
+ LEVELS = [:debug, :info, :warning, :error].freeze
5
5
 
6
6
  def self.all
7
7
  return @levels if @levels
@@ -20,10 +20,10 @@ module Cch
20
20
  runners.values
21
21
  end
22
22
 
23
- def where(options = {})
23
+ def where(query = {})
24
24
  runners = all
25
- runners = runners.select(&:on) if options[:on?]
26
- if (names = [options[:name]].flatten.compact).any?
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
 
@@ -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
- %w(watchers runners).each do |config_file|
5
- require "cch/config/#{config_file}"
7
+ CONFIG_FILES.each do |file|
8
+ require "cch/config/#{file}"
6
9
  end
7
10
 
8
- load('Cchfile', true) if File.exist?('Cchfile')
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
@@ -1,3 +1,3 @@
1
1
  module Cch
2
- VERSION = '0.6.1'.freeze
2
+ VERSION = '0.6.2'.freeze
3
3
  end
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.1
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-02-06 00:00:00.000000000 Z
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
@@ -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 }