taskwarrior-web 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ script: "rake spec"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.0.11 (1/10/12)
2
+
3
+ * Added annotations to task listing, complete with autolinking (turns URLs into
4
+ links)
5
+
1
6
  ## v0.0.10 (12/30/11)
2
7
 
3
8
  * Quick release to fix JSON parse error when there are no tasks.
data/Gemfile.lock CHANGED
@@ -1,22 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- taskwarrior-web (0.0.10)
4
+ taskwarrior-web (0.0.11)
5
5
  parseconfig
6
+ rinku
6
7
  sinatra
7
8
  vegas
8
9
 
9
10
  GEM
10
11
  remote: http://rubygems.org/
11
12
  specs:
13
+ diff-lcs (1.1.3)
12
14
  parseconfig (0.5.2)
13
- rack (1.3.6)
14
- rack-protection (1.1.4)
15
+ rack (1.4.0)
16
+ rack-protection (1.2.0)
15
17
  rack
16
18
  rake (0.9.2.2)
17
- sinatra (1.3.1)
18
- rack (~> 1.3, >= 1.3.4)
19
- rack-protection (~> 1.1, >= 1.1.2)
19
+ rinku (1.5.0)
20
+ rspec (2.8.0)
21
+ rspec-core (~> 2.8.0)
22
+ rspec-expectations (~> 2.8.0)
23
+ rspec-mocks (~> 2.8.0)
24
+ rspec-core (2.8.0)
25
+ rspec-expectations (2.8.0)
26
+ diff-lcs (~> 1.1.2)
27
+ rspec-mocks (2.8.0)
28
+ sinatra (1.3.2)
29
+ rack (~> 1.3, >= 1.3.6)
30
+ rack-protection (~> 1.2)
20
31
  tilt (~> 1.3, >= 1.3.3)
21
32
  tilt (1.3.3)
22
33
  vegas (0.1.8)
@@ -27,4 +38,5 @@ PLATFORMS
27
38
 
28
39
  DEPENDENCIES
29
40
  rake
41
+ rspec
30
42
  taskwarrior-web!
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  A lightweight, Sinatra-based web interface for the
4
4
  wonderful [Taskwarrior](http://taskwarrior.org/) todo application.
5
5
 
6
+ [![Build Status](https://secure.travis-ci.org/theunraveler/taskwarrior-web.png)](http://travis-ci.org/theunraveler/taskwarrior-web)
7
+
6
8
  ## Installation
7
9
 
8
10
  `gem install taskwarrior-web`
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+
2
4
  Bundler::GemHelper.install_tasks
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+
@@ -5,6 +5,7 @@ require 'erb'
5
5
  require 'parseconfig'
6
6
  require 'json'
7
7
  require 'time'
8
+ require 'rinku'
8
9
 
9
10
  module TaskwarriorWeb
10
11
  class App < Sinatra::Base
@@ -47,6 +48,10 @@ module TaskwarriorWeb
47
48
  end
48
49
  end
49
50
 
51
+ def auto_link(text)
52
+ Rinku.auto_link(text, :all, 'target="_blank"')
53
+ end
54
+
50
55
  def subnav(type)
51
56
  case type
52
57
  when 'tasks' then
@@ -0,0 +1,12 @@
1
+ module TaskwarriorWeb
2
+ class Runner
3
+
4
+ TASK_BIN = 'task'
5
+
6
+ def self.run(command)
7
+ command = TASK_BIN + " #{command}"
8
+ `#{command}`
9
+ end
10
+
11
+ end
12
+ end
@@ -1,3 +1,5 @@
1
+ require 'taskwarrior-web/runner'
2
+
1
3
  module TaskwarriorWeb
2
4
 
3
5
  #################
@@ -5,10 +7,9 @@ module TaskwarriorWeb
5
7
  #################
6
8
  class Task
7
9
 
8
- TASK_BIN = 'task'
9
-
10
10
  attr_accessor :id, :entry, :project, :priority, :uuid, :description, :status,
11
- :due, :start, :end, :tags, :depends, :wait
11
+ :due, :start, :end, :tags, :depends, :wait, :annotations
12
+ alias :annotate= :annotations=
12
13
 
13
14
  ####################################
14
15
  # MODEL METHODS FOR INDIVIDUAL TASKS
@@ -22,7 +23,7 @@ module TaskwarriorWeb
22
23
 
23
24
  def save!
24
25
  exclude = ['@description', '@tags']
25
- command = TASK_BIN + ' add'
26
+ command = 'add'
26
27
  command << " '#{description}'"
27
28
  instance_variables.each do |ivar|
28
29
  subbed = ivar.to_s.gsub('@', '')
@@ -33,8 +34,7 @@ module TaskwarriorWeb
33
34
  command << " +#{tag}"
34
35
  end
35
36
  end
36
- puts command
37
- `#{command}`
37
+ TaskwarriorWeb::Runner.run(command)
38
38
  end
39
39
 
40
40
  ##################################
@@ -46,15 +46,15 @@ module TaskwarriorWeb
46
46
  tasks = []
47
47
  count = 1
48
48
 
49
- stdout = TASK_BIN + ' _query'
49
+ command = '_query'
50
50
  args.each do |param|
51
51
  param.each do |attr, value|
52
- stdout << " #{attr.to_s}:#{value}"
52
+ command << " #{attr.to_s}:#{value}"
53
53
  end
54
54
  end
55
55
 
56
56
  # Process the JSON data.
57
- json = `#{stdout}`
57
+ json = TaskwarriorWeb::Runner.run(command)
58
58
  json.strip!
59
59
  json = '[' + json + ']'
60
60
  results = json == '[No matches.]' ? [] : JSON.parse(json)
@@ -88,13 +88,13 @@ module TaskwarriorWeb
88
88
 
89
89
  # Get the number of tasks for some paramters
90
90
  def self.count(*args)
91
- statement = TASK_BIN + ' count'
91
+ command = 'count'
92
92
  args.each do |param|
93
93
  param.each do |attr, value|
94
- statement << " #{attr.to_s}:#{value}"
94
+ command << " #{attr.to_s}:#{value}"
95
95
  end
96
96
  end
97
- return `#{statement}`.strip!
97
+ return TaskwarriorWeb::Runner.run(command).strip!
98
98
  end
99
99
 
100
100
  ###############################################
@@ -105,8 +105,7 @@ module TaskwarriorWeb
105
105
  # Mark a task as complete
106
106
  # TODO: Make into instance method when `task` supports finding by UUID.
107
107
  def self.complete!(task_id)
108
- statement = TASK_BIN + " #{task_id} done"
109
- `#{statement}`
108
+ TaskwarriorWeb::Runner.run("#{task_id} done")
110
109
  end
111
110
 
112
111
  end
@@ -1,3 +1,3 @@
1
1
  module TaskwarriorWeb
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require 'taskwarrior-web/task'
2
+
3
+ describe TaskwarriorWeb::Task do
4
+
5
+ describe '#initialize' do
6
+ it 'should assign the passed attributes' do
7
+ task = TaskwarriorWeb::Task.new({:entry => 'Testing', :project => 'Project'})
8
+ task.entry.should eq('Testing')
9
+ task.project.should eq('Project')
10
+ end
11
+
12
+ it 'should not assign bogus attributes' do
13
+ task = TaskwarriorWeb::Task.new({:bogus => 'Testing'})
14
+ task.respond_to?(:bogus).should be_false
15
+ end
16
+ end
17
+ end
@@ -17,8 +17,10 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency('sinatra')
18
18
  s.add_dependency('parseconfig')
19
19
  s.add_dependency('vegas')
20
+ s.add_dependency('rinku')
20
21
 
21
22
  s.add_development_dependency('rake')
23
+ s.add_development_dependency('rspec')
22
24
 
23
25
  s.files = `git ls-files`.split("\n")
24
26
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/views/listing.erb CHANGED
@@ -19,7 +19,16 @@
19
19
  <tr class="<%= task.status %>">
20
20
  <td></td>
21
21
  <% end %>
22
- <td><%= task.description %></td>
22
+ <td>
23
+ <%= task.description %>
24
+ <% unless task.annotations.nil? || task.annotations.empty? %>
25
+ <ul>
26
+ <% task.annotations.each do |annotation| %>
27
+ <li><%= format_date(annotation['entry']) %>: <%= auto_link(annotation['description']) %></li>
28
+ <% end %>
29
+ </ul>
30
+ <% end %>
31
+ </td>
23
32
  <td><a href="/projects/<%= linkify(task.project, :project) %>"><%= task.project %></a></td>
24
33
  <td><%= format_date(task.due) unless task.due.nil? %></td>
25
34
  <td><%= task.tags.join(', ') unless task.tags.nil? %></td>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskwarrior-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-30 00:00:00.000000000 Z
12
+ date: 2012-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &2151875620 !ruby/object:Gem::Requirement
16
+ requirement: &2160998820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151875620
24
+ version_requirements: *2160998820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: parseconfig
27
- requirement: &2151875040 !ruby/object:Gem::Requirement
27
+ requirement: &2160996680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151875040
35
+ version_requirements: *2160996680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: vegas
38
- requirement: &2151874340 !ruby/object:Gem::Requirement
38
+ requirement: &2161049040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,32 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2151874340
46
+ version_requirements: *2161049040
47
+ - !ruby/object:Gem::Dependency
48
+ name: rinku
49
+ requirement: &2161047100 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *2161047100
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rake
49
- requirement: &2151873720 !ruby/object:Gem::Requirement
60
+ requirement: &2161045180 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2161045180
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &2161043240 !ruby/object:Gem::Requirement
50
72
  none: false
51
73
  requirements:
52
74
  - - ! '>='
@@ -54,7 +76,7 @@ dependencies:
54
76
  version: '0'
55
77
  type: :development
56
78
  prerelease: false
57
- version_requirements: *2151873720
79
+ version_requirements: *2161043240
58
80
  description: This gem provides a graphical frontend for the Taskwarrior task manager.
59
81
  It is based on Sinatra.
60
82
  email:
@@ -65,6 +87,7 @@ extensions: []
65
87
  extra_rdoc_files: []
66
88
  files:
67
89
  - .gitignore
90
+ - .travis.yml
68
91
  - CHANGELOG.md
69
92
  - Gemfile
70
93
  - Gemfile.lock
@@ -75,6 +98,7 @@ files:
75
98
  - lib/taskwarrior-web.rb
76
99
  - lib/taskwarrior-web/app.rb
77
100
  - lib/taskwarrior-web/config.rb
101
+ - lib/taskwarrior-web/runner.rb
78
102
  - lib/taskwarrior-web/task.rb
79
103
  - lib/taskwarrior-web/version.rb
80
104
  - public/css/gh-buttons.css
@@ -105,6 +129,7 @@ files:
105
129
  - public/js/jquery.min.js
106
130
  - public/js/jquery.tagsinput.js
107
131
  - public/js/jquery.tipsy.js
132
+ - spec/models/task_spec.rb
108
133
  - taskwarrior-web.gemspec
109
134
  - views/404.erb
110
135
  - views/_navigation.erb
@@ -127,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
152
  version: '0'
128
153
  segments:
129
154
  - 0
130
- hash: -4282270428518601001
155
+ hash: 3125701978170363258
131
156
  required_rubygems_version: !ruby/object:Gem::Requirement
132
157
  none: false
133
158
  requirements:
@@ -136,11 +161,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
161
  version: '0'
137
162
  segments:
138
163
  - 0
139
- hash: -4282270428518601001
164
+ hash: 3125701978170363258
140
165
  requirements: []
141
166
  rubyforge_project: taskwarrior-web
142
167
  rubygems_version: 1.8.11
143
168
  signing_key:
144
169
  specification_version: 3
145
170
  summary: Web frontend for taskwarrior command line task manager.
146
- test_files: []
171
+ test_files:
172
+ - spec/models/task_spec.rb