class IgnoreIt::CLI
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/ignore_it.rb, line 13 def initialize(*args) super @config = Config.new @creator = Creator.new @list = List.new $glob_settings[:output] = "./.gitignore" end
Public Instance Methods
add(*templateName)
click to toggle source
# File lib/ignore_it.rb, line 25 def add(*templateName) if options[:output] return false unless @creator.check_output_path(options[:output]) $glob_settings[:output] = if options[:output][-1] == '/' options[:output] + '.gitignore' else options[:output] + '/.gitignore' end end if options[:force] $glob_settings[:force] = true end templateName.each do |name| name = name.downcase if @list.check_list(name) @creator.create_api_ignore(name) else puts "The template #{name} you tried to fetch does not exist".colorize(:red) puts "Please checkout the available templates with " + "ignore-it list".colorize(:green) end end end
list()
click to toggle source
# File lib/ignore_it.rb, line 73 def list puts "---- Available templates from gitignore.io: ----" @list.show_list puts "---- Available user templates (see ~/.ignore-it/config.yml) ----" @list.show_own_files end
own(*fileName)
click to toggle source
# File lib/ignore_it.rb, line 49 def own(*fileName) if options[:output] return false unless @creator.check_output_path(options[:output]) $glob_settings[:output] = if options[:output][-1] == '/' options[:output] + '.gitignore' else options[:output] + '/.gitignore' end end if options[:force] == true $glob_settings[:force] = true end fileName.each do |name| if @list.check_own_files(name) @creator.create_own_ignore(name) else puts "The template #{name} you tried to create does not exist".colorize(:red) puts "The following templates are available:".colorize(:red) @list.show_own_files end end end