gyunyu 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +48 -2
- data/VERSION +1 -1
- data/gyunyu.gemspec +4 -2
- data/lib/gyunyu/command/export/app.rb +36 -24
- data/lib/gyunyu/command/export/custom_filter.rb +152 -0
- data/lib/gyunyu/command/export/option.rb +19 -5
- data/spec/app/command/export/custom_filter_spec.rb +319 -0
- metadata +23 -21
data/README.rdoc
CHANGED
@@ -7,14 +7,60 @@ simple RTM app for CLI made with Ruby
|
|
7
7
|
* Ruby ( tested with Ruby 1.9.2 )
|
8
8
|
* read permission of RTM API
|
9
9
|
|
10
|
+
== Install
|
11
|
+
|
12
|
+
$ gem install gyunyu
|
13
|
+
|
14
|
+
== How to use
|
15
|
+
|
16
|
+
$ gyunyu
|
17
|
+
Usage: gyunyu [options]
|
18
|
+
-l, --list LIST
|
19
|
+
-f, --filter FILTER
|
20
|
+
-d, --field FIELD
|
21
|
+
-o, --format FORMAT
|
22
|
+
$ gyunyu -f 'dueWithin:"1 week"'
|
23
|
+
list,task_id,name,due
|
24
|
+
家,227119591,可燃ゴミ,2012-01-10 08:00:00 +0900
|
25
|
+
家,226594887,可燃ゴミ,2012-01-06 08:00:00 +0900
|
26
|
+
家,226034564,資源回収ゴミ,2012-01-08 00:00:00 +0900
|
27
|
+
...
|
28
|
+
|
29
|
+
== Filter Howto
|
30
|
+
|
31
|
+
$ gyunyu -l 仕事 -l 個人
|
32
|
+
# => list:仕事 and list:個人
|
33
|
+
|
34
|
+
$ gyunyu -l 仕事 -f due:today
|
35
|
+
# => list:仕事 and due:today
|
36
|
+
|
37
|
+
On 2012-01-05,
|
38
|
+
|
39
|
+
$ gyunyu -l 個人 -c today
|
40
|
+
# => list:個人 and dueAfter:2012-01-04T23:59:59Z and dueBefore:2012-01-05T24:00:00Z
|
41
|
+
|
42
|
+
Even if you live in a timezone other than UTC, you get true today's task list !
|
43
|
+
|
44
|
+
== Field Howto
|
45
|
+
|
46
|
+
$ gyunyu -d name -d due
|
47
|
+
list,name,due
|
48
|
+
...
|
49
|
+
|
50
|
+
same above
|
51
|
+
|
52
|
+
$ gyunyu -d name,due
|
53
|
+
list,name,due
|
54
|
+
...
|
55
|
+
|
10
56
|
== Supported
|
11
57
|
|
12
58
|
* store API token ( and reuse )
|
13
|
-
* only `export' command. supported formats are CSV, JSON, YAML.
|
59
|
+
* only `export' command. supported formats are CSV, JSON, YAML. ( default is CSV )
|
14
60
|
|
15
61
|
== Not Supported
|
16
62
|
|
17
|
-
* Tags and notes for csv exporting
|
63
|
+
* Tags and notes for csv exporting ( dumped as YAML inline format )
|
18
64
|
* Convert Date to (ISO 8601 + UTC) in search filter. Currently search results are out of alignment.
|
19
65
|
* Default filter
|
20
66
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/gyunyu.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gyunyu}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{wtnabe}]
|
12
|
-
s.date = %q{2012-01-
|
12
|
+
s.date = %q{2012-01-06}
|
13
13
|
s.description = %q{now available export command}
|
14
14
|
s.email = %q{wtnabe@gmail.com}
|
15
15
|
s.executables = [%q{gyunyu}]
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/gyunyu/app.rb",
|
32
32
|
"lib/gyunyu/command.rb",
|
33
33
|
"lib/gyunyu/command/export/app.rb",
|
34
|
+
"lib/gyunyu/command/export/custom_filter.rb",
|
34
35
|
"lib/gyunyu/command/export/format/csv.rb",
|
35
36
|
"lib/gyunyu/command/export/format/json.rb",
|
36
37
|
"lib/gyunyu/command/export/format/yaml.rb",
|
@@ -38,6 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
"lib/gyunyu/expander.rb",
|
39
40
|
"lib/gyunyu/token.rb",
|
40
41
|
"spec/app/.gitkeep",
|
42
|
+
"spec/app/command/export/custom_filter_spec.rb",
|
41
43
|
"spec/app/command/export/option_spec.rb",
|
42
44
|
"spec/app/command_spec.rb",
|
43
45
|
"spec/app/expander_spec.rb",
|
@@ -33,7 +33,7 @@ module Gyunyu
|
|
33
33
|
#
|
34
34
|
def format_module
|
35
35
|
format = option.format.to_s.capitalize
|
36
|
-
|
36
|
+
Format.const_get(format)
|
37
37
|
end
|
38
38
|
|
39
39
|
#
|
@@ -46,7 +46,11 @@ module Gyunyu
|
|
46
46
|
|
47
47
|
def run
|
48
48
|
if @argv.size > 0
|
49
|
-
|
49
|
+
if option.show_filter_list
|
50
|
+
puts CustomFilter.filter.keys.sort
|
51
|
+
else
|
52
|
+
export( build_filter )
|
53
|
+
end
|
50
54
|
else
|
51
55
|
puts option.parser
|
52
56
|
end
|
@@ -60,10 +64,13 @@ module Gyunyu
|
|
60
64
|
filters = []
|
61
65
|
|
62
66
|
filters << option.lists.map { |l| "list:#{l}" }.join(' and ') if option.lists.size > 0
|
67
|
+
filters << CustomFilter.filter[option.custom_filter] if option.custom_filter
|
63
68
|
filters << option.filter if option.filter
|
64
69
|
filters << filter if filter
|
65
70
|
|
66
|
-
'(' + filters.join(') and (') + ')'
|
71
|
+
f = '(' + filters.join(') and (') + ')'
|
72
|
+
STDERR.puts f
|
73
|
+
f
|
67
74
|
end
|
68
75
|
|
69
76
|
#
|
@@ -73,7 +80,7 @@ module Gyunyu
|
|
73
80
|
def task_list( filter = nil )
|
74
81
|
RTM::Tasks::GetList.new( token,
|
75
82
|
nil,
|
76
|
-
|
83
|
+
filter ).invoke
|
77
84
|
end
|
78
85
|
|
79
86
|
#
|
@@ -92,28 +99,33 @@ module Gyunyu
|
|
92
99
|
#
|
93
100
|
def pickup_fields( filter = nil )
|
94
101
|
tasks = []
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
102
|
+
|
103
|
+
result = task_list( filter )
|
104
|
+
if result.respond_to? :each
|
105
|
+
result.each { |l|
|
106
|
+
list_name = find_list( l['id'] ).name
|
107
|
+
tasks += Gyunyu::Expander.taskseries( l['taskseries'] ).map { |t|
|
108
|
+
record = {'list' => list_name}
|
109
|
+
option.fields.each { |f|
|
110
|
+
val = if TIME_FIELDS.include?( f )
|
111
|
+
localtime( t[f] )
|
112
|
+
else
|
113
|
+
t[f]
|
114
|
+
end
|
115
|
+
if f == 'estimate'
|
116
|
+
e = split_estimate( t[f] )
|
117
|
+
record['estimate(d)'] = e.day
|
118
|
+
record['estimate(h)'] = e.hour
|
119
|
+
record['estimate(m)'] = e.min
|
120
|
+
else
|
121
|
+
record[f] = val
|
122
|
+
end
|
123
|
+
}
|
124
|
+
record
|
113
125
|
}
|
114
|
-
record
|
115
126
|
}
|
116
|
-
|
127
|
+
end
|
128
|
+
|
117
129
|
tasks
|
118
130
|
end
|
119
131
|
|
@@ -0,0 +1,152 @@
|
|
1
|
+
module Gyunyu
|
2
|
+
module Command
|
3
|
+
module Export
|
4
|
+
module CustomFilter
|
5
|
+
START_SECOND = 'T23:59:59Z'
|
6
|
+
LAST_SECOND = 'T24:00:00Z'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def today
|
10
|
+
Date.today
|
11
|
+
end
|
12
|
+
|
13
|
+
def filter
|
14
|
+
filter = {}
|
15
|
+
|
16
|
+
%w( yesterday today tomorrow last_week this_week next_week
|
17
|
+
last_month this_month next_month ).each { |term|
|
18
|
+
due = [
|
19
|
+
"dueAfter:" + send("from_#{term}"),
|
20
|
+
"dueBefore:" + send("until_#{term}")
|
21
|
+
].join( ' and ' )
|
22
|
+
filter[term] = due
|
23
|
+
filter["#{term}_yet"] = due + incomplete
|
24
|
+
}
|
25
|
+
|
26
|
+
filter
|
27
|
+
end
|
28
|
+
|
29
|
+
def last_sunday
|
30
|
+
if today.sunday?
|
31
|
+
today - 7
|
32
|
+
else
|
33
|
+
proc { |d|
|
34
|
+
until d.sunday?
|
35
|
+
d -= 1
|
36
|
+
end
|
37
|
+
d
|
38
|
+
}.call(today)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def next_sunday
|
43
|
+
if today.sunday?
|
44
|
+
today + 7
|
45
|
+
else
|
46
|
+
proc { |d|
|
47
|
+
until d.sunday?
|
48
|
+
d += 1
|
49
|
+
end
|
50
|
+
d
|
51
|
+
}.call(today)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def from_yesterday
|
56
|
+
(today - 2).to_s + START_SECOND
|
57
|
+
end
|
58
|
+
|
59
|
+
def until_yesterday
|
60
|
+
(today - 1).to_s + LAST_SECOND
|
61
|
+
end
|
62
|
+
|
63
|
+
def from_today
|
64
|
+
(today - 1).to_s + START_SECOND
|
65
|
+
end
|
66
|
+
|
67
|
+
def until_today
|
68
|
+
today.to_s + LAST_SECOND
|
69
|
+
end
|
70
|
+
|
71
|
+
def from_tomorrow
|
72
|
+
today.to_s + START_SECOND
|
73
|
+
end
|
74
|
+
|
75
|
+
def until_tomorrow
|
76
|
+
(today + 1).to_s + LAST_SECOND
|
77
|
+
end
|
78
|
+
|
79
|
+
def from_last_week
|
80
|
+
if today.sunday?
|
81
|
+
(last_sunday - 1).to_s + START_SECOND
|
82
|
+
else
|
83
|
+
(last_sunday - 8).to_s + START_SECOND
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def until_last_week
|
88
|
+
if today.sunday?
|
89
|
+
(today - 1).to_s + LAST_SECOND
|
90
|
+
else
|
91
|
+
(last_sunday - 1).to_s + LAST_SECOND
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def from_this_week
|
96
|
+
if today.sunday?
|
97
|
+
(today - 1).to_s + START_SECOND
|
98
|
+
else
|
99
|
+
(last_sunday - 1).to_s + START_SECOND
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def until_this_week
|
104
|
+
(next_sunday - 1).to_s + LAST_SECOND
|
105
|
+
end
|
106
|
+
|
107
|
+
def from_next_week
|
108
|
+
(next_sunday - 1).to_s + START_SECOND
|
109
|
+
end
|
110
|
+
|
111
|
+
def until_next_week
|
112
|
+
(next_sunday + 6).to_s + LAST_SECOND
|
113
|
+
end
|
114
|
+
|
115
|
+
def from_last_month
|
116
|
+
d = today << 2
|
117
|
+
Date.new( d.year, d.mon, -1 ).to_s + START_SECOND
|
118
|
+
end
|
119
|
+
|
120
|
+
def until_last_month
|
121
|
+
d = today << 1
|
122
|
+
Date.new( d.year, d.mon, -1 ).to_s + LAST_SECOND
|
123
|
+
end
|
124
|
+
|
125
|
+
def from_this_month
|
126
|
+
d = today << 1
|
127
|
+
Date.new( d.year, d.mon, -1 ).to_s + START_SECOND
|
128
|
+
end
|
129
|
+
|
130
|
+
def until_this_month
|
131
|
+
d = today
|
132
|
+
Date.new( d.year, d.mon, -1 ).to_s + LAST_SECOND
|
133
|
+
end
|
134
|
+
|
135
|
+
def from_next_month
|
136
|
+
d = today
|
137
|
+
Date.new( d.year, d.mon, -1 ).to_s + START_SECOND
|
138
|
+
end
|
139
|
+
|
140
|
+
def until_next_month
|
141
|
+
d = today >> 1
|
142
|
+
Date.new( d.year, d.mon, -1 ).to_s + LAST_SECOND
|
143
|
+
end
|
144
|
+
|
145
|
+
def incomplete
|
146
|
+
' and status:incomplete'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -6,18 +6,21 @@ module Gyunyu
|
|
6
6
|
module Export
|
7
7
|
class Option
|
8
8
|
class FormatNotFound < StandardError; end
|
9
|
+
class CustomFilterNotFound < StandardError; end
|
9
10
|
|
10
11
|
FIELD_SEP = ','
|
11
12
|
|
12
13
|
def initialize( argv = [] )
|
13
|
-
@lists
|
14
|
-
@filter
|
15
|
-
@
|
16
|
-
@
|
14
|
+
@lists = []
|
15
|
+
@filter = nil
|
16
|
+
@custom_filter = nil
|
17
|
+
@fields = []
|
18
|
+
@format = :csv
|
19
|
+
@show_filter_list = false
|
17
20
|
|
18
21
|
parser.parse( argv )
|
19
22
|
end
|
20
|
-
attr_reader :lists, :filter, :fields, :format
|
23
|
+
attr_reader :lists, :filter, :custom_filter, :fields, :format, :show_filter_list
|
21
24
|
|
22
25
|
def fields
|
23
26
|
if @fields.size > 0
|
@@ -37,6 +40,17 @@ module Gyunyu
|
|
37
40
|
opt.on('-f', '--filter FILTER') { |filter|
|
38
41
|
@filter = filter if filter.size > 0
|
39
42
|
}
|
43
|
+
opt.on('-c', '--custom-filter FILTER') { |filter|
|
44
|
+
mod = Module.nesting[1].const_get('CustomFilter')
|
45
|
+
if mod.filter.has_key?( filter )
|
46
|
+
@custom_filter = filter
|
47
|
+
else
|
48
|
+
raise CustomFilterNotFound
|
49
|
+
end
|
50
|
+
}
|
51
|
+
opt.on('-s', '--custom-filter-list') { |c|
|
52
|
+
@show_filter_list = true
|
53
|
+
}
|
40
54
|
opt.on('-d', '--field FIELD') { |field|
|
41
55
|
if field.include?( FIELD_SEP )
|
42
56
|
@fields = field.split( FIELD_SEP )
|
@@ -0,0 +1,319 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
describe Gyunyu::Command::Export::CustomFilter do
|
4
|
+
mod = Gyunyu::Command::Export::CustomFilter
|
5
|
+
|
6
|
+
define_method :force_weekday do
|
7
|
+
mod.class_eval {
|
8
|
+
def self.today
|
9
|
+
Date.parse('2012-01-05')
|
10
|
+
end
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
define_method :force_sunday do
|
15
|
+
mod.class_eval {
|
16
|
+
def self.today
|
17
|
+
Date.parse('2012-01-01')
|
18
|
+
end
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
before {
|
23
|
+
force_weekday
|
24
|
+
}
|
25
|
+
|
26
|
+
describe 'today' do
|
27
|
+
subject {
|
28
|
+
mod.today
|
29
|
+
}
|
30
|
+
it {
|
31
|
+
should == Date.parse('2012-01-05')
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'last_sunday' do
|
36
|
+
context 'weekdy 2012-01-05' do
|
37
|
+
subject {
|
38
|
+
mod.last_sunday
|
39
|
+
}
|
40
|
+
it {
|
41
|
+
should == Date.parse('2012-01-01')
|
42
|
+
}
|
43
|
+
end
|
44
|
+
context 'sunday 2012-01-01' do
|
45
|
+
before {
|
46
|
+
force_sunday
|
47
|
+
}
|
48
|
+
subject {
|
49
|
+
mod.last_sunday
|
50
|
+
}
|
51
|
+
it {
|
52
|
+
should == Date.parse('2011-12-25')
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe 'next_sunday' do
|
58
|
+
context 'weekday 2012-01-05' do
|
59
|
+
subject {
|
60
|
+
mod.next_sunday
|
61
|
+
}
|
62
|
+
it {
|
63
|
+
should == Date.parse('2012-01-08')
|
64
|
+
}
|
65
|
+
end
|
66
|
+
context 'sunday 2012-01-01' do
|
67
|
+
before {
|
68
|
+
force_sunday
|
69
|
+
}
|
70
|
+
subject {
|
71
|
+
mod.next_sunday
|
72
|
+
}
|
73
|
+
it {
|
74
|
+
should == Date.parse('2012-01-08')
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe 'from_yesterday' do
|
80
|
+
subject {
|
81
|
+
mod.from_yesterday
|
82
|
+
}
|
83
|
+
it {
|
84
|
+
should == '2012-01-03T23:59:59Z'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
describe 'until_yesterday' do
|
89
|
+
subject {
|
90
|
+
mod.until_yesterday
|
91
|
+
}
|
92
|
+
it {
|
93
|
+
should == '2012-01-04T24:00:00Z'
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
describe 'from_today' do
|
98
|
+
subject {
|
99
|
+
mod.from_today
|
100
|
+
}
|
101
|
+
it {
|
102
|
+
should == '2012-01-04T23:59:59Z'
|
103
|
+
}
|
104
|
+
end
|
105
|
+
|
106
|
+
describe 'until_today' do
|
107
|
+
subject {
|
108
|
+
mod.until_today
|
109
|
+
}
|
110
|
+
it {
|
111
|
+
should == '2012-01-05T24:00:00Z'
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
describe 'from_tomorrow' do
|
116
|
+
subject {
|
117
|
+
mod.from_tomorrow
|
118
|
+
}
|
119
|
+
it {
|
120
|
+
should == '2012-01-05T23:59:59Z'
|
121
|
+
}
|
122
|
+
end
|
123
|
+
|
124
|
+
describe 'until_tomorrow' do
|
125
|
+
subject {
|
126
|
+
mod.until_tomorrow
|
127
|
+
}
|
128
|
+
it {
|
129
|
+
should == '2012-01-06T24:00:00Z'
|
130
|
+
}
|
131
|
+
end
|
132
|
+
|
133
|
+
describe 'from_last_week' do
|
134
|
+
context 'weekday 2012-01-05' do
|
135
|
+
subject {
|
136
|
+
mod.from_last_week
|
137
|
+
}
|
138
|
+
it {
|
139
|
+
should == '2011-12-24T23:59:59Z'
|
140
|
+
}
|
141
|
+
end
|
142
|
+
context 'sunday 2012-01-01' do
|
143
|
+
before {
|
144
|
+
force_sunday
|
145
|
+
}
|
146
|
+
subject {
|
147
|
+
mod.from_last_week
|
148
|
+
}
|
149
|
+
it {
|
150
|
+
should == '2011-12-24T23:59:59Z'
|
151
|
+
}
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe 'until_last_week' do
|
156
|
+
context 'weekday 2012-01-05' do
|
157
|
+
subject {
|
158
|
+
mod.until_last_week
|
159
|
+
}
|
160
|
+
it {
|
161
|
+
should == '2011-12-31T24:00:00Z'
|
162
|
+
}
|
163
|
+
end
|
164
|
+
context 'sunday 2011-01-01' do
|
165
|
+
before {
|
166
|
+
force_sunday
|
167
|
+
}
|
168
|
+
subject {
|
169
|
+
mod.until_last_week
|
170
|
+
}
|
171
|
+
it {
|
172
|
+
should == '2011-12-31T24:00:00Z'
|
173
|
+
}
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe 'from_this_week' do
|
178
|
+
context 'weekday 2012-01-05' do
|
179
|
+
subject {
|
180
|
+
mod.from_this_week
|
181
|
+
}
|
182
|
+
it {
|
183
|
+
should == '2011-12-31T23:59:59Z'
|
184
|
+
}
|
185
|
+
end
|
186
|
+
context 'sunday 2012-01-01' do
|
187
|
+
before {
|
188
|
+
force_sunday
|
189
|
+
}
|
190
|
+
subject {
|
191
|
+
mod.from_this_week
|
192
|
+
}
|
193
|
+
it {
|
194
|
+
should == '2011-12-31T23:59:59Z'
|
195
|
+
}
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
describe 'until_this_week' do
|
200
|
+
context 'weekday 2012-01-05' do
|
201
|
+
subject {
|
202
|
+
mod.until_this_week
|
203
|
+
}
|
204
|
+
it {
|
205
|
+
should == '2012-01-07T24:00:00Z'
|
206
|
+
}
|
207
|
+
end
|
208
|
+
context 'sunday 2012-01-01' do
|
209
|
+
before {
|
210
|
+
force_sunday
|
211
|
+
}
|
212
|
+
subject {
|
213
|
+
mod.until_this_week
|
214
|
+
}
|
215
|
+
it {
|
216
|
+
should == '2012-01-07T24:00:00Z'
|
217
|
+
}
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe 'from_next_week' do
|
222
|
+
context 'weekday 2012-01-05' do
|
223
|
+
subject {
|
224
|
+
mod.from_next_week
|
225
|
+
}
|
226
|
+
it {
|
227
|
+
should == '2012-01-07T23:59:59Z'
|
228
|
+
}
|
229
|
+
end
|
230
|
+
context 'sunday 2012-01-01' do
|
231
|
+
before {
|
232
|
+
force_sunday
|
233
|
+
}
|
234
|
+
subject {
|
235
|
+
mod.from_next_week
|
236
|
+
}
|
237
|
+
it {
|
238
|
+
should == '2012-01-07T23:59:59Z'
|
239
|
+
}
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe 'until_next_week' do
|
244
|
+
context 'weekday 2012-01-05' do
|
245
|
+
subject {
|
246
|
+
mod.until_next_week
|
247
|
+
}
|
248
|
+
it {
|
249
|
+
should == '2012-01-14T24:00:00Z'
|
250
|
+
}
|
251
|
+
end
|
252
|
+
context 'sunday 2012-01-01' do
|
253
|
+
before {
|
254
|
+
force_sunday
|
255
|
+
}
|
256
|
+
subject {
|
257
|
+
mod.until_next_week
|
258
|
+
}
|
259
|
+
it {
|
260
|
+
should == '2012-01-14T24:00:00Z'
|
261
|
+
}
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
describe 'from_last_month' do
|
266
|
+
subject {
|
267
|
+
mod.from_last_month
|
268
|
+
}
|
269
|
+
it {
|
270
|
+
should == '2011-11-30T23:59:59Z'
|
271
|
+
}
|
272
|
+
end
|
273
|
+
|
274
|
+
describe 'until_last_month' do
|
275
|
+
subject {
|
276
|
+
mod.until_last_month
|
277
|
+
}
|
278
|
+
it {
|
279
|
+
should == '2011-12-31T24:00:00Z'
|
280
|
+
}
|
281
|
+
end
|
282
|
+
|
283
|
+
describe 'from_this_month' do
|
284
|
+
subject {
|
285
|
+
mod.from_this_month
|
286
|
+
}
|
287
|
+
it {
|
288
|
+
should == '2011-12-31T23:59:59Z'
|
289
|
+
}
|
290
|
+
end
|
291
|
+
|
292
|
+
describe 'until_this_month' do
|
293
|
+
subject {
|
294
|
+
mod.until_this_month
|
295
|
+
}
|
296
|
+
it {
|
297
|
+
should == '2012-01-31T24:00:00Z'
|
298
|
+
}
|
299
|
+
end
|
300
|
+
|
301
|
+
describe 'from_next_month' do
|
302
|
+
subject {
|
303
|
+
mod.from_next_month
|
304
|
+
}
|
305
|
+
it {
|
306
|
+
should == '2012-01-31T23:59:59Z'
|
307
|
+
}
|
308
|
+
end
|
309
|
+
|
310
|
+
describe 'until_next_month' do
|
311
|
+
subject {
|
312
|
+
mod.until_next_month
|
313
|
+
}
|
314
|
+
it {
|
315
|
+
should == '2012-02-29T24:00:00Z'
|
316
|
+
}
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyunyu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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-01-
|
12
|
+
date: 2012-01-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rtmilk
|
16
|
-
requirement: &
|
16
|
+
requirement: &3042960 !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: *3042960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: xml-simple
|
27
|
-
requirement: &
|
27
|
+
requirement: &3042710 !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: *3042710
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rtm-time
|
38
|
-
requirement: &
|
38
|
+
requirement: &3042410 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.2.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *3042410
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &3042170 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.3.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *3042170
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &3041880 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *3041880
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &3041620 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *3041620
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yard
|
82
|
-
requirement: &
|
82
|
+
requirement: &3041380 !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: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *3041380
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rcov
|
93
|
-
requirement: &
|
93
|
+
requirement: &3041140 !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: *3041140
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rr
|
104
|
-
requirement: &
|
104
|
+
requirement: &3040840 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *3040840
|
113
113
|
description: now available export command
|
114
114
|
email: wtnabe@gmail.com
|
115
115
|
executables:
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/gyunyu/app.rb
|
133
133
|
- lib/gyunyu/command.rb
|
134
134
|
- lib/gyunyu/command/export/app.rb
|
135
|
+
- lib/gyunyu/command/export/custom_filter.rb
|
135
136
|
- lib/gyunyu/command/export/format/csv.rb
|
136
137
|
- lib/gyunyu/command/export/format/json.rb
|
137
138
|
- lib/gyunyu/command/export/format/yaml.rb
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- lib/gyunyu/expander.rb
|
140
141
|
- lib/gyunyu/token.rb
|
141
142
|
- spec/app/.gitkeep
|
143
|
+
- spec/app/command/export/custom_filter_spec.rb
|
142
144
|
- spec/app/command/export/option_spec.rb
|
143
145
|
- spec/app/command_spec.rb
|
144
146
|
- spec/app/expander_spec.rb
|
@@ -162,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
164
|
version: '0'
|
163
165
|
segments:
|
164
166
|
- 0
|
165
|
-
hash:
|
167
|
+
hash: 1021094161
|
166
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
169
|
none: false
|
168
170
|
requirements:
|