lib/settings.rb in trollolo-0.1.1 vs lib/settings.rb in trollolo-0.2.0

- old
+ new

@@ -17,27 +17,29 @@ class Settings attr_accessor :developer_public_key, :member_token, :board_aliases, :verbose, :raw, :not_done_columns, :todo_column, :accepted_column_name_regex, - :done_column_name_regex, :todo_column_name_regex, :scrum + :done_column_name_regex, :todo_column_name_regex, :scrum, + :no_task_checklists - def initialize config_file_path + def initialize(config_file_path) @config_file_path = config_file_path if File.exists? config_file_path @config = YAML.load_file(config_file_path) if @config - @developer_public_key = @config["developer_public_key"] - @member_token = @config["member_token"] - @board_aliases = @config["board_aliases"] || {} - @scrum = OpenStruct.new(@config["scrum"] || scrum_defaults) - @not_done_columns = @config["not_done_columns"].freeze || ["Sprint Backlog", "Doing"] - @todo_column = @config["todo_column"].freeze - @done_column_name_regex = @config["done_column_name_regex"].freeze || /\ADone/ - @accepted_column_name_regex = @config["accepted_column_name_regex"].freeze || /\AAccepted/ - @todo_column_name_regex = @config["todo_column_name_regex"].freeze || /\ATo Do\Z/ + @developer_public_key = @config['developer_public_key'] + @member_token = @config['member_token'] + @board_aliases = @config['board_aliases'] || {} + @scrum = OpenStruct.new(@config['scrum'] || scrum_defaults) + @not_done_columns = @config['not_done_columns'].freeze || ['Sprint Backlog', 'Doing'] + @no_task_checklists = @config['no_task_checklists'].freeze || ['Feedback'] + @todo_column = @config['todo_column'].freeze + @done_column_name_regex = @config['done_column_name_regex'].freeze || /\ADone/ + @accepted_column_name_regex = @config['accepted_column_name_regex'].freeze || /\AAccepted/ + @todo_column_name_regex = @config['todo_column_name_regex'].freeze || /\ATo Do\Z/ else raise "Couldn't read config data from '#{config_file_path}'" end end @@ -45,14 +47,14 @@ @raw = false end def save_config @config = {} - @config["developer_public_key"] = @developer_public_key - @config["member_token"] = @member_token + @config['developer_public_key'] = @developer_public_key + @config['member_token'] = @member_token - File.open(@config_file_path, "w") do |f| + File.open(@config_file_path, 'w') do |f| f.write(@config.to_yaml) end end def version @@ -61,23 +63,23 @@ private def scrum_defaults { - "board_names" => { - "planning" => "Planning Board", - "sprint" => "Sprint Board" + 'board_names' => { + 'planning' => 'Planning Board', + 'sprint' => 'Sprint Board' }, - "label_names" => { - "sticky" => "Sticky", - "waterline" => "Under waterline" + 'label_names' => { + 'sticky' => 'Sticky', + 'waterline' => 'Under waterline' }, - "list_names" => { - "sprint_backlog" => "Sprint Backlog", - "sprint_qa" => "QA", - "sprint_doing" => "Doing", - "planning_backlog" => "Backlog", - "planning_ready" => "Ready for Estimation" - }, + 'list_names' => { + 'sprint_backlog' => 'Sprint Backlog', + 'sprint_qa' => 'QA', + 'sprint_doing' => 'Doing', + 'planning_backlog' => 'Backlog', + 'planning_ready' => 'Ready for Estimation' + } }.freeze end end