cch 0.5.0 → 0.6.0

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
- MjJjYTgxOGI3ZWQwYzdkNzY0ZDczN2ZiYWM5NzNhNGQ3YzBkYzQxYg==
4
+ M2E2ODk5YTcwYmVmYTBhZDRlYWYxOTI2ZjEyZDM1ZWRiN2NkZWQ3Mg==
5
5
  data.tar.gz: !binary |-
6
- MzdkYmZlOWFlNjVjNTM2N2ZlNzhiM2YzMWY3MTQwMzEyNzQyZDAxMg==
6
+ YzUzOGRkMjRjZTE3OWVjMjE0MGY5YjAxZWZmZWViODQ0OTJkZGQ1OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2JlZGFkNDYxYTcwMTQwYzAwYTNmOTk0Njg0MDA5ZjFlNzVlZGFkZjg1MDUw
10
- Njc4MjgwZDE1YmM5NjZkMDY2YWIyNTlhMzkyNDI1Y2E0ODE0YTIzZTRiMzY2
11
- ZDBkYjQwOWFjYTJjMTdmNjNjZWMxZmZkYWU0ZTRlNTE4NDNiNzQ=
9
+ MGEwM2IzYzE5NjI5N2RiZDA1NTFlM2VkN2RiN2QyYzFmZGMwM2MzNDg5ZDIw
10
+ MDkyYWVmOWNhMGU4ZjY4NjY4MDI4ZWY5N2U3NTcwNjM2MDg5ZTJhMGI5NzA0
11
+ MzRjNWJkODdjMzg4Yjk0MjRhOWQ4M2RmMzAyYjQzNThmOTczMjU=
12
12
  data.tar.gz: !binary |-
13
- M2VmZmY4Y2U0MTgxYTcyMzZkOTgwZDFkZjI0MjU3YTg4NmMzOGE4NWRhOGIz
14
- NWFjODc4MzlmZTVlY2Q1ODZmZGMxZGE5ZTEzYTA0M2I3N2FjMGM3ZmVjNTA4
15
- MGMwMzcwYjQ2MjFmYTlhMzgxNDFmMDU0MTY1ZTRlODhjODljNzY=
13
+ NGE2YTlmMzMwYzQ5MzUwZmY4MjgzODIwNWNjMWM1ZjM2ZDY5ZjExODgyOGVh
14
+ MjExM2FhZTFiYTIxOWJlNGI3MjJjMjZhYmM3MjZhYzYwMGU5OWU2OTlhNDY1
15
+ YjdlNzc3N2U4MTczNGM2OTQ2YTliYjA4YzAwNGU2YzI0ZTBmMGE=
@@ -8,7 +8,7 @@ rvm:
8
8
  - 2.2.2
9
9
  git:
10
10
  depth: 1
11
- before_install: gem install bundler -v 1.10.6
11
+ before_install: gem install bundler
12
12
  script:
13
13
  - bundle exec yard
14
14
  - bundle exec rubocop
@@ -4,8 +4,11 @@
4
4
  lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
5
5
  $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
6
6
 
7
- File.open('Cchfile', 'w') do |file|
8
- file.write <<STRING
9
- Cch::Runner.run [:rubocop, :haml_lint, :rspec]
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]
10
12
  STRING
11
- end
13
+
14
+ File.open('Cchfile', 'w') { |file| file.write file_content }
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  if spec.respond_to?(:metadata)
20
20
  spec.metadata['allowed_push_host'] = 'https://github.com/vnegrisolo/cch'
21
21
  else
22
- fail 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
22
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
23
23
  end
24
24
 
25
25
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = %w(cch cch_install)
30
30
  spec.require_paths = ['lib']
31
31
 
32
- spec.add_development_dependency 'bundler', '~> 1.10'
33
- spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'bundler'
33
+ spec.add_development_dependency 'rake'
34
34
  spec.add_development_dependency 'yard'
35
35
  spec.add_development_dependency 'rubocop'
36
36
  spec.add_development_dependency 'rspec'
data/lib/cch.rb CHANGED
@@ -6,8 +6,6 @@ require 'cch/commands/shell'
6
6
  require 'cch/commands/file_system'
7
7
  require 'cch/watcher'
8
8
  require 'cch/runner'
9
- require 'cch/loggers/level'
10
- require 'cch/loggers/stdout'
11
9
  require 'cch/logger'
12
10
  require 'cch/setup'
13
11
 
@@ -6,7 +6,8 @@ module Cch
6
6
  find_matched_files(files, pattern, transform)
7
7
  end
8
8
 
9
- existing_files(filtered_files)
9
+ filtered_files = existing_files(filtered_files)
10
+ compact(filtered_files)
10
11
  end
11
12
 
12
13
  private
@@ -21,6 +22,16 @@ module Cch
21
22
  def existing_files(files)
22
23
  files.flatten.compact.sort.uniq.select { |f| File.exist?(f) }
23
24
  end
25
+
26
+ def compact(files)
27
+ files.map { |file| file unless sub_file?(files, file) }.compact
28
+ end
29
+
30
+ def sub_file?(files, file)
31
+ files.each { |f| return true if file != f && file.start_with?(f) }
32
+
33
+ false
34
+ end
24
35
  end
25
36
  end
26
37
  end
@@ -12,8 +12,11 @@ Cch::Runner.configure :rspec do |runner|
12
12
 
13
13
  runner.watch(%r{^spec/spec_helper.rb$}, proc { %w(spec) })
14
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) })
15
+ runner.watch(%r{^config/routes.rb$}, proc { %w(spec/routing spec/requests) })
16
+ runner.watch(
17
+ %r{^app/controllers/application_controller.rb$},
18
+ proc { %w(spec/controllers spec/requests) }
19
+ )
17
20
 
18
21
  runner.watch(%r{^lib/(.+)\.rb$}, proc { |m| %W(spec/#{m[1]}_spec.rb spec/lib/#{m[1]}_spec.rb) })
19
22
  runner.watch(%r{^app/(.+)\.rb$}, proc { |m| %W(spec/#{m[1]}_spec.rb) })
@@ -1,10 +1,13 @@
1
+ require 'cch/loggers/level'
2
+ require 'cch/loggers/stdout'
3
+
1
4
  module Cch
2
5
  class Logger
3
6
  attr_accessor :threshold, :implementation
4
7
 
5
8
  def initialize(options = {})
6
- @threshold = options[:threshold]
7
- @implementation = options[:implementation]
9
+ @threshold = options[:threshold] || :info
10
+ @implementation = options[:implementation] || Loggers::Stdout.new
8
11
  end
9
12
 
10
13
  Loggers::Level.all.each do |level_name, level|
@@ -16,7 +19,7 @@ module Cch
16
19
  private
17
20
 
18
21
  def log(level, message)
19
- return unless implementation && level.allowed?(threshold)
22
+ return unless level.allowed?(threshold)
20
23
 
21
24
  implementation.log(level, message)
22
25
  end
@@ -1,7 +1,7 @@
1
1
  module Cch
2
2
  module Loggers
3
3
  class Level
4
- LEVELS = [:debug, :info, :error]
4
+ LEVELS = [:debug, :info, :error].freeze
5
5
 
6
6
  def self.all
7
7
  return @levels if @levels
@@ -23,7 +23,7 @@ module Cch
23
23
  def where(options = {})
24
24
  runners = all
25
25
  runners = runners.select(&:on) if options[:on?]
26
- if (names = [options[:name]].flatten.compact).size > 0
26
+ if (names = [options[:name]].flatten.compact).any?
27
27
  runners = runners.select { |r| names.include?(r.name) }
28
28
  end
29
29
  runners
@@ -55,7 +55,7 @@ module Cch
55
55
  message = "running #{name.to_s.color(:black, :green)}"
56
56
  message << " for #{files.size.to_s.color(:yellow)} files=#{files}"
57
57
  Cch.logger.info(message)
58
- files.size > 0
58
+ files.any?
59
59
  end
60
60
  end
61
61
  end
@@ -1,7 +1,7 @@
1
1
  module Cch
2
2
  class Setup
3
3
  def configure
4
- %w(logger watchers runners).each do |config_file|
4
+ %w(watchers runners).each do |config_file|
5
5
  require "cch/config/#{config_file}"
6
6
  end
7
7
 
@@ -1,3 +1,3 @@
1
1
  module Cch
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.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-20 00:00:00.000000000 Z
11
+ date: 2016-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +122,6 @@ files:
122
122
  - lib/cch.rb
123
123
  - lib/cch/commands/file_system.rb
124
124
  - lib/cch/commands/shell.rb
125
- - lib/cch/config/logger.rb
126
125
  - lib/cch/config/runners.rb
127
126
  - lib/cch/config/watchers.rb
128
127
  - lib/cch/extensions/string.rb
@@ -1,2 +0,0 @@
1
- Cch.logger.threshold = :info
2
- Cch.logger.implementation = Cch::Loggers::Stdout.new