Class: IgnoreIt::CLI
- Inherits:
-
Thor
- Object
- Thor
- IgnoreIt::CLI
- Defined in:
- lib/ignore_it.rb
Instance Method Summary collapse
- #add(*templateName) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #list ⇒ Object
- #own(*fileName) ⇒ Object
Constructor Details
Instance Method Details
#add(*templateName) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ignore_it.rb', line 25 def add(*templateName) if [:output] return false unless @creator.check_output_path([:output]) $glob_settings[:output] = if [:output][-1] == '/' [:output] + '.gitignore' else [:output] + '/.gitignore' end end if [: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 ⇒ Object
73 74 75 76 77 78 |
# 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) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ignore_it.rb', line 49 def own(*fileName) if [:output] return false unless @creator.check_output_path([:output]) $glob_settings[:output] = if [:output][-1] == '/' [:output] + '.gitignore' else [:output] + '/.gitignore' end end if [: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 |