redpomo 0.0.9 → 0.0.10
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/README.md +8 -8
- data/lib/redpomo/cli.rb +24 -16
- data/lib/redpomo/file_cache.rb +5 -1
- data/lib/redpomo/task.rb +1 -1
- data/lib/redpomo/version.rb +1 -1
- data/spec/file_cache_spec.rb +6 -1
- data/spec/integration/add_spec.rb +29 -0
- data/spec/integration/init_spec.rb +3 -8
- data/spec/lib/redpomo/entry_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/fixtures.rb +7 -0
- data/spec/support/ruby_ext.rb +1 -1
- metadata +30 -28
data/README.md
CHANGED
@@ -15,14 +15,14 @@ Redpomo is the classic "scratch your own itch" project:
|
|
15
15
|
|
16
16
|
› redpomo help
|
17
17
|
Tasks:
|
18
|
-
redpomo
|
19
|
-
redpomo
|
20
|
-
redpomo
|
21
|
-
redpomo
|
22
|
-
redpomo
|
23
|
-
redpomo
|
24
|
-
redpomo
|
25
|
-
redpomo
|
18
|
+
redpomo init # generates a .redpomo configuration file on your home directory
|
19
|
+
redpomo pull # imports Redmine open issues into local todo.txt
|
20
|
+
redpomo push [LOGFILE] # parses Pomodoro export file and imports to Redmine clients
|
21
|
+
redpomo add [TASK] # creates a new task on Todo.txt, forwarding it to the remote tracker
|
22
|
+
redpomo close TASK # marks a todo.txt task as complete, and closes the related Redmine issue
|
23
|
+
redpomo open TASK # opens up the Redmine issue page of the selected task
|
24
|
+
redpomo start TASK # starts a Pomodoro session for the selected task
|
25
|
+
redpomo help [TASK] # Describe available tasks or one specific task
|
26
26
|
|
27
27
|
Options:
|
28
28
|
-c, [--config=CONFIG] # Default: ~/.redpomo
|
data/lib/redpomo/cli.rb
CHANGED
@@ -6,7 +6,6 @@ require 'redpomo/task_list'
|
|
6
6
|
require 'redpomo/entry'
|
7
7
|
require 'redpomo/entries_printer'
|
8
8
|
require 'redpomo/fuzzy_converter'
|
9
|
-
# require 'redpomo/issue_generator'
|
10
9
|
|
11
10
|
module Redpomo
|
12
11
|
class CLI < ::Thor
|
@@ -27,7 +26,7 @@ module Redpomo
|
|
27
26
|
map "c" => :close
|
28
27
|
map "a" => :add
|
29
28
|
|
30
|
-
desc "add", "creates a new task on Todo.txt, forwarding it to the remote tracker"
|
29
|
+
desc "add [TASK]", "creates a new task on Todo.txt, forwarding it to the remote tracker"
|
31
30
|
method_option :description, aliases: "-d"
|
32
31
|
def add(subject = nil)
|
33
32
|
description = @options[:description]
|
@@ -35,17 +34,22 @@ module Redpomo
|
|
35
34
|
if subject.blank?
|
36
35
|
message_path = Tempfile.new('issue').path + ".textile"
|
37
36
|
template "issue_stub.textile", message_path, verbose: false
|
38
|
-
subject, description = parse_message
|
37
|
+
subject, description = parse_message open_editor(message_path)
|
39
38
|
end
|
40
39
|
|
41
40
|
issue = Task.new(nil, subject).to_issue
|
42
41
|
issue.description = description
|
43
|
-
issue.create!
|
44
42
|
|
45
|
-
|
46
|
-
|
43
|
+
if issue.tracker.present?
|
44
|
+
issue.create!
|
45
|
+
task = issue.to_task
|
46
|
+
task.add!
|
47
47
|
|
48
|
-
|
48
|
+
Redpomo.ui.info "Issue created, see it at #{task.url}"
|
49
|
+
else
|
50
|
+
Redpomo.ui.error "Cannot create issue, unknown tracker."
|
51
|
+
exit 1
|
52
|
+
end
|
49
53
|
end
|
50
54
|
|
51
55
|
desc "pull", "imports Redmine open issues into local todo.txt"
|
@@ -116,15 +120,7 @@ module Redpomo
|
|
116
120
|
def init(path = '~/.redpomo')
|
117
121
|
path = File.expand_path(path)
|
118
122
|
template "config.yml", path, verbose: false
|
119
|
-
|
120
|
-
editor = [ENV['REDPOMO_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
|
121
|
-
if editor
|
122
|
-
command = "#{editor} #{path}"
|
123
|
-
system(command)
|
124
|
-
File.read(path)
|
125
|
-
else
|
126
|
-
Redpomo.ui.info("To open the .redpomo config file, set $EDITOR or $REDPOMO_EDITOR")
|
127
|
-
end
|
123
|
+
open_editor(path)
|
128
124
|
end
|
129
125
|
|
130
126
|
private
|
@@ -152,5 +148,17 @@ module Redpomo
|
|
152
148
|
[subject.strip, description.strip]
|
153
149
|
end
|
154
150
|
|
151
|
+
def open_editor(path)
|
152
|
+
editor = [ENV['REDPOMO_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
|
153
|
+
if editor
|
154
|
+
command = "#{editor} #{path}"
|
155
|
+
system(command)
|
156
|
+
File.read(path)
|
157
|
+
else
|
158
|
+
Redpomo.ui.error("To open #{path}, set $EDITOR or $REDPOMO_EDITOR")
|
159
|
+
exit 1
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
155
163
|
end
|
156
164
|
end
|
data/lib/redpomo/file_cache.rb
CHANGED
data/lib/redpomo/task.rb
CHANGED
data/lib/redpomo/version.rb
CHANGED
data/spec/file_cache_spec.rb
CHANGED
@@ -6,11 +6,16 @@ describe Redpomo::FileCache do
|
|
6
6
|
|
7
7
|
describe "#get" do
|
8
8
|
it "executes the block on cache miss" do
|
9
|
-
Redpomo::FileCache.instance.cache_path
|
9
|
+
old_cache_path = Redpomo::FileCache.instance.cache_path
|
10
|
+
Redpomo::FileCache.instance.cache_path = tmp_path("cache_file")
|
11
|
+
|
10
12
|
counter = Redpomo::FileCache.get("foobar") { 5 }
|
11
13
|
counter.should == 5
|
14
|
+
|
12
15
|
counter = Redpomo::FileCache.get("foobar") { 10 }
|
13
16
|
counter.should == 5
|
17
|
+
|
18
|
+
Redpomo::FileCache.instance.cache_path = old_cache_path
|
14
19
|
end
|
15
20
|
end
|
16
21
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "redpomo add" do
|
5
|
+
|
6
|
+
let(:config_path) { tmp_path('redpomo') }
|
7
|
+
|
8
|
+
it "opens up a template file with REDPOMO_EDITOR as highest priority" do
|
9
|
+
redpomo "add", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "REDPOMO_EDITOR" => "echo redpomo_editor"}
|
10
|
+
out.should =~ /^redpomo_editor .*issue.*\.textile/
|
11
|
+
end
|
12
|
+
|
13
|
+
it "opens up a template file with VISUAL as 2nd highest priority" do
|
14
|
+
redpomo "add", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "REDPOMO_EDITOR" => ""}
|
15
|
+
out.should =~ /^visual .*issue.*\.textile/
|
16
|
+
end
|
17
|
+
|
18
|
+
it "opens up a template file with EDITOR as 3rd highest priority" do
|
19
|
+
redpomo "add", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
|
20
|
+
out.should =~ /^editor .*issue.*\.textile/
|
21
|
+
end
|
22
|
+
|
23
|
+
it "complains if no EDITOR is set" do
|
24
|
+
redpomo "add", :env => {"EDITOR" => "", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
|
25
|
+
out.should include "set $EDITOR or $REDPOMO_EDITOR"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -3,12 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe "redpomo init" do
|
5
5
|
|
6
|
-
let(:config_path) {
|
7
|
-
new_config = Tempfile.new('redpomo')
|
8
|
-
new_config_path = new_config.path
|
9
|
-
new_config.unlink
|
10
|
-
new_config_path
|
11
|
-
}
|
6
|
+
let(:config_path) { tmp_path('redpomo') }
|
12
7
|
|
13
8
|
it "generates a .redpomo config file" do
|
14
9
|
redpomo "init #{config_path}", env: { "EDITOR" => "echo editor" }
|
@@ -32,7 +27,7 @@ describe "redpomo init" do
|
|
32
27
|
|
33
28
|
it "complains if no EDITOR is set" do
|
34
29
|
redpomo "init #{config_path}", :env => {"EDITOR" => "", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
|
35
|
-
out.should
|
30
|
+
out.should include "set $EDITOR or $REDPOMO_EDITOR"
|
36
31
|
end
|
37
32
|
|
38
|
-
end
|
33
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/fixtures.rb
CHANGED
data/spec/support/ruby_ext.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redpomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
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: 2012-06-
|
12
|
+
date: 2012-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70127037894840 !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: *
|
24
|
+
version_requirements: *70127037894840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70127037894420 !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: *
|
35
|
+
version_requirements: *70127037894420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: todo-txt
|
38
|
-
requirement: &
|
38
|
+
requirement: &70127037894000 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70127037894000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest-client
|
49
|
-
requirement: &
|
49
|
+
requirement: &70127037893580 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70127037893580
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: launchy
|
60
|
-
requirement: &
|
60
|
+
requirement: &70127037893160 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70127037893160
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: applescript
|
71
|
-
requirement: &
|
71
|
+
requirement: &70127037892740 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70127037892740
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: terminal-table
|
82
|
-
requirement: &
|
82
|
+
requirement: &70127037892320 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70127037892320
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &70127037891900 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70127037891900
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: vcr
|
104
|
-
requirement: &
|
104
|
+
requirement: &70127037891480 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70127037891480
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: webmock
|
115
|
-
requirement: &
|
115
|
+
requirement: &70127037891060 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70127037891060
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: mocha
|
126
|
-
requirement: &
|
126
|
+
requirement: &70127037890640 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70127037890640
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: simplecov
|
137
|
-
requirement: &
|
137
|
+
requirement: &70127037890220 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70127037890220
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: rake
|
148
|
-
requirement: &
|
148
|
+
requirement: &70127037889800 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70127037889800
|
157
157
|
description: A nice little gem that integrates Redmine, Todo.txt and Pomodoro.app
|
158
158
|
email:
|
159
159
|
- stefano.verna@welaika.com
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- spec/fixtures/pull_results.txt
|
206
206
|
- spec/fixtures/tasks.txt
|
207
207
|
- spec/fixtures/timelog.csv
|
208
|
+
- spec/integration/add_spec.rb
|
208
209
|
- spec/integration/init_spec.rb
|
209
210
|
- spec/lib/redpomo/cli_spec.rb
|
210
211
|
- spec/lib/redpomo/entry_spec.rb
|
@@ -258,6 +259,7 @@ test_files:
|
|
258
259
|
- spec/fixtures/pull_results.txt
|
259
260
|
- spec/fixtures/tasks.txt
|
260
261
|
- spec/fixtures/timelog.csv
|
262
|
+
- spec/integration/add_spec.rb
|
261
263
|
- spec/integration/init_spec.rb
|
262
264
|
- spec/lib/redpomo/cli_spec.rb
|
263
265
|
- spec/lib/redpomo/entry_spec.rb
|