Sha256: 05a3e8a2a0fce6ad7ee3b2e9d4d2e3c1be2d1d89c3b3c39c0ab898dcbdf0f118

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

<<<<<<< HEAD


=======
>>>>>>> 2c8ca5df8071bdfb714fb1d6efe7e94504861896
class Gitignore

def self.list_gitignore_files

 template_dir=File.join(File.dirname(__FILE__),"gitignore","templates") 

 list_files = Dir.entries(template_dir)

 list_files.delete('.')
 list_files.delete('..')

 list_files.collect{|file| file.gsub(".gitignore","")  }

 
end

def  self.create_gitignore (file_names,overwrite)

		mode = overwrite ? 'w' : 'a'

		#file_name=File.join(File.dirname(__FILE__), ".gitignore") 
		file_name=File.join(".", ".gitignore") 
		#puts file_namen
	 
		File::open(file_name,mode) do |f|
		
			file_names.each do |name|

                         f<<"\n##{'*' * 10 } #{name} template#{'*' * 10 } \n\n"

				begin

				#puts "Inserting #{name} settings" 

					template_file_name=File.join(File.dirname(__FILE__),"gitignore","templates","#{name}.gitignore") 

					#puts template_file_name

					file_content=File::read(template_file_name)
					f<<file_content unless file_content.nil?
					rescue =>err

						return "Exception: #{err}"
						#err

				end

				f<<" \n"
			end

		end

		return "Successful created"

	end

end

#if __FILE__ == $0
  # Do something.. run tests, call a method, etc. We're direct.
#  ignore =Gitignore.new
  #puts ignore.create_gitignore(['Linux','Eclipse','emacs``'],true)
#  puts ignore.create_gitignore(ARGV,false)
#end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitignore-0.1.0 lib/gitignore.rb~