Class: Zensana::Command::Project
- Inherits:
-
Zensana::Command
- Object
- Thor
- Zensana::Command
- Zensana::Command::Project
- Defined in:
- lib/zensana/commands/project.rb
Instance Method Summary collapse
Instance Method Details
#convert(project) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/zensana/commands/project.rb', line 39 def convert(project) @asana_project = Zensana::Asana::Project.new(project) say <<-BANNER This will convert the following Asana project into ZenDesk: id: #{@asana_project.id} name: #{@asana_project.name} using options #{} BANNER unless yes?("Do you wish to proceed?", :yellow) say "\nNothing else for me to do, exiting...\n", :red exit end if [:default_user] default_user = Zensana::Zendesk::User.new if default_user.find([:default_user]) [:default_user] = default_user else say "\nDefault user '#{[:default_user]}' does not exist in ZenDesk!\n", :red exit(1) end end # LIFO tags for recursive tagging # # `project_tag_list` holds the project tags # and also the tags for the current task and # its parent tasks which are all added to the ticket # # `section_tag_list` holds the tags for the last # section task which are also added to tickets # = [ 'imported' ] [:global_tags].each do |t| << normalize(t) end = [] << = [] @asana_project.task_list.each do |task| task_to_ticket task['id'], , end say "\n\n ---> Finished!\n\n", :green end |
#find(name) ⇒ Object
7 8 9 |
# File 'lib/zensana/commands/project.rb', line 7 def find(name) puts Zensana::Asana::Project.search(name).collect { |p| "#{p['id']}: #{p['name']}" }.sort end |
#show(project) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/zensana/commands/project.rb', line 13 def show(project) candidates = Zensana::Asana::Project.search(project) if candidates.empty? say "\nNo project found matching '#{project}'", :red else result = select_project(candidates) candidate = Zensana::Asana::Project.new(result) say "\nProject attributes...", :green puts candidate.attributes.pretty if [:tasks] say "Associated tasks...", :green puts candidate.task_list.pretty end end end |