intent 0.1.9 → 0.2.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.
- checksums.yaml +4 -4
- data/intent.gemspec +1 -0
- data/lib/intent/todo/manager.rb +40 -0
- data/lib/intent/todo.rb +1 -0
- data/lib/intent/version.rb +1 -1
- metadata +15 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 05e221afb2e22f8bc1036834504fead73e926d5e
         | 
| 4 | 
            +
              data.tar.gz: 7d5b41109ed9a427e82df76c7dd4745bee6bedb7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d8949751f8b1b33fb1d5b33dd4837f66d86df5f0dc0d4984c45bc7161d730ab601200d6ac127f62fedf961f370f988eba01d53ea3a1fd5cd457bb02c5ed7936c
         | 
| 7 | 
            +
              data.tar.gz: 9cf1931fc838cb01c5f01441f3651c2578c3ac4eb29da8a2e52025aa5b1e5f120bee805752c98737666e1930ec925951ce83c01c6ec1e68105233f94006f0f0c
         | 
    
        data/intent.gemspec
    CHANGED
    
    | @@ -19,6 +19,7 @@ Gem::Specification.new do |spec| | |
| 19 19 | 
             
              spec.require_paths = ["lib"]
         | 
| 20 20 |  | 
| 21 21 | 
             
              spec.add_runtime_dependency "todo-txt", "~> 0.9"
         | 
| 22 | 
            +
              spec.add_runtime_dependency "pastel", "~> 0.6"
         | 
| 22 23 |  | 
| 23 24 | 
             
              spec.add_development_dependency "bundler", "~> 1.10"
         | 
| 24 25 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
    
        data/lib/intent/todo/manager.rb
    CHANGED
    
    | @@ -88,6 +88,45 @@ module Intent | |
| 88 88 | 
             
                            file.puts(task)
         | 
| 89 89 | 
             
                          end
         | 
| 90 90 | 
             
                        end
         | 
| 91 | 
            +
                      when :status
         | 
| 92 | 
            +
                        pastel = Pastel.new
         | 
| 93 | 
            +
                        percentage = true
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                        project_names = list.inject([]) { |names, task| names.concat(task.projects) }.uniq
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                        projects = project_names.map do |project|
         | 
| 98 | 
            +
                          high_priority = list.by_not_done.by_project(project).by_priority('A').size
         | 
| 99 | 
            +
                          {
         | 
| 100 | 
            +
                            name: project,
         | 
| 101 | 
            +
                            done: list.by_done.by_project(project).size,
         | 
| 102 | 
            +
                            not_done: list.by_not_done.by_project(project).size - high_priority,
         | 
| 103 | 
            +
                            priority: high_priority
         | 
| 104 | 
            +
                          }
         | 
| 105 | 
            +
                        end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                        pad_to = project_names.max { |a,b| a.length <=> b.length }.length + 1
         | 
| 108 | 
            +
                        bar_to = (pad_to * 2).to_f
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                        projects.each do |project|
         | 
| 111 | 
            +
                          total = project[:done] + project[:not_done] + project[:priority]
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                          if percentage
         | 
| 114 | 
            +
                            done_ratio = bar_to / total * project[:done]
         | 
| 115 | 
            +
                            not_done_ratio = bar_to / total * project[:not_done]
         | 
| 116 | 
            +
                            priority_ratio = bar_to / total * project[:priority]
         | 
| 117 | 
            +
                          else
         | 
| 118 | 
            +
                            done_ratio = project[:done]
         | 
| 119 | 
            +
                            not_done_ratio = project[:not_done]
         | 
| 120 | 
            +
                            priority_ratio =  project[:priority]
         | 
| 121 | 
            +
                          end
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                          print project[:name].ljust(pad_to), "|"
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                          done_ratio.round.times { print pastel.green("█") }
         | 
| 126 | 
            +
                          not_done_ratio.round.times { print pastel.yellow("█") }
         | 
| 127 | 
            +
                          priority_ratio.floor.times { print pastel.red("█") }
         | 
| 128 | 
            +
                          print "\n"
         | 
| 129 | 
            +
                        end
         | 
| 91 130 | 
             
                      end
         | 
| 92 131 | 
             
                    end
         | 
| 93 132 | 
             
                  end
         | 
| @@ -103,6 +142,7 @@ module Intent | |
| 103 142 | 
             
                    output.puts "todo projects   - list all project tags in the list"
         | 
| 104 143 | 
             
                    output.puts "todo contexts   - list all context tags in the list"
         | 
| 105 144 | 
             
                    output.puts "todo archive    - archive completed tasks in the nearest `done.txt`"
         | 
| 145 | 
            +
                    output.puts "todo status     - show completion status for all projects"
         | 
| 106 146 | 
             
                  end
         | 
| 107 147 | 
             
                end
         | 
| 108 148 | 
             
              end
         | 
    
        data/lib/intent/todo.rb
    CHANGED
    
    
    
        data/lib/intent/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: intent
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mark Rickerby
         | 
| @@ -24,6 +24,20 @@ dependencies: | |
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '0.9'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: pastel
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0.6'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0.6'
         | 
| 27 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 42 | 
             
              name: bundler
         | 
| 29 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         |