class AttendanceBot::Generator
Public Class Methods
source_root()
click to toggle source
# File lib/attendance_bot/generator.rb, line 12 def self.source_root File.dirname(__FILE__) end
Public Instance Methods
copy_config()
click to toggle source
# File lib/attendance_bot/generator.rb, line 20 def copy_config template('template_config.yml', destination_path) end
create_group()
click to toggle source
# File lib/attendance_bot/generator.rb, line 16 def create_group empty_directory('config') end
destination_path()
click to toggle source
# File lib/attendance_bot/generator.rb, line 8 def destination_path self.class.source_root + '/config/config.yml' end
write_config()
click to toggle source
# File lib/attendance_bot/generator.rb, line 24 def write_config cli = HighLine.new email = cli.ask 'Enter your attendance email: ' password = cli.ask('Enter your password: ') { |q| q.echo = 'x' } config_file = YAML::load_file(destination_path) config_file['email'] = email config_file['password'] = password File.open(destination_path, 'w') { |f| f.write config_file.to_yaml } end