forgitter 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -9
- data/bin/forgitter +1 -1
- data/data/github/Delphi.gitignore +1 -0
- data/data/github/Global/JetBrains.gitignore +1 -1
- data/data/github/Global/SBT.gitignore +2 -2
- data/data/github/Mercury.gitignore +1 -0
- data/data/github/Rust.gitignore +5 -0
- data/data/github/Symfony2.gitignore +21 -13
- data/data/github/VisualStudio.gitignore +2 -1
- data/forgitter.gemspec +1 -1
- data/lib/forgitter/cli/option_parser.rb +3 -14
- data/lib/forgitter/{types.rb → ignorefiles.rb} +35 -29
- data/lib/forgitter/options.rb +2 -3
- data/lib/forgitter/runner.rb +6 -14
- data/lib/forgitter/version.rb +1 -1
- data/lib/forgitter.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0416ac5e002a07f506752eed1cc27a1272616c2
|
4
|
+
data.tar.gz: 7ee5c5bd1f330fcd4ba78842a977af9418b3f236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f6fc9f1557e599a8d3eab33cbe7fdb663c7702c75a5786edce12ec9537a91fce311970056b0665a52de0c290b6e3ef718009944ab5169a56e5e4a3da9c3074b
|
7
|
+
data.tar.gz: 56ffc8c885aaad81c80ff7f7ecbaccb0d6b1e0089a3f835082dab4a5c7467aff5413bba6d495e91fcf4199d606b429afc5782bd85589c3e553324584d20e735c
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Forgitter
|
2
2
|
|
3
|
-
Forgitter is a .gitignore generator. It
|
4
|
-
https://github.com/github/gitignore
|
5
|
-
locally. The \*.gitignore files are distributed with this gem for convenience.
|
3
|
+
Forgitter is a .gitignore generator. It is based on the ignorefiles found at
|
4
|
+
https://github.com/github/gitignore.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -20,16 +19,40 @@ Or install it yourself as:
|
|
20
19
|
|
21
20
|
## Usage
|
22
21
|
|
23
|
-
To generate a .gitignore
|
22
|
+
To generate a .gitignore, run:
|
24
23
|
|
25
|
-
forgitter
|
24
|
+
forgitter TAG1 [TAG2 ...]
|
26
25
|
|
27
|
-
Where
|
28
|
-
complete list of available types by running:
|
26
|
+
Where TAG1, TAG2, etc. are tags that correspond to .gitignore files, e.g.,
|
29
27
|
|
30
|
-
|
28
|
+
> $ forgitter vim
|
29
|
+
> # github/Global/vim.gitignore
|
30
|
+
> [._]*.s[a-w][a-z]
|
31
|
+
> [._]s[a-w][a-z]
|
32
|
+
> *.un~
|
33
|
+
> Session.vim
|
34
|
+
> .netrwhist
|
35
|
+
> *~
|
31
36
|
|
32
|
-
|
37
|
+
By default, this will output to the standard output stream. You can redirect
|
38
|
+
this to a file using one of the following:
|
39
|
+
|
40
|
+
forgitter TAG1 [TAG2 ...] > .gitignore # overwrite
|
41
|
+
forgitter TAG1 [TAG2 ...] >> .gitignore # append
|
42
|
+
|
43
|
+
To see a list of ignorefiles that match specific tags, run:
|
44
|
+
|
45
|
+
forgitter -l TAG1 [TAG2 ...]
|
46
|
+
|
47
|
+
> $ forgitter -l rails
|
48
|
+
> cloudspace rails chefcookbook cloudspace/rails/ChefCookbook.gitignore
|
49
|
+
> cloudspace rails linux cloudspace/rails/Linux.gitignore
|
50
|
+
> cloudspace rails rails cloudspace/rails/Rails.gitignore
|
51
|
+
> cloudspace rails ruby cloudspace/rails/Ruby.gitignore
|
52
|
+
> github rails github/Rails.gitignore
|
53
|
+
|
54
|
+
Running `forgitter -l` without arguments will list all available
|
55
|
+
ignorefiles.
|
33
56
|
|
34
57
|
## Contributing
|
35
58
|
|
data/bin/forgitter
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
-
#
|
2
|
-
app/
|
1
|
+
# Cache and logs
|
2
|
+
/app/cache/*
|
3
|
+
/app/logs/*
|
4
|
+
!app/cache/.gitkeep
|
5
|
+
!app/logs/.gitkeep
|
3
6
|
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
*/cache/*
|
8
|
-
web/uploads/*
|
9
|
-
web/bundles/*
|
7
|
+
# Parameters
|
8
|
+
/app/config/parameters.yml
|
9
|
+
/app/config/parameters.ini
|
10
10
|
|
11
|
-
#
|
12
|
-
app/
|
13
|
-
|
11
|
+
# Managed by Composer
|
12
|
+
/app/bootstrap.php.cache
|
13
|
+
/bin/
|
14
|
+
/vendor/
|
14
15
|
|
15
|
-
#
|
16
|
-
|
16
|
+
# Assets and user uploads
|
17
|
+
/web/bundles/
|
18
|
+
/web/uploads/
|
19
|
+
|
20
|
+
# PHPUnit
|
21
|
+
/app/phpunit.xml
|
22
|
+
|
23
|
+
# Composer PHAR
|
24
|
+
/composer.phar
|
@@ -129,8 +129,9 @@ publish/
|
|
129
129
|
## passwords
|
130
130
|
*.pubxml
|
131
131
|
|
132
|
-
# NuGet Packages
|
132
|
+
# NuGet Packages
|
133
133
|
packages/*
|
134
|
+
*.nupkg
|
134
135
|
## TODO: If the tool you use requires repositories.config
|
135
136
|
## uncomment the next line
|
136
137
|
#!packages/repositories.config
|
data/forgitter.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Adam Dunson', 'Jeremiah Hemphill']
|
10
10
|
spec.email = ['adam@cloudspace.com', 'jeremiah@cloudspace.com']
|
11
11
|
spec.summary = %q{Forgitter is a .gitignore generator.}
|
12
|
-
spec.description = %q{Forgitter is a .gitignore generator. It
|
12
|
+
spec.description = %q{Forgitter is a .gitignore generator. It is based on the ignorefiles found at https://github.com/github/gitignore.}
|
13
13
|
spec.homepage = ''
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -13,24 +13,13 @@ module Forgitter
|
|
13
13
|
@options = Forgitter::DEFAULT_OPTIONS
|
14
14
|
|
15
15
|
@opt_parser = ::OptionParser.new do |opts|
|
16
|
-
opts.banner = 'Usage: forgitter TAG1 [TAG2 ...]'
|
17
|
-
|
18
|
-
opts.separator ''
|
19
|
-
opts.separator 'Specific options:'
|
16
|
+
opts.banner = 'Usage: forgitter [-l] TAG1 [TAG2 ...]'
|
20
17
|
|
21
18
|
opts.on('-l', '--list',
|
22
|
-
'Instead of generating a .gitignore, list the
|
19
|
+
'Instead of generating a .gitignore, list the ignorefiles that match the tags.') do
|
23
20
|
options[:list] = true
|
24
21
|
end
|
25
22
|
|
26
|
-
opts.on('-c', '--stdout',
|
27
|
-
'Write the combined .gitignore to the standard output stream and not to disk.') do
|
28
|
-
options[:stdout] = true
|
29
|
-
end
|
30
|
-
|
31
|
-
opts.separator ''
|
32
|
-
opts.separator 'Common options:'
|
33
|
-
|
34
23
|
# No argument, shows at tail. This will print an options summary.
|
35
24
|
# Try it and see!
|
36
25
|
opts.on_tail('-h', '--help', 'Show this message') do
|
@@ -51,7 +40,7 @@ module Forgitter
|
|
51
40
|
opt_parser.help
|
52
41
|
end
|
53
42
|
|
54
|
-
|
43
|
+
##
|
55
44
|
# Return a structure describing the options.
|
56
45
|
#
|
57
46
|
def parse(args)
|
@@ -10,31 +10,31 @@ module Forgitter
|
|
10
10
|
end
|
11
11
|
|
12
12
|
##
|
13
|
-
# Filter
|
13
|
+
# Filter ignorefiles by tags.
|
14
14
|
#
|
15
|
-
# If tags is empty, this will return all
|
15
|
+
# If tags is empty, this will return all ignorefiles.
|
16
16
|
#
|
17
17
|
# @param [Hash] the hash of options containing tag strings
|
18
|
-
# @return [Array] the array of filtered
|
18
|
+
# @return [Array] the array of filtered ignorefiles
|
19
19
|
#
|
20
|
-
def self.
|
21
|
-
return
|
20
|
+
def self.filter(options = {})
|
21
|
+
return ignorefiles if options[:tags].empty?
|
22
22
|
|
23
|
-
|
23
|
+
ignorefiles.select do |ignorefile|
|
24
24
|
selected = true
|
25
25
|
options[:tags].uniq.each do |tag|
|
26
|
-
selected &&=
|
26
|
+
selected &&= ignorefile[:tags].count(tag) >= options[:tags].count(tag)
|
27
27
|
end
|
28
28
|
selected
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
##
|
33
|
-
# Fetch all available
|
33
|
+
# Fetch all available ignorefile paths, relative to the DATA_PATH.
|
34
34
|
#
|
35
35
|
# .gitignore files placed directly under DATA_PATH are ignored.
|
36
36
|
#
|
37
|
-
# @return [Array] the array of available
|
37
|
+
# @return [Array] the array of available ignorefile paths
|
38
38
|
#
|
39
39
|
def self.paths
|
40
40
|
@@paths ||= Dir["#{DATA_PATH}/**/*.gitignore"].map do |path|
|
@@ -45,19 +45,19 @@ module Forgitter
|
|
45
45
|
end
|
46
46
|
|
47
47
|
##
|
48
|
-
# Pull a parameterized
|
48
|
+
# Pull a parameterized ignorefile out of the given path.
|
49
49
|
#
|
50
50
|
# @param [String] the path to a .gitignore file
|
51
|
-
# @return [String] the
|
51
|
+
# @return [String] the ignorefile
|
52
52
|
#
|
53
|
-
def self.
|
53
|
+
def self.ignorefile(path)
|
54
54
|
parameterize(File.basename(path).sub('.gitignore', ''))
|
55
55
|
end
|
56
56
|
|
57
57
|
##
|
58
58
|
# Pull parameterized tags out of the given path.
|
59
59
|
#
|
60
|
-
# If path does not contain a /, this just returns the
|
60
|
+
# If path does not contain a /, this just returns the ignorefile name in an array.
|
61
61
|
#
|
62
62
|
# @param [String] the path to a .gitignore file
|
63
63
|
# @return [Array] the tags
|
@@ -70,42 +70,48 @@ module Forgitter
|
|
70
70
|
parameterize(tag)
|
71
71
|
end
|
72
72
|
end
|
73
|
-
tags <<
|
73
|
+
tags << ignorefile(path)
|
74
74
|
tags
|
75
75
|
end
|
76
76
|
|
77
77
|
##
|
78
|
-
# Fetch all available
|
78
|
+
# Fetch all available ignorefiles.
|
79
79
|
#
|
80
|
-
# @return [Array] the array of available
|
80
|
+
# @return [Array] the array of available ignorefiles
|
81
81
|
#
|
82
|
-
def self.
|
83
|
-
unless defined?(@@
|
84
|
-
@@
|
82
|
+
def self.ignorefiles
|
83
|
+
unless defined?(@@ignorefiles) && !@@ignorefiles.empty?
|
84
|
+
@@ignorefiles = []
|
85
85
|
|
86
86
|
paths.each do |path|
|
87
|
-
@@
|
87
|
+
@@ignorefiles << {
|
88
88
|
:path => path,
|
89
|
-
:name =>
|
89
|
+
:name => ignorefile(path),
|
90
90
|
:tags => tags(path)
|
91
91
|
}
|
92
92
|
end
|
93
93
|
end
|
94
|
-
@@
|
94
|
+
@@ignorefiles
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
##
|
98
|
+
# Output a list of ignorefile tags along with the relative path to the gitignore,
|
99
|
+
# formatted into columns.
|
100
|
+
#
|
101
|
+
# @param [Array] tags The list of tags to filter.
|
102
|
+
#
|
103
|
+
def self.list(tags = [])
|
104
|
+
ignorefiles = filter({ :tags => tags })
|
105
|
+
if ignorefiles.empty?
|
106
|
+
puts 'No ignorefiles found!'
|
101
107
|
else
|
102
108
|
lines = []
|
103
109
|
col1size = 0
|
104
110
|
|
105
|
-
|
106
|
-
id =
|
111
|
+
ignorefiles.each do |ignorefile|
|
112
|
+
id = ignorefile[:tags].join(' ')
|
107
113
|
col1size = id.length if id.length > col1size
|
108
|
-
lines << [id,
|
114
|
+
lines << [id, ignorefile[:path]]
|
109
115
|
end
|
110
116
|
|
111
117
|
lines.sort_by { |line| line[0] }.each do |line|
|
data/lib/forgitter/options.rb
CHANGED
data/lib/forgitter/runner.rb
CHANGED
@@ -3,38 +3,30 @@ require 'forgitter'
|
|
3
3
|
module Forgitter
|
4
4
|
class Runner
|
5
5
|
def initialize(options = Forgitter::DEFAULT_OPTIONS)
|
6
|
-
@
|
7
|
-
@stdout = options[:stdout]
|
6
|
+
@ignorefiles = Forgitter.filter(options)
|
8
7
|
end
|
9
8
|
|
10
9
|
def run
|
11
10
|
failcnt = 0
|
12
11
|
output = ''
|
13
|
-
@
|
14
|
-
ignore_file = get_ignore_file(
|
12
|
+
@ignorefiles.each do |ignorefile|
|
13
|
+
ignore_file = get_ignore_file(ignorefile[:path])
|
15
14
|
if ignore_file
|
16
|
-
output += "#
|
15
|
+
output += "# #{ignorefile[:path]}\n"
|
17
16
|
output += ignore_file
|
18
17
|
else
|
19
18
|
failcnt += 1
|
20
19
|
end
|
21
20
|
end
|
22
|
-
exit(1) if failcnt == @
|
21
|
+
exit(1) if failcnt == @ignorefiles.length
|
23
22
|
|
24
|
-
|
25
|
-
puts output
|
26
|
-
else
|
27
|
-
File.open('.gitignore', 'w') do |file|
|
28
|
-
file.write(output)
|
29
|
-
end
|
30
|
-
end
|
23
|
+
puts output
|
31
24
|
end
|
32
25
|
|
33
26
|
private
|
34
27
|
|
35
28
|
# Given a filename on the gitignore repo, return a string with the contents of the file
|
36
29
|
def get_ignore_file(filename)
|
37
|
-
STDERR.puts "Using #{filename}"
|
38
30
|
begin
|
39
31
|
IO.read(File.join(DATA_PATH, filename))
|
40
32
|
rescue Errno::ENOENT
|
data/lib/forgitter/version.rb
CHANGED
data/lib/forgitter.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forgitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Dunson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -53,8 +53,8 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
-
description: Forgitter is a .gitignore generator. It
|
57
|
-
at https://github.com/github/gitignore
|
56
|
+
description: Forgitter is a .gitignore generator. It is based on the ignorefiles found
|
57
|
+
at https://github.com/github/gitignore.
|
58
58
|
email:
|
59
59
|
- adam@cloudspace.com
|
60
60
|
- jeremiah@cloudspace.com
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- data/github/Rails.gitignore
|
205
205
|
- data/github/RhodesRhomobile.gitignore
|
206
206
|
- data/github/Ruby.gitignore
|
207
|
+
- data/github/Rust.gitignore
|
207
208
|
- data/github/SCons.gitignore
|
208
209
|
- data/github/Sass.gitignore
|
209
210
|
- data/github/Scala.gitignore
|
@@ -237,9 +238,9 @@ files:
|
|
237
238
|
- lib/forgitter.rb
|
238
239
|
- lib/forgitter/cli.rb
|
239
240
|
- lib/forgitter/cli/option_parser.rb
|
241
|
+
- lib/forgitter/ignorefiles.rb
|
240
242
|
- lib/forgitter/options.rb
|
241
243
|
- lib/forgitter/runner.rb
|
242
|
-
- lib/forgitter/types.rb
|
243
244
|
- lib/forgitter/version.rb
|
244
245
|
homepage: ''
|
245
246
|
licenses:
|