ignorefile 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7492f7b48a8963b2b302b5e37928597df3195f01
4
+ data.tar.gz: 32b6c6e44f836e6b8c2149d78495f08b7121da10
5
+ SHA512:
6
+ metadata.gz: 8b589b56496ba3cb3f5d9760afa422e59c0ae0632397a06653ab3cc2a2d4faaa951c026ef34f86203623918451a9caf270a4d2ec1a185c8fe43956ac618bb85c
7
+ data.tar.gz: 9876ae8ccfc33133543a39ce4f37e3596c0d5281fe4803959b56975de84e29fbcc209e18a8c1dee182409f21f505e8d6c4c94e1162e90d9cceb229674e29d9f0
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ Exclude:
3
+ - libraries/**/*
4
+ - spec/**/*
5
+ - metadata.rb
6
+
7
+ Encoding:
8
+ Enabled: false
9
+ LineLength:
10
+ Enabled: false
11
+ HashSyntax:
12
+ Enabled: false
13
+ RescueModifier:
14
+ Enabled: false
15
+ MethodLength:
16
+ Max: 24
17
+ AbcSize:
18
+ Max: 60
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ignorefile.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 John Manero
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # Ignorefile
2
+ Compile a set of ignore statements from files and code.
3
+
4
+ ## Usage
5
+
6
+ ```ruby
7
+ reqire 'ignorefile'
8
+
9
+ cookbook_files = Dir.glob('**/{*,.*}')
10
+ ignore = IgnoreFile.new('.gitignore', 'chefignore', ['.git/*'])
11
+
12
+ ignore.apply!(cookbook_files)
13
+ ```
14
+
15
+ ## Thanks
16
+ This gem is based upon Seth Vargo's [buff-ignore](https://github.com/sethvargo/buff-ignore).
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bundler'
4
+ require 'bundler/setup'
5
+ require 'thor/scmversion'
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'ignorefile/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'ignorefile'
9
+ spec.version = IgnoreFile::VERSION
10
+ spec.authors = ['John Manero']
11
+ spec.email = ['john.manero@gmail.com']
12
+ spec.summary = 'Compile a set of ignore statements from files and code'
13
+ spec.description = IO.read(File.expand_path('../README.md', __FILE__)) rescue ''
14
+ spec.homepage = 'https://github.com/jmanero/ignorefile'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files`.split("\n")
18
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.7'
23
+ spec.add_development_dependency 'thor-scmversion', '1.7.0'
24
+ end
@@ -0,0 +1,48 @@
1
+ ##
2
+ # Ignore things
3
+ ##
4
+ class IgnoreFile
5
+ attr_reader :statements
6
+ COMMENT_OR_WHITESPACE = /^\s*(?:#.*)?$/.freeze
7
+
8
+ def initialize(*args)
9
+ @statements = []
10
+
11
+ args.each do |arg|
12
+ case
13
+ when arg.is_a?(Array) then push(arg)
14
+ when File.exist?(arg) then load_file(arg)
15
+ else push(arg)
16
+ end
17
+ end
18
+ end
19
+
20
+ def push(*arg)
21
+ statements.push(*arg.flatten.map(&:strip))
22
+ statements.sort!
23
+ statements.uniq!
24
+ end
25
+ alias_method :<<, :push
26
+
27
+ def load_file(ifile)
28
+ push(File.readlines(ifile).map(&:strip).reject do |line|
29
+ line.empty? || line =~ COMMENT_OR_WHITESPACE
30
+ end)
31
+ end
32
+
33
+ def ignored?(file)
34
+ statements.any? { |statement| File.fnmatch?(statement, file) }
35
+ end
36
+
37
+ def apply(*files)
38
+ files.flatten.reject do |file|
39
+ file.strip.empty? || ignored?(file)
40
+ end
41
+ end
42
+
43
+ def apply!(files)
44
+ files.reject! do |file|
45
+ file.strip.empty? || ignored?(file)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,6 @@
1
+ #
2
+ class IgnoreFile
3
+ VERSION = IO.read(
4
+ File.expand_path(
5
+ '../../../VERSION', __FILE__)) rescue '0.0.1'
6
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ignorefile
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - John Manero
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor-scmversion
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.7.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.7.0
41
+ description: |
42
+ # Ignorefile
43
+ Compile a set of ignore statements from files and code.
44
+
45
+ ## Usage
46
+
47
+ ```ruby
48
+ reqire 'ignorefile'
49
+
50
+ cookbook_files = Dir.glob('**/{*,.*}')
51
+ ignore = IgnoreFile.new('.gitignore', 'chefignore', ['.git/*'])
52
+
53
+ ignore.apply!(cookbook_files)
54
+ ```
55
+
56
+ ## Thanks
57
+ This gem is based upon Seth Vargo's [buff-ignore](https://github.com/sethvargo/buff-ignore).
58
+ email:
59
+ - john.manero@gmail.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - .gitignore
65
+ - .rubocop.yml
66
+ - Gemfile
67
+ - LICENSE
68
+ - README.md
69
+ - Thorfile
70
+ - ignorefile.gemspec
71
+ - lib/ignorefile.rb
72
+ - lib/ignorefile/version.rb
73
+ homepage: https://github.com/jmanero/ignorefile
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.0.14
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Compile a set of ignore statements from files and code
97
+ test_files: []