cch 0.4.0 → 0.5.0
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/.gitignore +5 -31
- data/README.md +1 -1
- data/bin/cch_install +1 -1
- data/lib/cch.rb +5 -13
- data/lib/cch/config/logger.rb +2 -0
- data/lib/cch/config/runners.rb +21 -22
- data/lib/cch/config/watchers.rb +6 -8
- data/lib/cch/logger.rb +3 -3
- data/lib/cch/loggers/stdout.rb +1 -1
- data/lib/cch/runner.rb +31 -16
- data/lib/cch/setup.rb +4 -30
- data/lib/cch/version.rb +1 -1
- data/lib/cch/watcher.rb +8 -8
- metadata +3 -3
- data/Gemfile.lock +0 -62
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjJjYTgxOGI3ZWQwYzdkNzY0ZDczN2ZiYWM5NzNhNGQ3YzBkYzQxYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzdkYmZlOWFlNjVjNTM2N2ZlNzhiM2YzMWY3MTQwMzEyNzQyZDAxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2JlZGFkNDYxYTcwMTQwYzAwYTNmOTk0Njg0MDA5ZjFlNzVlZGFkZjg1MDUw
|
10
|
+
Njc4MjgwZDE1YmM5NjZkMDY2YWIyNTlhMzkyNDI1Y2E0ODE0YTIzZTRiMzY2
|
11
|
+
ZDBkYjQwOWFjYTJjMTdmNjNjZWMxZmZkYWU0ZTRlNTE4NDNiNzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2VmZmY4Y2U0MTgxYTcyMzZkOTgwZDFkZjI0MjU3YTg4NmMzOGE4NWRhOGIz
|
14
|
+
NWFjODc4MzlmZTVlY2Q1ODZmZGMxZGE5ZTEzYTA0M2I3N2FjMGM3ZmVjNTA4
|
15
|
+
MGMwMzcwYjQ2MjFmYTlhMzgxNDFmMDU0MTY1ZTRlODhjODljNzY=
|
data/.gitignore
CHANGED
@@ -1,35 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
4
5
|
/coverage/
|
5
|
-
/
|
6
|
+
/doc/
|
6
7
|
/pkg/
|
7
8
|
/spec/reports/
|
8
|
-
/test/tmp/
|
9
|
-
/test/version_tmp/
|
10
9
|
/tmp/
|
11
|
-
|
12
|
-
## Specific to RubyMotion:
|
13
|
-
.dat*
|
14
|
-
.repl_history
|
15
|
-
build/
|
16
|
-
|
17
|
-
## Documentation cache and generated files:
|
18
|
-
/.yardoc/
|
19
|
-
/_yardoc/
|
20
|
-
/doc/
|
21
|
-
/rdoc/
|
22
|
-
|
23
|
-
## Environment normalisation:
|
24
|
-
/.bundle/
|
25
|
-
/vendor/bundle
|
26
|
-
/lib/bundler/man/
|
27
|
-
|
28
|
-
# for a library or gem, you might want to ignore these files since the code is
|
29
|
-
# intended to run in multiple environments; otherwise, check them in:
|
30
|
-
# Gemfile.lock
|
31
|
-
# .ruby-version
|
32
|
-
# .ruby-gemset
|
33
|
-
|
34
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
-
.rvmrc
|
data/README.md
CHANGED
data/bin/cch_install
CHANGED
data/lib/cch.rb
CHANGED
@@ -14,26 +14,18 @@ require 'cch/setup'
|
|
14
14
|
module Cch
|
15
15
|
class << self
|
16
16
|
def logger
|
17
|
-
@logger ||= Logger.new
|
17
|
+
@logger ||= Logger.new
|
18
18
|
end
|
19
19
|
|
20
20
|
def setup
|
21
|
-
|
22
|
-
@setup = Setup
|
23
|
-
Setup.configure
|
24
|
-
@setup
|
21
|
+
@setup ||= Setup.new
|
25
22
|
end
|
26
23
|
|
27
24
|
def run(args = [])
|
28
|
-
|
29
|
-
files = Watcher.files
|
30
|
-
runners(args).each { |runner| runner.run(files) }
|
31
|
-
end
|
25
|
+
setup.configure
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
def runners(names)
|
36
|
-
Runner.where(on?: true, name: names)
|
27
|
+
files = Watcher.files
|
28
|
+
Runner.where(on?: true, name: args).each { |runner| runner.run(files) }
|
37
29
|
end
|
38
30
|
end
|
39
31
|
end
|
data/lib/cch/config/runners.rb
CHANGED
@@ -1,27 +1,26 @@
|
|
1
|
-
Cch.
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
Cch::Runner.configure :rubocop do |runner|
|
2
|
+
runner.watch(/\.rb$/)
|
3
|
+
runner.watch(/\.rake$/)
|
4
|
+
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
Cch::Runner.configure :haml_lint, gem: 'haml-lint' do |runner|
|
7
|
+
runner.watch(/\.haml$/)
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
Cch::Runner.configure :rspec do |runner|
|
11
|
+
runner.watch(/_spec\.rb$/)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
runner.watch(%r{^spec/spec_helper.rb$}, proc { %w(spec) })
|
14
|
+
runner.watch(%r{^spec/rails_helper.rb$}, proc { %w(spec) })
|
15
|
+
runner.watch(%r{^config/routes.rb$}, proc { %w(spec/routing) })
|
16
|
+
runner.watch(%r{^app/controllers/application_controller.rb$}, proc { %w(spec/controllers) })
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
18
|
+
runner.watch(%r{^lib/(.+)\.rb$}, proc { |m| %W(spec/#{m[1]}_spec.rb spec/lib/#{m[1]}_spec.rb) })
|
19
|
+
runner.watch(%r{^app/(.+)\.rb$}, proc { |m| %W(spec/#{m[1]}_spec.rb) })
|
20
|
+
runner.watch(
|
21
|
+
%r{^app/controllers/(.+)_(controller)\.rb$},
|
22
|
+
proc do |m|
|
23
|
+
%W(spec/routing/#{m[1]}_routing_spec.rb spec/requests/#{m[1]}_spec.rb spec/features/#{m[1]}_spec.rb)
|
24
|
+
end
|
25
|
+
)
|
27
26
|
end
|
data/lib/cch/config/watchers.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
Cch.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
]
|
8
|
-
end
|
1
|
+
Cch::Watcher.commands = [
|
2
|
+
'git diff --name-only',
|
3
|
+
'git diff --name-only --staged',
|
4
|
+
'git ls-files --others --exclude-standard',
|
5
|
+
'git diff --name-only ..master'
|
6
|
+
]
|
data/lib/cch/logger.rb
CHANGED
@@ -2,9 +2,9 @@ module Cch
|
|
2
2
|
class Logger
|
3
3
|
attr_accessor :threshold, :implementation
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@threshold = threshold
|
7
|
-
@implementation = implementation
|
5
|
+
def initialize(options = {})
|
6
|
+
@threshold = options[:threshold]
|
7
|
+
@implementation = options[:implementation]
|
8
8
|
end
|
9
9
|
|
10
10
|
Loggers::Level.all.each do |level_name, level|
|
data/lib/cch/loggers/stdout.rb
CHANGED
data/lib/cch/runner.rb
CHANGED
@@ -3,22 +3,36 @@ module Cch
|
|
3
3
|
include Commands::Shell
|
4
4
|
include Commands::FileSystem
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
class << self
|
7
|
+
attr_accessor :runners
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
def configure(runner, options = {})
|
10
|
+
@runners ||= {}
|
11
|
+
@runners[runner] = Runner.new(runner, options)
|
12
|
+
yield @runners.fetch(runner) if block_given?
|
13
|
+
end
|
14
|
+
|
15
|
+
def run(runners)
|
16
|
+
Array(runners).each { |runner| @runners.fetch(runner).on = true }
|
17
|
+
end
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
19
|
+
def all
|
20
|
+
runners.values
|
21
|
+
end
|
22
|
+
|
23
|
+
def where(options = {})
|
24
|
+
runners = all
|
25
|
+
runners = runners.select(&:on) if options[:on?]
|
26
|
+
if (names = [options[:name]].flatten.compact).size > 0
|
27
|
+
runners = runners.select { |r| names.include?(r.name) }
|
28
|
+
end
|
29
|
+
runners
|
18
30
|
end
|
19
|
-
runners
|
20
31
|
end
|
21
32
|
|
33
|
+
attr_reader :name, :patterns
|
34
|
+
attr_accessor :command, :on
|
35
|
+
|
22
36
|
def initialize(name, options = {})
|
23
37
|
@name = name
|
24
38
|
@command = "bundle exec #{options[:gem] || name} %{files}"
|
@@ -31,15 +45,16 @@ module Cch
|
|
31
45
|
end
|
32
46
|
|
33
47
|
def run(files)
|
34
|
-
|
35
|
-
|
36
|
-
return unless run?(filtered_files)
|
48
|
+
files = filter_files(files, patterns)
|
49
|
+
return unless run?(files)
|
37
50
|
|
38
|
-
system_command(command % { files:
|
51
|
+
system_command(command % { files: files.join(' ') })
|
39
52
|
end
|
40
53
|
|
41
54
|
def run?(files)
|
42
|
-
|
55
|
+
message = "running #{name.to_s.color(:black, :green)}"
|
56
|
+
message << " for #{files.size.to_s.color(:yellow)} files=#{files}"
|
57
|
+
Cch.logger.info(message)
|
43
58
|
files.size > 0
|
44
59
|
end
|
45
60
|
end
|
data/lib/cch/setup.rb
CHANGED
@@ -1,37 +1,11 @@
|
|
1
1
|
module Cch
|
2
2
|
class Setup
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def configure
|
8
|
-
require 'cch/config/watchers'
|
9
|
-
require 'cch/config/runners'
|
10
|
-
|
11
|
-
load_setup
|
12
|
-
Cch.logger.debug("setup\n#{inspect}")
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def inspect
|
17
|
-
ATTRIBUTES.map { |f| " #{f} = #{send(f)}" }.join("\n")
|
18
|
-
end
|
19
|
-
|
20
|
-
def add_runner(runner, options = {})
|
21
|
-
@runners ||= {}
|
22
|
-
@runners[runner] = Runner.new(runner, options)
|
23
|
-
yield @runners.fetch(runner) if block_given?
|
24
|
-
end
|
25
|
-
|
26
|
-
def run(runners)
|
27
|
-
Array(runners).each { |runner| @runners.fetch(runner).on = true }
|
3
|
+
def configure
|
4
|
+
%w(logger watchers runners).each do |config_file|
|
5
|
+
require "cch/config/#{config_file}"
|
28
6
|
end
|
29
7
|
|
30
|
-
|
31
|
-
|
32
|
-
def load_setup(file = 'Cchfile')
|
33
|
-
load(file, true) if File.exist?(file)
|
34
|
-
end
|
8
|
+
load('Cchfile', true) if File.exist?('Cchfile')
|
35
9
|
end
|
36
10
|
end
|
37
11
|
end
|
data/lib/cch/version.rb
CHANGED
data/lib/cch/watcher.rb
CHANGED
@@ -2,17 +2,17 @@ module Cch
|
|
2
2
|
class Watcher
|
3
3
|
include Commands::Shell
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
class << self
|
6
|
+
attr_accessor :commands
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
def files
|
9
|
+
new.files(commands)
|
10
|
+
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def files
|
14
|
-
files =
|
15
|
-
Cch.logger.info("
|
13
|
+
def files(commands)
|
14
|
+
files = commands.flat_map { |command| backtiq_command(command) }.compact.sort.uniq
|
15
|
+
Cch.logger.info("watching #{files.size.to_s.color(:yellow)} files=#{files}")
|
16
16
|
files
|
17
17
|
end
|
18
18
|
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.
|
4
|
+
version: 0.5.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-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,7 +111,6 @@ files:
|
|
111
111
|
- CODE_OF_CONDUCT.md
|
112
112
|
- CONTRIBUTING.md
|
113
113
|
- Gemfile
|
114
|
-
- Gemfile.lock
|
115
114
|
- LICENSE.md
|
116
115
|
- README.md
|
117
116
|
- Rakefile
|
@@ -123,6 +122,7 @@ files:
|
|
123
122
|
- lib/cch.rb
|
124
123
|
- lib/cch/commands/file_system.rb
|
125
124
|
- lib/cch/commands/shell.rb
|
125
|
+
- lib/cch/config/logger.rb
|
126
126
|
- lib/cch/config/runners.rb
|
127
127
|
- lib/cch/config/watchers.rb
|
128
128
|
- lib/cch/extensions/string.rb
|
data/Gemfile.lock
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
cch (0.4.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
ast (2.1.0)
|
10
|
-
astrolabe (1.3.1)
|
11
|
-
parser (~> 2.2)
|
12
|
-
codeclimate-test-reporter (0.4.8)
|
13
|
-
simplecov (>= 0.7.1, < 1.0.0)
|
14
|
-
diff-lcs (1.2.5)
|
15
|
-
docile (1.1.5)
|
16
|
-
json (1.8.3)
|
17
|
-
parser (2.2.2.6)
|
18
|
-
ast (>= 1.1, < 3.0)
|
19
|
-
powerpack (0.1.1)
|
20
|
-
rainbow (2.0.0)
|
21
|
-
rake (10.4.2)
|
22
|
-
rspec (3.3.0)
|
23
|
-
rspec-core (~> 3.3.0)
|
24
|
-
rspec-expectations (~> 3.3.0)
|
25
|
-
rspec-mocks (~> 3.3.0)
|
26
|
-
rspec-core (3.3.2)
|
27
|
-
rspec-support (~> 3.3.0)
|
28
|
-
rspec-expectations (3.3.1)
|
29
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.3.0)
|
31
|
-
rspec-mocks (3.3.2)
|
32
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.3.0)
|
34
|
-
rspec-support (3.3.0)
|
35
|
-
rubocop (0.34.0)
|
36
|
-
astrolabe (~> 1.3)
|
37
|
-
parser (>= 2.2.2.5, < 3.0)
|
38
|
-
powerpack (~> 0.1)
|
39
|
-
rainbow (>= 1.99.1, < 3.0)
|
40
|
-
ruby-progressbar (~> 1.4)
|
41
|
-
ruby-progressbar (1.7.5)
|
42
|
-
simplecov (0.10.0)
|
43
|
-
docile (~> 1.1.0)
|
44
|
-
json (~> 1.8)
|
45
|
-
simplecov-html (~> 0.10.0)
|
46
|
-
simplecov-html (0.10.0)
|
47
|
-
yard (0.8.7.6)
|
48
|
-
|
49
|
-
PLATFORMS
|
50
|
-
ruby
|
51
|
-
|
52
|
-
DEPENDENCIES
|
53
|
-
bundler (~> 1.10)
|
54
|
-
cch!
|
55
|
-
codeclimate-test-reporter
|
56
|
-
rake (~> 10.0)
|
57
|
-
rspec
|
58
|
-
rubocop
|
59
|
-
yard
|
60
|
-
|
61
|
-
BUNDLED WITH
|
62
|
-
1.10.6
|