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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9944c607aa9d114563a1a6ea8b5a69675c1e4371
4
- data.tar.gz: 344b690701befbecbb7ab2b34fb5bc8288a00015
3
+ metadata.gz: e0416ac5e002a07f506752eed1cc27a1272616c2
4
+ data.tar.gz: 7ee5c5bd1f330fcd4ba78842a977af9418b3f236
5
5
  SHA512:
6
- metadata.gz: 0326aa319d64c310e4b331c7787026a947af60fd56d60989ebae4dc3e8c1eb6129cfd8dc618a618a9333400ea065469079bcfb5147e888e013bd07f0caf0ee47
7
- data.tar.gz: 5502ded677083a616841a5ff4f6969401b9a17020f7c2a5725108f52aab15aff4409a08f59b2fecf07dc4a7fd132a7c3c8845a5da09945d93e1a2d176805a113
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 uses the \*.gitignore files found at
4
- https://github.com/github/gitignore to generate a combined .gitignore file
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 in the current directory, run:
22
+ To generate a .gitignore, run:
24
23
 
25
- forgitter TYPE1 [TYPE2 ...]
24
+ forgitter TAG1 [TAG2 ...]
26
25
 
27
- Where TYPE1, TYPE2, etc. are the types of files to ignore. You can see a
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
- forgitter -l
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
- See `forgitter -h` for additional options.
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
@@ -14,7 +14,7 @@ end
14
14
  options[:tags].reverse!
15
15
 
16
16
  if options[:list]
17
- Forgitter.list_types(options[:tags])
17
+ Forgitter.list(options[:tags])
18
18
  exit
19
19
  end
20
20
 
@@ -36,6 +36,7 @@
36
36
  *.rsm
37
37
  *.tds
38
38
  *.dcu
39
+ *.lib
39
40
 
40
41
  # Delphi autogenerated files (duplicated info)
41
42
  *.cfg
@@ -13,8 +13,8 @@
13
13
 
14
14
  ## File-based project format
15
15
  *.ipr
16
- *.iws
17
16
  *.iml
17
+ *.iws
18
18
 
19
19
  ## Additional for IntelliJ
20
20
  out/
@@ -1,5 +1,5 @@
1
- # SBT .gitignore
2
- # recommended: http://code.google.com/p/simple-build-tool/wiki/Setup#Version_Control
1
+ # Simple Build Tool
2
+ # http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
3
3
 
4
4
  target/
5
5
  lib_managed/
@@ -7,5 +7,6 @@ Mercury/
7
7
  *.a
8
8
  *.so
9
9
  *.dylib
10
+ *.beams
10
11
  *.d
11
12
  *.c_date
@@ -0,0 +1,5 @@
1
+ *.o
2
+ *.so
3
+ *.rlib
4
+ *.dll
5
+ *.exe
@@ -1,16 +1,24 @@
1
- # Bootstrap
2
- app/bootstrap*
1
+ # Cache and logs
2
+ /app/cache/*
3
+ /app/logs/*
4
+ !app/cache/.gitkeep
5
+ !app/logs/.gitkeep
3
6
 
4
- # Symfony directories
5
- vendor/*
6
- */logs/*
7
- */cache/*
8
- web/uploads/*
9
- web/bundles/*
7
+ # Parameters
8
+ /app/config/parameters.yml
9
+ /app/config/parameters.ini
10
10
 
11
- # Configuration files
12
- app/config/parameters.ini
13
- app/config/parameters.yml
11
+ # Managed by Composer
12
+ /app/bootstrap.php.cache
13
+ /bin/
14
+ /vendor/
14
15
 
15
- # Composer
16
- composer.phar
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 Directory
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 uses the *.gitignore files found at https://github.com/github/gitignore to generate a combined .gitignore file locally.}
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 types that match the tags.') do
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 types by tags, then by name.
13
+ # Filter ignorefiles by tags.
14
14
  #
15
- # If tags is empty, this will return all types.
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 types
18
+ # @return [Array] the array of filtered ignorefiles
19
19
  #
20
- def self.filter_types(options = {})
21
- return types if options[:tags].empty?
20
+ def self.filter(options = {})
21
+ return ignorefiles if options[:tags].empty?
22
22
 
23
- types.select do |type|
23
+ ignorefiles.select do |ignorefile|
24
24
  selected = true
25
25
  options[:tags].uniq.each do |tag|
26
- selected &&= type[:tags].count(tag) >= options[:tags].count(tag)
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 type paths, relative to the DATA_PATH.
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 type paths
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 type out of the given path.
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 type
51
+ # @return [String] the ignorefile
52
52
  #
53
- def self.type(path)
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 type name in an array.
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 << type(path)
73
+ tags << ignorefile(path)
74
74
  tags
75
75
  end
76
76
 
77
77
  ##
78
- # Fetch all available types.
78
+ # Fetch all available ignorefiles.
79
79
  #
80
- # @return [Array] the array of available types
80
+ # @return [Array] the array of available ignorefiles
81
81
  #
82
- def self.types
83
- unless defined?(@@types) && !@@types.empty?
84
- @@types = []
82
+ def self.ignorefiles
83
+ unless defined?(@@ignorefiles) && !@@ignorefiles.empty?
84
+ @@ignorefiles = []
85
85
 
86
86
  paths.each do |path|
87
- @@types << {
87
+ @@ignorefiles << {
88
88
  :path => path,
89
- :name => type(path),
89
+ :name => ignorefile(path),
90
90
  :tags => tags(path)
91
91
  }
92
92
  end
93
93
  end
94
- @@types
94
+ @@ignorefiles
95
95
  end
96
96
 
97
- def self.list_types(tags = [])
98
- types = filter_types({ :tags => tags })
99
- if types.empty?
100
- puts 'No types found!'
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
- types.each do |type|
106
- id = type[:tags].join(' ')
111
+ ignorefiles.each do |ignorefile|
112
+ id = ignorefile[:tags].join(' ')
107
113
  col1size = id.length if id.length > col1size
108
- lines << [id, type[:path]]
114
+ lines << [id, ignorefile[:path]]
109
115
  end
110
116
 
111
117
  lines.sort_by { |line| line[0] }.each do |line|
@@ -1,9 +1,8 @@
1
- require 'forgitter/types'
1
+ require 'forgitter/ignorefiles'
2
2
 
3
3
  module Forgitter
4
4
  DEFAULT_OPTIONS = {
5
5
  :list => false,
6
- :tags => [],
7
- :stdout => false
6
+ :tags => []
8
7
  }
9
8
  end
@@ -3,38 +3,30 @@ require 'forgitter'
3
3
  module Forgitter
4
4
  class Runner
5
5
  def initialize(options = Forgitter::DEFAULT_OPTIONS)
6
- @types = Forgitter.filter_types(options)
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
- @types.each do |type|
14
- ignore_file = get_ignore_file(type[:path])
12
+ @ignorefiles.each do |ignorefile|
13
+ ignore_file = get_ignore_file(ignorefile[:path])
15
14
  if ignore_file
16
- output += "# Information from #{type}\n"
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 == @types.length
21
+ exit(1) if failcnt == @ignorefiles.length
23
22
 
24
- if @stdout
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
@@ -1,3 +1,3 @@
1
1
  module Forgitter
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
data/lib/forgitter.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'forgitter/options'
2
- require 'forgitter/types'
2
+ require 'forgitter/ignorefiles'
3
3
  require 'forgitter/runner'
4
4
  require 'forgitter/version'
5
5
 
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.8
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-05-23 00:00:00.000000000 Z
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 uses the *.gitignore files found
57
- at https://github.com/github/gitignore to generate a combined .gitignore file locally.
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: