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
92 93 94 95 96 97 |
# File 'lib/togostanza/cli.rb', line 92 def check_exist unless File.exist?("#{file_name}") say("This provider doesn't have #{file_name}") exit end end |
#check_input ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/togostanza/cli.rb', line 84 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
103 104 105 |
# File 'lib/togostanza/cli.rb', line 103 def prune_gem gsub_file("Gemfile", "gem '#{file_name}', path: './#{file_name}'\n", "") end |
#prune_gem_lock ⇒ Object
107 108 109 |
# File 'lib/togostanza/cli.rb', line 107 def prune_gem_lock run "bundle install" end |
#remove_files ⇒ Object
99 100 101 |
# File 'lib/togostanza/cli.rb', line 99 def remove_files remove_file("#{file_name}") end |