Class: Ignorify::Ignorify
- Inherits:
-
Thor
- Object
- Thor
- Ignorify::Ignorify
- Defined in:
- lib/ignorify/core.rb
Instance Method Summary collapse
Instance Method Details
#create(name) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ignorify/core.rb', line 42 def create(name) file_list = Utils.file_list # Create a file create_file = Proc.new do |file_list| if Utils.create_file(file_list[name]) $stdout.puts ".gitignore created".green else $stdout.puts "Error creating .gitignore".red end end if file_list.has_key?(name) if Utils.check_existing_gitignore response = ask("There is an already existing .gitignore file.\nDo you wish to overwrite?".red, :limited_to => ["y", "n"]) case response when "y" create_file.call(file_list) when "n" $stdout.puts "Exiting.." exit 1 end else create_file.call(file_list) end else $stdout.puts "File was not found in the git repository".red end end |
#list ⇒ Object
16 17 18 |
# File 'lib/ignorify/core.rb', line 16 def list $stdout.puts Utils.file_list.keys end |
#search(term) ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/ignorify/core.rb', line 85 def search(term) results = Utils.search(term) if results.length > 0 $stdout.puts "Available gitignore files:".green $stdout.puts "#{results.join(", ")}" else $stdout.puts "No gitignore for #{term} was found".red end end |
#version ⇒ Object
27 28 29 |
# File 'lib/ignorify/core.rb', line 27 def version $stdout.puts VERSION end |