class Abt::Providers::Asana::Commands::WriteConfig
Public Class Methods
description()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 12 def self.description "Write Asana settings to .abt.yml" end
flags()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 16 def self.flags [ ["-c", "--clean", "Don't reuse project configuration"] ] end
usage()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 8 def self.usage "abt write-config asana[:<project-gid>]" end
Public Instance Methods
perform()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 22 def perform cli.directory_config["asana"] = config_data cli.directory_config.save! warn("Asana configuration written to #{Abt::DirectoryConfig::FILE_NAME}") end
Private Instance Methods
config_data()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 31 def config_data { "path" => project_gid, "wip_section_gid" => wip_section_gid, "finalized_section_gid" => finalized_section_gid } end
finalized_section_gid()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 53 def finalized_section_gid return config.finalized_section_gid if use_previous_config? cli.prompt.choice('Select section for finalized tasks (E.g. "Merged")', sections)["gid"] end
project_gid()
click to toggle source
Calls superclass method
# File lib/abt/providers/asana/commands/write_config.rb, line 39 def project_gid @project_gid ||= begin prompt_project! if super.nil? || flags[:clean] super end end
sections()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 63 def sections @sections ||= begin warn("Fetching sections...") api.get_paged("projects/#{project_gid}/sections", opt_fields: "name") end end
use_previous_config?()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 59 def use_previous_config? project_gid == config.path.project_gid end
wip_section_gid()
click to toggle source
# File lib/abt/providers/asana/commands/write_config.rb, line 47 def wip_section_gid return config.wip_section_gid if use_previous_config? cli.prompt.choice("Select WIP (Work In Progress) section", sections)["gid"] end