sculd 0.0.1 → 0.0.2

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/CHANGES CHANGED
@@ -1,6 +1,10 @@
1
1
  = sdrt changelog
2
2
 
3
- == Master (for 0.0.2)
3
+ == Master (for 0.0.3)
4
+
5
+ == Version 0.0.2
6
+ * Dates are changed to be shown in colors.
7
+ * Dates which has no plan shows '(no plan)'
4
8
 
5
9
  == Version 0.0.1
6
10
  * Enable to use date and time.
data/Gemfile CHANGED
@@ -6,9 +6,10 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "rspec", "~> 2.11.0"
9
+ gem "rspec", "~> 2.12.0"
10
10
  gem "rdoc", "~> 3.12"
11
11
  gem "bundler", "~> 1.2.1"
12
12
  gem "jeweler", "~> 1.8.4"
13
13
  gem "simplecov", ">= 0"
14
+ gem "highline", ">= 1.6.15"
14
15
  end
data/README.rdoc CHANGED
@@ -1,15 +1,104 @@
1
1
  = sculd
2
2
 
3
- 4 types of Plan's; Reminder, Deadline, Schedule, Todo.
4
- Reminder: nil till the date, REMINDER_PRIORITY at the date, decrease after that.
5
- Deadline: nil till the date, REMINDER_PRIORITY at the beginning,
6
- increase after that,
7
- DEADLINE_PRIORITY at the deadline
8
- Todo: nil till the date, REMINDER_PRIORITY at the date, increase after that,
9
- DEADLINE_PRIORITY at the end.
10
- Schedule: no priority.
11
-
12
- For tasks, two hight of priority are set; REMINDER_PRIORITY and DEADLINE_PRIORITY.
3
+ Sculd, SChedULe Dealer, provides a command 'sculd'.
4
+ The command reads ~/.sculd.dat, which is written by HOWM like
5
+ format text file.
6
+ It can contain four types of plans;
7
+ * Reminder
8
+ * Deadline
9
+ * Schedule
10
+ * Todo
11
+ Each plan generate events and a task.
12
+ Command 'sculd' output events divided to each day
13
+ and tasks which have high priorities.
14
+
15
+ == word: plan, event, task
16
+ Word "plan" is a summarizing name for below;
17
+ * Reminder
18
+ * Deadline
19
+ * Schedule
20
+ * Todo
21
+
22
+ "event" indicates an occurance which do not need preparation.
23
+
24
+ "task" indicates a work which you need to consume time.
25
+
26
+ (MEMO: Event and Task can have a parent class "Job". But not so now.)
27
+
28
+ == plan
29
+ A typical example of a plan, e.g., deadline, is denoted below;
30
+ "[2012-11-04]!10 descriptionA."
31
+ "[2012-11-04]" is a date time part.
32
+ "!" is a plan type indicator.
33
+ "10" is an option for type indicator.
34
+ "descriptionA." is a description part.
35
+
36
+ === date time part
37
+ Digits included by square bracket indicates date.
38
+ This can be any format if Ruby DateTime::parse can interpret.
39
+
40
+ This can include information of time, i.e.,
41
+ "[2012-11-04 12:34:56]! descriptionA."
42
+
43
+ And can also include information of weekday in parentheses, i.e.,
44
+ "[2012-11-04 (Sun)]! descriptionA."
45
+ If the weekday of the date is mismatched with the weekday in
46
+ parentheses, 'sculd' outputs an error and stops.
47
+ This may be useful to confirm that the plan is correct.
48
+
49
+ === plan type indicates
50
+ "-": reminder
51
+ "!": deadline
52
+ "@": schedule
53
+ "+": todo
54
+
55
+
56
+ === priority
57
+ Two hight of priority are set for tasks;
58
+ REMINDER_PRIORITY (10000)
59
+ DEADLINE_PRIORITY (20000)
60
+
61
+ === Reminder
62
+ Till the date: no priority.
63
+ On the date: REMINDER_PRIORITY.
64
+ After the date: decrease gradually. (1 per day.)
65
+
66
+ Option for indiccate doesn't have meaning and is ignored.
67
+ A Reminder plan generates one event on the date.
68
+
69
+ === Schedule
70
+ Always : no priority.
71
+
72
+ Option for indiccate doesn't have meaning and is ignored.
73
+ A Schedule plan generates one event on the date.
74
+
75
+ === Deadline
76
+ Till the date: no priority.
77
+ Starting date: REMINDER_PRIORITY.
78
+ During : increase gradually. (linear)
79
+ On the date: DEADLINE_PRIORITY.
80
+ After the date: DEADLINE_PRIORITY, keeping.
81
+
82
+ Starting date is (the_date - option).
83
+ For example, Starting date of "[2012-11-14]!10 abc" is [2012-11-04].
84
+ The default value for the option is seven.
85
+
86
+ A Deadline plan generates two events;
87
+ on the starting date and the last date.
88
+
89
+ === Todo
90
+ Till the date: no priority.
91
+ On the date: REMINDER_PRIORITY.
92
+ During : increase gradually. (linear)
93
+ Last date: DEADLINE_PRIORITY.
94
+ After the date: DEADLINE_PRIORITY, keeping.
95
+
96
+ Todo is very similar to Deadline.
97
+ Only a difference is that the last day is given to deadline and
98
+ the first day is given to todo.
99
+
100
+ A Todo plan generates two events;
101
+ on the starting date and the last date.
13
102
 
14
103
 
15
104
  == Contributing to sculd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/sculd CHANGED
@@ -47,7 +47,8 @@ rescue Sculd::Manager::LoadError
47
47
  puts "Exit."
48
48
  exit
49
49
  end
50
- sm.show(OPTS[:event], OPTS[:task])
50
+ io = $stdout
51
+ sm.show(OPTS[:event], OPTS[:task], io)
51
52
 
52
53
  #while (true)
53
54
  # s.show(OPTS[:event], OPTS[:task])
data/lib/sculd/manager.rb CHANGED
@@ -3,6 +3,10 @@
3
3
 
4
4
  require "date"
5
5
  require "sculd.rb"
6
+
7
+ require "rubygems"
8
+ gem "highline"
9
+ require "highline"
6
10
  #require "/home/ippei/devel/sculd/lib/sculd.rb"
7
11
 
8
12
  #
@@ -20,7 +24,7 @@ class Sculd::Manager
20
24
  load_file(@source_file, io)
21
25
  end
22
26
 
23
- def show(num_event, num_task)
27
+ def show(num_event, num_task, io = $stdout)
24
28
  show_events(num_event)
25
29
  show_tasks(num_task)
26
30
  end
@@ -63,21 +67,36 @@ class Sculd::Manager
63
67
  # Show events in 'num' days from todary.
64
68
  def show_events(num, today = Date.today, io = $stdout)
65
69
  return if num == 0
70
+ hl = HighLine.new($stdin, io)
66
71
 
67
72
  d_e = days_events
68
73
  io.puts "Events:"
69
74
  num.times do |i|
70
75
  date = today + i
76
+ str = " #{date.to_s} #{WEEKDAYS[date.wday]} "
77
+
78
+ case date.wday
79
+ when 0
80
+ hl.say(" <%= color('#{str}', :white, :on_red) %>")
81
+ when 6
82
+ hl.say(" <%= color('#{str}', :white, :on_blue) %>")
83
+ else
84
+ hl.say(" <%= color('#{str}', :white, :on_black) %>")
85
+ end
86
+
71
87
  events = d_e[date]
72
88
  if events # if plan is not empty.
73
- io.puts " #{date.to_s} #{WEEKDAYS[date.wday]}"
89
+ #HIGHLINE.say("<%= color('red', :red) %>!")
90
+ #HIGHLINE.say(" <%= color(#{date.to_s} #{WEEKDAYS[date.wday]}, :white, :red) %>")
91
+ #hl.say(" <%= color('red', :red) %>!")
92
+ #io.puts str
74
93
  events.sort_by{|i| i.datetime}.each do |job|
75
94
  io.puts " #{job.description.strip}"
76
95
  end
77
- io.puts
78
96
  else
79
- next
97
+ io.puts " (no plan)"
80
98
  end
99
+ io.puts
81
100
  end
82
101
  end
83
102
 
data/lib/sculd/plan.rb CHANGED
@@ -36,9 +36,9 @@ class Sculd::Plan
36
36
  unless self.wday($1) == datetime.wday
37
37
  #io.puts "#{datetime} is #{Sculd::Manager::WEEKDAYS[datetime.wday]},"
38
38
  #io.puts "but string contains #{datestr}."
39
- puts "ERROR:"
40
- puts "#{datetime} is #{Sculd::Manager::WEEKDAYS[datetime.wday]},"
41
- puts "but string contains #{datestr}."
39
+ io.puts "ERROR:"
40
+ io.puts "#{datetime} is #{Sculd::Manager::WEEKDAYS[datetime.wday]},"
41
+ io.puts "but string contains #{datestr}."
42
42
  raise WeekdayMismatchError
43
43
  end
44
44
  end
data/sculd.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sculd"
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ippei94da"]
12
- s.date = "2012-11-01"
12
+ s.date = "2012-11-19"
13
13
  s.description = "Schedule management system using 'howm' like format. Plans, i.e., schedule(@), reminder(-), deadline(!), and tood(+), make events and tasks. Command 'sculd' can output events on each date and tasks with high priority. "
14
14
  s.email = "ippei94da@gmail.com"
15
15
  s.executables = ["dates", "sculd"]
@@ -63,24 +63,27 @@ Gem::Specification.new do |s|
63
63
  s.specification_version = 3
64
64
 
65
65
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
66
- s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
66
+ s.add_development_dependency(%q<rspec>, ["~> 2.12.0"])
67
67
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
68
68
  s.add_development_dependency(%q<bundler>, ["~> 1.2.1"])
69
69
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
70
70
  s.add_development_dependency(%q<simplecov>, [">= 0"])
71
+ s.add_development_dependency(%q<highline>, [">= 1.6.15"])
71
72
  else
72
- s.add_dependency(%q<rspec>, ["~> 2.11.0"])
73
+ s.add_dependency(%q<rspec>, ["~> 2.12.0"])
73
74
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
74
75
  s.add_dependency(%q<bundler>, ["~> 1.2.1"])
75
76
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
76
77
  s.add_dependency(%q<simplecov>, [">= 0"])
78
+ s.add_dependency(%q<highline>, [">= 1.6.15"])
77
79
  end
78
80
  else
79
- s.add_dependency(%q<rspec>, ["~> 2.11.0"])
81
+ s.add_dependency(%q<rspec>, ["~> 2.12.0"])
80
82
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
81
83
  s.add_dependency(%q<bundler>, ["~> 1.2.1"])
82
84
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
83
85
  s.add_dependency(%q<simplecov>, [">= 0"])
86
+ s.add_dependency(%q<highline>, [">= 1.6.15"])
84
87
  end
85
88
  end
86
89
 
data/spec/manager_spec.rb CHANGED
@@ -63,18 +63,19 @@ describe "Manager" do
63
63
  describe "#show_events" do
64
64
  it 'should return itemized days and events' do
65
65
  io = StringIO.new
66
- today = Date.new(2012, 9,6)
67
- @s01.show_events(10, today, io)
66
+ today = Date.new(2012, 9, 15)
67
+ @s01.show_events(2, today, io)
68
68
  io.rewind
69
69
  results = io.readlines
70
70
  #pp results
71
71
  results.size.should == 7
72
72
  results[0].should == "Events:\n"
73
- results[1].should == " 2012-09-09 Sun\n"
74
- results[2].should == " [2012-09-16]! deadline b\n"
73
+ #results[1].should == " 2012-09-09 Sun\n"
74
+ results[1].should == "  2012-09-15 Sat \n"
75
+ results[2].should == " [2012-09-15]@ schedule a\n"
75
76
  results[3].should == "\n"
76
- results[4].should == " 2012-09-15 Sat\n"
77
- results[5].should == " [2012-09-15]@ schedule a\n"
77
+ results[4].should == "  2012-09-16 Sun \n"
78
+ results[5].should == " [2012-09-16]! deadline b\n"
78
79
  results[6].should == "\n"
79
80
  #results[].should == "\n"
80
81
  #results[].should == " [2012-09-16]\n"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sculd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-01 00:00:00.000000000 Z
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &71356360 !ruby/object:Gem::Requirement
16
+ requirement: &75099820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.11.0
21
+ version: 2.12.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *71356360
24
+ version_requirements: *75099820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &71355770 !ruby/object:Gem::Requirement
27
+ requirement: &75099330 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *71355770
35
+ version_requirements: *75099330
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &71355240 !ruby/object:Gem::Requirement
38
+ requirement: &75098960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.2.1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *71355240
46
+ version_requirements: *75098960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &71354270 !ruby/object:Gem::Requirement
49
+ requirement: &75098570 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.8.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *71354270
57
+ version_requirements: *75098570
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &71353730 !ruby/object:Gem::Requirement
60
+ requirement: &75096840 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,18 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *71353730
68
+ version_requirements: *75096840
69
+ - !ruby/object:Gem::Dependency
70
+ name: highline
71
+ requirement: &74600910 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.6.15
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *74600910
69
80
  description: ! 'Schedule management system using ''howm'' like format. Plans, i.e.,
70
81
  schedule(@), reminder(-), deadline(!), and tood(+), make events and tasks. Command
71
82
  ''sculd'' can output events on each date and tasks with high priority. '
@@ -127,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
138
  version: '0'
128
139
  segments:
129
140
  - 0
130
- hash: 229991729
141
+ hash: -143096045
131
142
  required_rubygems_version: !ruby/object:Gem::Requirement
132
143
  none: false
133
144
  requirements: