Class: RailsMaint::CLI

Inherits:
Thor
  • Object
show all
Includes:
MaintenancePageHelper
Defined in:
lib/rails_maint/cli.rb

Instance Method Summary collapse

Methods included from MaintenancePageHelper

#available_locales, #default_maintenance_page_content

Instance Method Details

#disableObject



25
26
27
28
# File 'lib/rails_maint/cli.rb', line 25

def disable
  delete_file('tmp/maintenance_mode.txt')
  puts "Maintenance mode disabled"
end

#enableObject



19
20
21
22
# File 'lib/rails_maint/cli.rb', line 19

def enable
  File.write('tmp/maintenance_mode.txt', Time.now.to_s)
  puts "Maintenance mode enabled."
end

#installObject



12
13
14
15
16
# File 'lib/rails_maint/cli.rb', line 12

def install
  create_config_file
  create_locale_file(options[:locale])
  puts "RailsMaint has been installed with #{options[:locale]} locale."
end

#uninstallObject



31
32
33
34
35
36
37
# File 'lib/rails_maint/cli.rb', line 31

def uninstall
  delete_file('tmp/maintenance_mode.txt')
  delete_file('config/rails_maint.yml')
  delete_file('config/locales/rails_maint.en.yml')
  delete_file('config/locales/rails_maint.tr.yml')
  puts "RailsMaint has been uninstalled and all related files have been removed."
end