Class: TogoStanza::CLI::StanzaRemover
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- TogoStanza::CLI::StanzaRemover
- Includes:
- Thor::Actions, Thor::Shell
- Defined in:
- lib/togostanza/cli.rb
Instance Method Summary collapse
- #check_exist ⇒ Object
- #check_input ⇒ Object
- #prune_gem ⇒ Object
- #prune_gem_lock ⇒ Object
- #remove_files ⇒ Object
Instance Method Details
#check_exist ⇒ Object
91 92 93 94 95 96 |
# File 'lib/togostanza/cli.rb', line 91 def check_exist unless File.exist?("#{file_name}") say("This provider doesn't have #{file_name}") exit end end |
#check_input ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/togostanza/cli.rb', line 83 def check_input input = yes?("Do you want to remove #{file_name} [y] ?") unless input say("This operation is canceled") exit end end |
#prune_gem ⇒ Object
102 103 104 |
# File 'lib/togostanza/cli.rb', line 102 def prune_gem gsub_file("Gemfile", "gem '#{file_name}', path: './#{file_name}'\n", "") end |
#prune_gem_lock ⇒ Object
106 107 108 |
# File 'lib/togostanza/cli.rb', line 106 def prune_gem_lock run "bundle install" end |
#remove_files ⇒ Object
98 99 100 |
# File 'lib/togostanza/cli.rb', line 98 def remove_files remove_file("#{file_name}") end |