pivotal-slacker 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/pivotal-slacker +38 -19
 - metadata +1 -1
 
    
        data/bin/pivotal-slacker
    CHANGED
    
    | 
         @@ -37,30 +37,49 @@ require "pivotal-tracker" 
     | 
|
| 
       37 
37 
     | 
    
         
             
            program :version, "1.0"
         
     | 
| 
       38 
38 
     | 
    
         
             
            program :description, "Pivotal Tracker command line client."
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
            # ----------------------------------------------------------
         
     | 
| 
      
 41 
     | 
    
         
            +
            # Support functionality
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            def output_story_list opts={:project => nil, :states => [], :owned_by => nil}
         
     | 
| 
      
 44 
     | 
    
         
            +
              puts "Looking for stories owned by #{opts[:owned_by]} in states: #{opts[:states]}".color("#444444")
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              stories = opts[:project].stories.all(:owned_by => opts[:owned_by], :current_state => opts[:states])
         
     | 
| 
      
 47 
     | 
    
         
            +
              stories.sort! { |a, b| a.created_at <=> b.created_at }
         
     | 
| 
      
 48 
     | 
    
         
            +
              stories.each do |story|
         
     | 
| 
      
 49 
     | 
    
         
            +
                id = Formatter.story_id(story.id)
         
     | 
| 
      
 50 
     | 
    
         
            +
                name = Formatter.story_name(story.name)
         
     | 
| 
      
 51 
     | 
    
         
            +
                state = Formatter.state(story.current_state)
         
     | 
| 
      
 52 
     | 
    
         
            +
                requested_by = Formatter.requested_by(story.requested_by)
         
     | 
| 
      
 53 
     | 
    
         
            +
                created_at = Formatter.time_ago(story.created_at)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  
         
     | 
| 
      
 55 
     | 
    
         
            +
                puts "[#{id}] #{name}  ~  #{state}, from #{requested_by}, created #{created_at}"
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
            end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            # ----------------------------------------------------------
         
     | 
| 
      
 60 
     | 
    
         
            +
            # Command-line interaction functionality
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
       40 
62 
     | 
    
         
             
            command :mine do |c|
         
     | 
| 
       41 
     | 
    
         
            -
              c.syntax = "pivotal-slacker mine 
     | 
| 
       42 
     | 
    
         
            -
              c.description = "List your stories in  
     | 
| 
       43 
     | 
    
         
            -
              c.example " 
     | 
| 
       44 
     | 
    
         
            -
              c.option "--some-switch", "Some switch that does something"
         
     | 
| 
      
 63 
     | 
    
         
            +
              c.syntax = "pivotal-slacker mine"
         
     | 
| 
      
 64 
     | 
    
         
            +
              c.description = "List your stories in Pivotal Tracker."
         
     | 
| 
      
 65 
     | 
    
         
            +
              c.example "List your \"open\" stories", "pivotal-slacker mine"
         
     | 
| 
       45 
66 
     | 
    
         
             
              c.action do |args, options|
         
     | 
| 
       46 
     | 
    
         
            -
                 
     | 
| 
      
 67 
     | 
    
         
            +
                states = %w{unstarted started finished rejected}
         
     | 
| 
      
 68 
     | 
    
         
            +
                owned_by = config.user
         
     | 
| 
       47 
69 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                states  
     | 
| 
      
 70 
     | 
    
         
            +
                output_story_list :project => project, :states => states, :owned_by => owned_by
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
            end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            command :accepted do |c|
         
     | 
| 
      
 75 
     | 
    
         
            +
              c.syntax = "pivotal-slacker accepted"
         
     | 
| 
      
 76 
     | 
    
         
            +
              c.description = "List your accepted stories in Pivotal Tracker."
         
     | 
| 
      
 77 
     | 
    
         
            +
              c.example "List your accepted stories", "pivotal-slacker accepted"
         
     | 
| 
      
 78 
     | 
    
         
            +
              c.action do |args, options|
         
     | 
| 
      
 79 
     | 
    
         
            +
                states = %w{accepted}
         
     | 
| 
       49 
80 
     | 
    
         
             
                owned_by = config.user
         
     | 
| 
       50 
81 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                 
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                stories = project.stories.all(:owned_by => owned_by, :current_state => states)
         
     | 
| 
       54 
     | 
    
         
            -
                stories.sort! { |a, b| a.created_at <=> b.created_at }
         
     | 
| 
       55 
     | 
    
         
            -
                stories.each do |story|
         
     | 
| 
       56 
     | 
    
         
            -
                  id = Formatter.story_id(story.id)
         
     | 
| 
       57 
     | 
    
         
            -
                  name = Formatter.story_name(story.name)
         
     | 
| 
       58 
     | 
    
         
            -
                  state = Formatter.state(story.current_state)
         
     | 
| 
       59 
     | 
    
         
            -
                  requested_by = Formatter.requested_by(story.requested_by)
         
     | 
| 
       60 
     | 
    
         
            -
                  created_at = Formatter.time_ago(story.created_at)
         
     | 
| 
       61 
     | 
    
         
            -
                  
         
     | 
| 
       62 
     | 
    
         
            -
                  puts "[#{id}] #{name}  ~  #{state}, from #{requested_by}, created #{created_at}"
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
      
 82 
     | 
    
         
            +
                output_story_list :project => project, :states => states, :owned_by => owned_by
         
     | 
| 
       64 
83 
     | 
    
         
             
              end
         
     | 
| 
       65 
84 
     | 
    
         
             
            end
         
     | 
| 
       66 
85 
     | 
    
         |