rtasklib 0.1.0 → 0.1.1.pre.alpha

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.
@@ -0,0 +1,213 @@
1
+ require "virtus"
2
+ require "enumerator"
3
+
4
+ module Rtasklib
5
+
6
+ # A class that wraps a single Virtus domain model with a number of creation
7
+ # and manipulation methods
8
+ class Taskrc
9
+ # @attr config [Models::TaskrcModel] a custom Virtus domain model
10
+ attr_accessor :config
11
+
12
+ # Generate a dynamic Virtus model, with the attributes defined by the input
13
+ #
14
+ # @param rc [Hash, Pathname] either a hash of attribute value pairs
15
+ # or a Pathname to the raw taskrc file.
16
+ # @raise [TypeError] if rc is not of type Hash, String, or Pathname
17
+ # @raise [RuntimeError] if rc is a path and does not exist on the fs
18
+ def initialize rc, type=:array
19
+ @config = Models::TaskrcModel.new().extend(Virtus.model)
20
+
21
+ case type
22
+ when :array
23
+ mappable_to_model(rc)
24
+ when :hash
25
+ hash_to_model(rc)
26
+ when :path
27
+ if path_exist?(rc)
28
+ mappable_to_model(File.open(rc))
29
+ else
30
+ raise RuntimeError.new("rc path does not exist on the file system")
31
+ end
32
+ else
33
+ raise TypeError.new("no implicit conversion to Hash, String, or Pathname")
34
+ end
35
+ end
36
+
37
+ # Turn a hash of attribute => value pairs into a TaskrcModel object.
38
+ # There can be only one TaskrcModel object per Taskrc, it's saved to the
39
+ # instance variable `config`
40
+ #
41
+ # @param taskrc_hash [Hash{Symbol=>String}]
42
+ # @return [Models::TaskrcModel] the instance variable config
43
+ # @api private
44
+ def hash_to_model taskrc_hash
45
+ taskrc_hash.each do |attr, value|
46
+ add_model_attr(attr, value)
47
+ set_model_attr_value(attr, value)
48
+ end
49
+ config
50
+ end
51
+ private :hash_to_model
52
+
53
+ # Converts a .taskrc file path into a Hash that can be converted into a
54
+ # TaskrcModel object
55
+ #
56
+ # @param rc_path [String,Pathname] a valid pathname to a .taskrc file
57
+ # @return [Models::TaskrcModel] the instance variable config
58
+ # @api private
59
+ def mappable_to_model rc_file
60
+ rc_file.map! { |l| line_to_tuple(l) }.compact!
61
+ taskrc = Hash[rc_file]
62
+ hash_to_model(taskrc)
63
+ end
64
+ private :mappable_to_model
65
+
66
+ # Converts a line of the form "json.array=on" to [ :json_array, true ]
67
+ #
68
+ # @param line [String] a line from a .taskrc file
69
+ # @return [Array<Symbol, Object>, nil] a valid line returns an array of
70
+ # length 2, invalid input returns nil
71
+ # @api private
72
+ def line_to_tuple line
73
+ line = line.chomp.split('=', 2)
74
+
75
+ if line.size == 2 and not line.include? "#"
76
+ attr = get_hash_attr_from_rc line[0]
77
+ return [ attr.to_sym, line[1] ]
78
+ else
79
+ return nil
80
+ end
81
+ end
82
+ private :line_to_tuple
83
+
84
+ # Serialize the given attrs model back to the taskrc format
85
+ #
86
+ # @param attrs [Array] a splat of attributes
87
+ # @return [Array<String>] an array of CLI formatted strings
88
+ # @api public
89
+ def part_of_model_to_rc *attrs
90
+ attrs.map do |attr|
91
+ value = get_model_attr_value attr
92
+ hash_attr = get_rc_attr_from_hash attr.to_s
93
+ attr = "rc.#{hash_attr}=#{value}"
94
+ end
95
+ end
96
+
97
+ # Serialize all attrs of the model to the taskrc format
98
+ #
99
+ # @return [Array<String>] an array of CLI formatted strings
100
+ # @api public
101
+ def model_to_rc
102
+ part_of_model_to_rc(*config.attributes.keys)
103
+ end
104
+
105
+ # Serialize the given attrs model back to the taskrc format and reduce them
106
+ # to a string that can be passed directly to Execute
107
+ #
108
+ # @param attrs [Array] a splat of attributes
109
+ # @return [String] a CLI formatted string
110
+ # @api public
111
+ def part_of_model_to_s *attrs
112
+ part_of_model_to_rc(*attrs).join(" ")
113
+ end
114
+
115
+ # Serialize all attrs model back to the taskrc format and reduce them
116
+ # to a string that can be passed directly to Execute
117
+ #
118
+ # @return [String] a CLI formatted string
119
+ # @api public
120
+ def model_to_s
121
+ model_to_rc().join(" ")
122
+ end
123
+
124
+ # Dynamically add a Virtus attr, detect Boolean, Integer, and Float types
125
+ # based on the value, otherwise just treat it like a string.
126
+ # Int needs to precede float because ints are also floats
127
+ # Modifies the config instance variable
128
+ # TODO: May also be able to detect arrays
129
+ #
130
+ # @param attr [#to_sym] the name for the attr, e.g. "json_array"
131
+ # @param value [String] the value of the attr, e.g. "yes"
132
+ # @return [undefined]
133
+ # @api private
134
+ def add_model_attr attr, value
135
+ if boolean? value
136
+ config.attribute attr.to_sym, Axiom::Types::Boolean
137
+ elsif integer? value
138
+ config.attribute attr.to_sym, Integer
139
+ elsif float? value
140
+ config.attribute attr.to_sym, Float
141
+ else
142
+ config.attribute attr.to_sym, String
143
+ end
144
+ end
145
+ private :add_model_attr
146
+
147
+ # Modifies the value of a given attr in the config object
148
+ #
149
+ # @param attr [#to_s] the name for the attr, e.g. "json_array"
150
+ # @param attr [String] the value of the attr, e.g. "yes"
151
+ # @return [undefined]
152
+ # @api public
153
+ def set_model_attr_value attr, value
154
+ config.send("#{attr}=".to_sym, value)
155
+ end
156
+
157
+ # Gets the current value of a given attr in the config object
158
+ #
159
+ # @param attr [#to_s] the name for the attr, e.g. "json_array"
160
+ # @return [Object] the type varies depending on the type attr
161
+ # @api public
162
+ def get_model_attr_value attr
163
+ config.send("#{attr.to_s}".to_sym)
164
+ end
165
+
166
+ # @param attr [String] the name for the attr, e.g. "json_array"
167
+ # @return [String]
168
+ # @api private
169
+ def get_hash_attr_from_rc attr
170
+ return attr.gsub(".", "_")
171
+ end
172
+ private :get_hash_attr_from_rc
173
+
174
+ # @param attr [String] the name for the attr, e.g. "json_array"
175
+ # @return [String]
176
+ # @api private
177
+ def get_rc_attr_from_hash attr
178
+ return attr.gsub("_", ".")
179
+ end
180
+ private :get_rc_attr_from_hash
181
+
182
+ # Check whether a given object is a path and it exists on the file system
183
+ #
184
+ # @param path [Object]
185
+ # @return [Boolean]
186
+ # @api private
187
+ def path_exist? path
188
+ if path.is_a? Pathname
189
+ return path.exist?
190
+ elsif path.is_a? String
191
+ return Pathname.new(path).exist?
192
+ else
193
+ return false
194
+ end
195
+ end
196
+ private :path_exist?
197
+
198
+ def integer? value
199
+ value.to_i.to_s == value
200
+ end
201
+ private :integer?
202
+
203
+ def float? value
204
+ Float(value) rescue false
205
+ end
206
+ private :float?
207
+
208
+ def boolean? value
209
+ ["on", "off", "yes", "no", "false", "true"].include? value.to_s.downcase
210
+ end
211
+ private :boolean?
212
+ end
213
+ end
@@ -1,3 +1,3 @@
1
1
  module Rtasklib
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1-alpha"
3
3
  end
data/lib/rtasklib.rb CHANGED
@@ -1,5 +1,51 @@
1
- require "rtasklib/version"
1
+ require_relative "rtasklib/version"
2
+ require_relative "rtasklib/models"
3
+ require_relative "rtasklib/execute"
4
+ require_relative "rtasklib/controller"
5
+ require_relative "rtasklib/serializer"
6
+ require_relative "rtasklib/taskrc"
7
+
8
+ require "open3"
9
+ require "pathname"
2
10
 
3
11
  module Rtasklib
4
- # Your code goes here...
12
+
13
+ class TaskWarrior
14
+ attr_reader :version, :data_location, :taskrc, :create_new,
15
+ :override, :override_a, :override_str
16
+
17
+ include Controller
18
+
19
+ DEFAULTS = {
20
+ json_array: 'true',
21
+ verbose: 'nothing',
22
+ confirmation: 'no',
23
+ dependency_confirmation: 'no',
24
+ exit_on_missing_db: 'yes', }
25
+
26
+ LOWEST_VERSION = Gem::Version.new('2.4.0')
27
+
28
+ def initialize data="#{Dir.home}/.task", opts = {}
29
+
30
+ @data_location = data
31
+ override_h = DEFAULTS.merge({data_location: data}).merge(opts)
32
+ @override = Taskrc.new(override_h, :hash)
33
+ @override_a = override.model_to_rc
34
+ @config = get_rc
35
+
36
+ # Check TaskWarrior version, and throw warning if unavailable
37
+ begin
38
+ @version = check_version(get_version())
39
+ rescue
40
+ warn "Couldn't verify TaskWarrior's version"
41
+ end
42
+ end
43
+
44
+ def check_version version
45
+ if version < LOWEST_VERSION
46
+ warn "The current TaskWarrior version, #{version}, is untested"
47
+ end
48
+ version
49
+ end
50
+ end
5
51
  end
Binary file
data/rtasklib.gemspec CHANGED
@@ -14,18 +14,28 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "http://github.com/dropofwill/rtasklib"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ #.reject { |f| f.match(%r{^(test|spec|features)/}) }
18
19
  spec.bindir = "exe"
19
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
21
  spec.require_paths = ["lib"]
21
22
 
23
+ spec.add_dependency "virtus"
24
+ spec.add_dependency "ruby_expect"
25
+ spec.add_dependency "activesupport"
26
+ spec.add_dependency "activemodel"
27
+ spec.add_dependency "active_model_serializers"
28
+ spec.add_dependency "ice_nine"
29
+ spec.add_dependency "oj"
30
+ spec.add_dependency "multi_json"
31
+ spec.add_dependency "iso8601"
32
+
22
33
  spec.add_development_dependency "bundler", "~> 1.8"
23
34
  spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "coveralls"
24
36
  spec.add_development_dependency "rspec"
25
37
  spec.add_development_dependency "rspec-nc"
26
38
  spec.add_development_dependency "guard"
27
39
  spec.add_development_dependency "guard-rspec"
28
- spec.add_development_dependency "pry"
29
- spec.add_development_dependency "pry-remote"
30
- spec.add_development_dependency "pry-nav"
40
+ spec.add_development_dependency "yard"
31
41
  end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rtasklib::Controller do
4
+ include Rtasklib::Controller
5
+
6
+ it 'can handle sub version numbers' do
7
+ expect(to_gem_version("2.5.3 (afdj5)"))
8
+ .to eq(Gem::Version.new("2.5.3.afdj5"))
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ {"description":"Wash dishes","entry":"20150316T174823Z","modified":"20150316T174823Z","status":"pending","uuid":"1ecac94d-b4d6-4c02-98f7-75e4de03006b"}
2
+ {"description":"Clean room","entry":"20150316T174852Z","modified":"20150316T174852Z","status":"pending","uuid":"12d3176a-b6b1-42ab-90ad-6cd6acf8d6a1"}
File without changes
@@ -0,0 +1,2 @@
1
+ [description:"Wash dishes" entry:"1426528103" modified:"1426528103" status:"pending" uuid:"1ecac94d-b4d6-4c02-98f7-75e4de03006b"]
2
+ [description:"Clean room" entry:"1426528132" modified:"1426528132" status:"pending" uuid:"12d3176a-b6b1-42ab-90ad-6cd6acf8d6a1"]
@@ -0,0 +1,6 @@
1
+ time 1426528103
2
+ new [description:"Wash dishes" entry:"1426528103" modified:"1426528103" status:"pending" uuid:"1ecac94d-b4d6-4c02-98f7-75e4de03006b"]
3
+ ---
4
+ time 1426528132
5
+ new [description:"Clean room" entry:"1426528132" modified:"1426528132" status:"pending" uuid:"12d3176a-b6b1-42ab-90ad-6cd6acf8d6a1"]
6
+ ---
data/spec/data/.taskrc ADDED
@@ -0,0 +1,231 @@
1
+ data.location=./.task
2
+
3
+ forcecolor=no
4
+ abbreviation.minimum=2
5
+ active.indicator=*
6
+ alias.burndown=burndown.weekly
7
+ alias.ghistory=ghistory.monthly
8
+ alias.history=history.monthly
9
+ alias.rm=delete
10
+ alias.shell=exec tasksh
11
+ allow.empty.filter=yes
12
+ avoidlastcolumn=no
13
+ bulk=3
14
+ burndown.bias=0.666
15
+ calendar.details=sparse
16
+ calendar.details.report=list
17
+ calendar.holidays=none
18
+ calendar.legend=yes
19
+ calendar.offset=no
20
+ calendar.offset.value=-1
21
+ color=on
22
+ color.active=color15 on rgb035
23
+ color.alternate=on gray0
24
+ color.blocked=bold gray10 on gray4
25
+ color.blocking=bold gray18 on gray6
26
+ color.burndown.done=on rgb013
27
+ color.burndown.pending=on gray9
28
+ color.burndown.started=on gray16
29
+ color.calendar.due=color0 on gray10
30
+ color.calendar.due.today=color0 on gray15
31
+ color.calendar.holiday=color15 on rgb005
32
+ color.calendar.overdue=color0 on gray20
33
+ color.calendar.today=underline black on color15
34
+ color.calendar.weekend=on gray4
35
+ color.calendar.weeknumber=gray10
36
+ color.completed=
37
+ color.debug=rgb500
38
+ color.deleted=
39
+ color.due=color0 on rgb013
40
+ color.due.today=color0 on rgb024
41
+ color.error=rgb500
42
+ color.footnote=gray10
43
+ color.header=gray10
44
+ color.history.add=on gray9
45
+ color.history.delete=black on gray23
46
+ color.history.done=black on rgb013
47
+ color.label=
48
+ color.label.sort=
49
+ color.overdue=color0 on rgb035
50
+ color.pri.H=
51
+ color.pri.L=
52
+ color.pri.M=
53
+ color.pri.none=
54
+ color.project.none=
55
+ color.recurring=
56
+ color.scheduled=
57
+ color.summary.background=on color0
58
+ color.summary.bar=on rgb012
59
+ color.sync.added=gray10
60
+ color.sync.changed=gray15
61
+ color.sync.rejected=gray23
62
+ color.tag.next=
63
+ color.tag.none=
64
+ color.tagged=
65
+ color.undo.after=red
66
+ color.undo.before=green
67
+ color.until=
68
+ color.warning=
69
+ column.padding=1
70
+ complete.all.tags=no
71
+ confirmation=yes
72
+ dateformat=Y-M-D
73
+ dateformat.annotation=
74
+ dateformat.edit=Y-M-D H:N:S
75
+ dateformat.holiday=YMD
76
+ dateformat.info=Y-M-D H:N:S
77
+ dateformat.report=
78
+ debug=no
79
+ default.command=next
80
+ default.due=
81
+ default.priority=
82
+ default.project=
83
+ defaultheight=24
84
+ defaultwidth=80
85
+ dependency.confirmation=on
86
+ dependency.indicator=D
87
+ dependency.reminder=on
88
+ detection=on
89
+ displayweeknumber=yes
90
+ dom=on
91
+ due=7
92
+ exit.on.missing.db=no
93
+ expressions=infix
94
+ fontunderline=yes
95
+ gc=on
96
+ hooks=on
97
+ hyphenate=on
98
+ indent.annotation=2
99
+ indent.report=0
100
+ journal.info=on
101
+ journal.time=no
102
+ journal.time.start.annotation=Started task
103
+ journal.time.stop.annotation=Stopped task
104
+ json.array=off
105
+ list.all.projects=no
106
+ list.all.tags=no
107
+ locking=on
108
+ nag=You have more urgent tasks.
109
+ print.empty.columns=no
110
+ recurrence.confirmation=prompt
111
+ recurrence.indicator=R
112
+ recurrence.limit=1
113
+ regex=yes
114
+ report.active.columns=id,start,start.age,entry.age,depends.indicator,priority,project,tags,recur,wait.indicator,scheduled.age,due,until,description
115
+ report.active.description=Active tasks
116
+ report.active.filter=status:pending and +ACTIVE
117
+ report.active.labels=ID,Started,Active,Age,D,P,Project,Tags,Recur,W,Sch,Due,Until,Description
118
+ report.active.sort=project+,start+
119
+ report.all.columns=id,status.short,uuid.short,start.active,entry.age,end.age,depends.indicator,priority,project.parent,tags.count,recur.indicator,wait.age,scheduled.age,due,until.age,description
120
+ report.all.description=All tasks
121
+ report.all.labels=ID,St,UUID,A,Age,Done,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description
122
+ report.all.sort=entry-
123
+ report.blocked.columns=id,depends,project,priority,due,start.active,entry.age,description
124
+ report.blocked.description=Blocked tasks
125
+ report.blocked.filter=status:pending +BLOCKED
126
+ report.blocked.labels=ID,Deps,Proj,Pri,Due,Active,Age,Description
127
+ report.blocked.sort=due+,priority-,start-,project+
128
+ report.blocking.columns=id,uuid.short,start.active,depends,project,tags,recur,wait.indicator,scheduled.age,due.age,until.age,description.count,urgency
129
+ report.blocking.description=Blocking tasks
130
+ report.blocking.filter=status:pending +BLOCKING
131
+ report.blocking.labels=ID,UUID,A,Deps,Project,Tags,R,W,Sch,Due,Until,Description,Urg
132
+ report.blocking.sort=urgency-,due+,entry+
133
+ report.completed.columns=id,uuid.short,entry,end,entry.age,depends,priority,project,tags,recur.indicator,due,description
134
+ report.completed.description=Completed tasks
135
+ report.completed.filter=status:completed
136
+ report.completed.labels=ID,UUID,Created,Completed,took,Deps,P,Project,Tags,R,Due,Description
137
+ report.completed.sort=end+
138
+ report.list.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur.indicator,scheduled.countdown,due,until.age,description.count,urgency
139
+ report.list.description=Most details of tasks
140
+ report.list.filter=status:pending
141
+ report.list.labels=ID,Active,Age,D,P,Project,Tags,R,Sch,Due,Until,Description,Urg
142
+ report.list.sort=start-,due+,project+/,urgency-
143
+ report.long.columns=id,start.active,entry,modified.age,depends,priority,project,tags,recur,wait.age,scheduled,due,until,description
144
+ report.long.description=All details of tasks
145
+ report.long.filter=status:pending
146
+ report.long.labels=ID,A,Created,Mod,Deps,P,Project,Tags,Recur,Wait,Sched,Due,Until,Description
147
+ report.long.sort=modified-
148
+ report.ls.columns=id,start.active,depends.indicator,project,tags,recur.indicator,wait.age,scheduled.countdown,due.countdown,until.countdown,description.count
149
+ report.ls.description=Few details of tasks
150
+ report.ls.filter=status:pending
151
+ report.ls.labels=ID,A,D,Project,Tags,R,Wait,S,Due,Until,Description
152
+ report.ls.sort=start-,description+
153
+ report.minimal.columns=id,project,tags.count,description.count
154
+ report.minimal.description=Minimal details of tasks
155
+ report.minimal.filter=(status:pending or status:waiting)
156
+ report.minimal.labels=ID,Project,Tags,Description
157
+ report.minimal.sort=project+/,description+
158
+ report.newest.columns=id,start.age,entry,entry.age,modified.age,depends.indicator,priority,project,tags,recur.indicator,wait.age,scheduled.countdown,due,until.age,description
159
+ report.newest.description=Newest tasks
160
+ report.newest.filter=(status:pending or status:waiting) and recur.none:
161
+ report.newest.labels=ID,Active,Created,Age,Mod,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description
162
+ report.newest.sort=entry-
163
+ report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.age,until.age,description,urgency
164
+ report.next.description=Most urgent tasks
165
+ report.next.filter=status:pending limit:page
166
+ report.next.labels=ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg
167
+ report.next.sort=start-,urgency-
168
+ report.oldest.columns=id,start.age,entry,entry.age,modified.age,depends.indicator,priority,project,tags,recur.indicator,wait.age,scheduled.countdown,due,until.age,description
169
+ report.oldest.description=Oldest tasks
170
+ report.oldest.filter=(status:pending or status:waiting)
171
+ report.oldest.labels=ID,Active,Created,Age,Mod,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description
172
+ report.oldest.sort=entry+
173
+ report.overdue.columns=id,start.age,entry.age,depends,priority,project,tags,recur.indicator,scheduled.countdown,due,until,description,urgency
174
+ report.overdue.description=Overdue tasks
175
+ report.overdue.filter=(status:pending or status:waiting) and +OVERDUE
176
+ report.overdue.labels=ID,Active,Age,Deps,P,Project,Tag,R,S,Due,Until,Description,Urg
177
+ report.overdue.sort=urgency-,due+
178
+ report.ready.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur.indicator,scheduled.countdown,due.countdown,until.age,description,urgency
179
+ report.ready.description=Most urgent actionable tasks
180
+ report.ready.filter=+READY
181
+ report.ready.labels=ID,Active,Age,D,P,Project,Tags,R,S,Due,Until,Description,Urg
182
+ report.ready.sort=start-,urgency-
183
+ report.recurring.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur,scheduled.countdown,due,until.age,description,urgency
184
+ report.recurring.description=Recurring Tasks
185
+ report.recurring.filter=(status:pending or status:waiting) and (+PARENT or +CHILD)
186
+ report.recurring.labels=ID,Active,Age,D,P,Project,Tags,Recur,Sch,Due,Until,Description,Urg
187
+ report.recurring.sort=due+,urgency-,entry+
188
+ report.unblocked.columns=id,depends,project,priority,due,start.active,entry.age,description
189
+ report.unblocked.description=Unblocked tasks
190
+ report.unblocked.filter=status:pending -BLOCKED
191
+ report.unblocked.labels=ID,Deps,Proj,Pri,Due,Active,Age,Description
192
+ report.unblocked.sort=due+,priority-,start-,project+
193
+ report.waiting.columns=id,start.active,entry.age,depends.indicator,priority,project,tags,recur.indicator,wait,wait.age,scheduled,due,until,description
194
+ report.waiting.description=Waiting (hidden) tasks
195
+ report.waiting.filter=+WAITING
196
+ report.waiting.labels=ID,A,Age,D,P,Project,Tags,R,Wait,for,Sched,Due,Until,Description
197
+ report.waiting.sort=due+,wait+,entry+
198
+ reserved.lines=1
199
+ row.padding=0
200
+ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,pri.
201
+ search.case.sensitive=yes
202
+ shell.prompt=task>
203
+ tag.indicator=+
204
+ taskd.ca=~/.task/ca.cert.pem
205
+ taskd.certificate=~/.task/private.certificate.pem
206
+ taskd.ciphers=NORMAL
207
+ taskd.credentials=inthe_am/whp3652/76399cb0-70e4-42c0-9a2e-4095a11d52b2
208
+ taskd.key=~/.task/private.key.pem
209
+ taskd.server=taskwarrior.inthe.am:53589
210
+ taskd.trust=ignore hostname
211
+ uda.author.label=Auth
212
+ uda.author.type=string
213
+ uda.author.values=
214
+ undo.style=side
215
+ urgency.active.coefficient=4.0
216
+ urgency.age.coefficient=2.0
217
+ urgency.age.max=365
218
+ urgency.annotations.coefficient=1.0
219
+ urgency.blocked.coefficient=-5.0
220
+ urgency.blocking.coefficient=8.0
221
+ urgency.due.coefficient=12.0
222
+ urgency.inherit.coefficient=0.0
223
+ urgency.next.coefficient=15.0
224
+ urgency.priority.coefficient=6.0
225
+ urgency.project.coefficient=1.0
226
+ urgency.scheduled.coefficient=5.0
227
+ urgency.tags.coefficient=1.0
228
+ urgency.waiting.coefficient=-3.0
229
+ verbose=yes
230
+ weekstart=sunday
231
+ xterm.title=no
@@ -0,0 +1,2 @@
1
+ require 'spec_helper'
2
+
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+ require 'rtasklib/models'
3
+
4
+ describe Rtasklib::Models do
5
+
6
+ it 'Rtasklib::Models exists in module' do
7
+ expect(Rtasklib::Models).not_to be nil
8
+ end
9
+
10
+ describe Rtasklib::Models::TaskModel do
11
+ # let(:data) { Hash.new(description: "Wash dishes") }
12
+ context "Create a task with the bare minimum" do
13
+
14
+ subject { Rtasklib::Models::TaskModel.new({description: "Wash dishes"}) }
15
+
16
+ it "description is a String" do
17
+ expect(subject.description.class).to eq String
18
+ end
19
+
20
+ it "description is 'Wash dishes'" do
21
+ expect(subject.description).to eq "Wash dishes"
22
+ end
23
+
24
+ # it "private attributes are not accessible directly" do
25
+ # expect{subject.uuid = 1}.to raise_error NoMethodError
26
+ # end
27
+
28
+ # it "but can be set with dynamic private setters" do
29
+ # expect(subject.set_uuid("10")).to eq "10"
30
+ # end
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rtasklib do
4
+ it 'has a version number' do
5
+ expect(Rtasklib::VERSION).not_to be nil
6
+ end
7
+
8
+ describe Rtasklib::TaskWarrior do
9
+ describe "Rtasklib::TaskWarrior.new('spec/data/.taskrc')" do
10
+ subject{ Rtasklib::TaskWarrior.new('spec/data/.taskrc') }
11
+ it 'has a version number' do
12
+ expect(subject.version.class).to eq Gem::Version
13
+ end
14
+
15
+ it 'uses a default configuration override' do
16
+ end
17
+ end
18
+
19
+ describe "Rtasklib::TaskWarrior.new('spec/data/.taskrc', {color: off})" do
20
+ subject{ Rtasklib::TaskWarrior.new('spec/data/.taskrc', {verbose: 'on'}) }
21
+ it 'updates the default configuration override' do
22
+ end
23
+ end
24
+ end
25
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'coveralls'
3
+ require 'rtasklib'
4
+
5
+ Coveralls.wear!