gitignore 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,101 @@
1
+ Gitignore Gem
2
+ =============
3
+ Command line program that allows to generate .gitignore files base on predefined templates (in the future you will be able to create your own templates)
4
+
5
+
6
+ DISCLAIMER !!!
7
+ -----------
8
+ The gem is on beta, use at your own risk !!!! (e.g. you could lose your .gitignore if the template is not found :( )
9
+
10
+
11
+ Installation
12
+ -----------
13
+
14
+ gem install gitignore
15
+
16
+
17
+ Usage
18
+ -----
19
+
20
+ Usage: gitignore NAMES\_OF\_TEMPLATES [OPTIONS]
21
+
22
+ Example: gitignore android osx eclipse
23
+
24
+ Options
25
+
26
+ -h, --help help
27
+
28
+ -o, --overwrite overwrite the contents of existing gitignore file
29
+
30
+ -l, --list prints all possible templates
31
+
32
+ Example
33
+ -----
34
+ Let say we want to create a gitignore file for a project in a mac, and our project will use ruby, we would execute:
35
+
36
+
37
+ gitignore OSX ruby
38
+
39
+ ouput:
40
+ -----
41
+ #********** OSX **********
42
+
43
+ .DS_Store
44
+
45
+ # Thumbnails
46
+ ._*
47
+
48
+ # Files that might appear on external disk
49
+ .Spotlight-V100
50
+ .Trashes
51
+
52
+ #********** ruby **********
53
+
54
+ *.gem
55
+ *.rbc
56
+ .bundle
57
+ .config
58
+ coverage
59
+ InstalledFiles
60
+ lib/bundler/man
61
+ pkg
62
+ rdoc
63
+ spec/reports
64
+ test/tmp
65
+ test/version_tmp
66
+ tmp
67
+
68
+ # YARD artifacts
69
+ .yardoc
70
+ _yardoc
71
+ doc/
72
+
73
+ Or let say our project is on linux, and we will use django, and of course python , SASS, and emacs
74
+
75
+ gitignore Django Linux Python SASS emacs
76
+
77
+ templates
78
+ -----
79
+
80
+ This gem use the github templates, you can check it at
81
+
82
+ [Github Templates] (https://github.com/github/gitignore/)
83
+
84
+ or you can just execute
85
+
86
+ gitignore --list
87
+
88
+ I recommend you to use it in combination with grep as follows
89
+
90
+ gitignore --list | grep 'Text'
91
+
92
+
93
+ Contributing
94
+ ------------
95
+
96
+ 1. Fork it.
97
+ 2. Create a branch (`git checkout -b my_gitignore`)
98
+ 3. Commit your changes (`git commit -am "Added nyancat"`)
99
+ 4. Push to the branch (`git push origin my_gitignore`)
100
+ 5. Create an [Issue](https://github.com/DavidToca/gitignore-gem/issues) with a link to your branch
101
+ 6. Enjoy a refreshing Diet Coke and wait
@@ -0,0 +1,90 @@
1
+
2
+ Gitignore Gem
3
+ =============
4
+ Command line program that allows to generate .gitignore files base on prefenined templates (in the future you will be able to create your own templates)
5
+
6
+
7
+ DISCLAIMER !!!
8
+ -----------
9
+ The gem is on beta, use at your own risk !!!! (because losing a .gitignore could mean the end of everything as we know ;) )
10
+
11
+
12
+ Installation
13
+ -----------
14
+
15
+ gem install gitignore
16
+
17
+
18
+ Usage
19
+ -----
20
+ Let say we want to create a gitignore file for a project in a mac, and our project will use ruby, we would execute:
21
+
22
+
23
+ gitignore OSX ruby
24
+
25
+ ouput:
26
+ -----
27
+ #######OSX#########
28
+
29
+ .DS_Store
30
+
31
+ # Thumbnails
32
+ ._*
33
+
34
+ # Files that might appear on external disk
35
+ .Spotlight-V100
36
+ .Trashes
37
+
38
+ #####################
39
+
40
+
41
+ ########ruby#########
42
+
43
+ *.gem
44
+ *.rbc
45
+ .bundle
46
+ .config
47
+ coverage
48
+ InstalledFiles
49
+ lib/bundler/man
50
+ pkg
51
+ rdoc
52
+ spec/reports
53
+ test/tmp
54
+ test/version_tmp
55
+ tmp
56
+
57
+ # YARD artifacts
58
+ .yardoc
59
+ _yardoc
60
+ doc/
61
+
62
+ #####################
63
+
64
+
65
+ Or let say our project is on linux, and we will use django, and of course python , SASS, and emacs
66
+
67
+ gitignore Django Linux Python SASS emacs
68
+
69
+
70
+ ouput
71
+ -----
72
+ Too long to put in here :)
73
+
74
+ templates
75
+ -----
76
+ you can find a list of all templates here
77
+
78
+ [Github Templates] (https://github.com/github/gitignore/)
79
+
80
+ I will add a `gitignore -list` (some day)
81
+
82
+ Contributing
83
+ ------------
84
+
85
+ 1. Fork it.
86
+ 2. Create a branch (`git checkout -b my_gitignore`)
87
+ 3. Commit your changes (`git commit -am "Added nyancat"`)
88
+ 4. Push to the branch (`git push origin my_gitignore`)
89
+ 5. Create an [Issue][1] with a link to your branch
90
+ 6. Enjoy a refreshing Diet Coke and wait
@@ -2,4 +2,46 @@
2
2
 
3
3
  require 'gitignore'
4
4
 
5
- puts Gitignore.create_gitignore(ARGV,true)
5
+ require 'optparse'
6
+
7
+ options = {}
8
+
9
+ opt_parser = OptionParser.new do |opt|
10
+
11
+ opt.banner = "Usage: gitignore NAMES_OF_TEMPLATES [OPTIONS]"
12
+ opt.separator ""
13
+ opt.separator "Example: gitignore android osx eclipse"
14
+ opt.separator ""
15
+ opt.separator "Options"
16
+
17
+ opt.on("-h","--help","help") do
18
+ options[:help] = true
19
+ end
20
+
21
+ opt.on("-o","--overwrite","overwrite the contents of existing gitignore file") do
22
+ options[:overwrite] = true
23
+ end
24
+
25
+ opt.on("-l","--list","prints all possible templates") do
26
+ options[:list] = true
27
+ end
28
+
29
+ end
30
+
31
+ begin
32
+ opt_parser.parse! ARGV
33
+
34
+ rescue => err
35
+ puts "Wrong arguments"
36
+ Process.exit 1
37
+
38
+ end
39
+
40
+ if (options.empty? and ARGV.empty?) or options[:help]
41
+ puts opt_parser
42
+ elsif options[:list]
43
+ puts Gitignore::list_gitignore_files
44
+ else
45
+ puts Gitignore::create_gitignore(ARGV,options[:overwrite])
46
+ end
47
+
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env/ ruby
2
+
3
+ require 'gitignore'
4
+
5
+ require 'optparse'
6
+
7
+ options = {}
8
+
9
+ opt_parser = OptionParser.new do |opt|
10
+
11
+ opt.banner = "Usage: gitignore NAMES_OF_TEMPLATES [OPTIONS]"
12
+ opt.separator ""
13
+ opt.separator "Example: gitignore android osx eclipse"
14
+ # opt.separator ""
15
+ # opt.separator "Commands"
16
+ # opt.separator " list: prints all possible templates"
17
+ opt.separator ""
18
+ opt.separator "Options"
19
+
20
+ opt.on("-h","--help","help") do
21
+ options[:help] = true
22
+ end
23
+
24
+ opt.on("-o","--overwrite","overwrite the contents of existing gitignore file") do
25
+ options[:overwrite] = true
26
+ end
27
+
28
+ opt.on("-l","--list","list: prints all possible templates") do
29
+ options[:list] = true
30
+ end
31
+
32
+ end
33
+
34
+ begin
35
+ opt_parser.parse! ARGV
36
+
37
+ rescue => err
38
+ puts "Wrong arguments"
39
+ Process.exit 1
40
+
41
+ end
42
+
43
+ if (options.empty? and ARGV.empty?) or options[:help]
44
+ puts opt_parser
45
+ elsif options[:list]
46
+ puts Gitignore::list_gitignore_files
47
+ else
48
+ puts Gitignore::create_gitignore(ARGV,options[:overwrite])
49
+ end
50
+
@@ -1,19 +1,30 @@
1
-
2
1
  class Gitignore
3
2
 
4
- def self.create_gitignore (file_names,overwrite)
3
+ def self.list_gitignore_files
4
+
5
+ template_dir=File.join(File.dirname(__FILE__),"gitignore","templates")
6
+
7
+ list_files = Dir.entries(template_dir)
8
+
9
+ list_files.delete('.')
10
+ list_files.delete('..')
11
+
12
+ list_files.collect{|file| file.gsub(".gitignore","") }
13
+
14
+
15
+ end
16
+
17
+ def self.create_gitignore (file_names,overwrite)
5
18
 
6
19
  mode = overwrite ? 'w' : 'a'
7
20
 
8
- #file_name=File.join(File.dirname(__FILE__), ".gitignore")
9
21
  file_name=File.join(".", ".gitignore")
10
- #puts file_name
11
-
22
+
12
23
  File::open(file_name,mode) do |f|
13
-
24
+
14
25
  file_names.each do |name|
15
26
 
16
- f<<"\n#########{name}#########\n\n"
27
+ f<<"\n##{'*' * 10 } #{name} template#{'*' * 10 } \n\n"
17
28
 
18
29
  begin
19
30
 
@@ -29,14 +40,15 @@ class Gitignore
29
40
 
30
41
  return "Exception: #{err}"
31
42
  #err
43
+
32
44
  end
33
45
 
34
- f<<"\n#####################\n\n"
46
+ f<<" \n"
35
47
  end
36
48
 
37
49
  end
38
50
 
39
- return "Successfull created"
51
+ return "Successful created"
40
52
 
41
53
  end
42
54
 
@@ -49,3 +61,11 @@ end
49
61
  # puts ignore.create_gitignore(ARGV,false)
50
62
  #end
51
63
 
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
@@ -0,0 +1,70 @@
1
+ <<<<<<< HEAD
2
+
3
+
4
+ =======
5
+ >>>>>>> 2c8ca5df8071bdfb714fb1d6efe7e94504861896
6
+ class Gitignore
7
+
8
+ def self.list_gitignore_files
9
+
10
+ template_dir=File.join(File.dirname(__FILE__),"gitignore","templates")
11
+
12
+ list_files = Dir.entries(template_dir)
13
+
14
+ list_files.delete('.')
15
+ list_files.delete('..')
16
+
17
+ list_files.collect{|file| file.gsub(".gitignore","") }
18
+
19
+
20
+ end
21
+
22
+ def self.create_gitignore (file_names,overwrite)
23
+
24
+ mode = overwrite ? 'w' : 'a'
25
+
26
+ #file_name=File.join(File.dirname(__FILE__), ".gitignore")
27
+ file_name=File.join(".", ".gitignore")
28
+ #puts file_namen
29
+
30
+ File::open(file_name,mode) do |f|
31
+
32
+ file_names.each do |name|
33
+
34
+ f<<"\n##{'*' * 10 } #{name} template#{'*' * 10 } \n\n"
35
+
36
+ begin
37
+
38
+ #puts "Inserting #{name} settings"
39
+
40
+ template_file_name=File.join(File.dirname(__FILE__),"gitignore","templates","#{name}.gitignore")
41
+
42
+ #puts template_file_name
43
+
44
+ file_content=File::read(template_file_name)
45
+ f<<file_content unless file_content.nil?
46
+ rescue =>err
47
+
48
+ return "Exception: #{err}"
49
+ #err
50
+
51
+ end
52
+
53
+ f<<" \n"
54
+ end
55
+
56
+ end
57
+
58
+ return "Successful created"
59
+
60
+ end
61
+
62
+ end
63
+
64
+ #if __FILE__ == $0
65
+ # Do something.. run tests, call a method, etc. We're direct.
66
+ # ignore =Gitignore.new
67
+ #puts ignore.create_gitignore(['Linux','Eclipse','emacs``'],true)
68
+ # puts ignore.create_gitignore(ARGV,false)
69
+ #end
70
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitignore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-04 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Use file templeates to create .gitignore files
15
15
  email: david.virusfel@gmail.com
@@ -19,6 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - bin/gitignore
22
+ - bin/gitignore~
22
23
  - lib/gitignore/templates/Actionscript.gitignore
23
24
  - lib/gitignore/templates/Android.gitignore
24
25
  - lib/gitignore/templates/Archives.gitignore
@@ -120,6 +121,9 @@ files:
120
121
  - lib/gitignore/templates/Yii.gitignore
121
122
  - lib/gitignore/templates/ZendFramework.gitignore
122
123
  - lib/gitignore.rb
124
+ - lib/gitignore.rb~
125
+ - README.md
126
+ - README.md~
123
127
  homepage: http://rubygems.org/gems/gitignore
124
128
  licenses: []
125
129
  post_install_message: