gtdfiles 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
+ require 'encoding_handler'
1
2
  module ActionFileUtil
2
3
  def file_name(folder)
3
- "#{folder}/#{@description}.act"
4
+ os_file_name("#{folder}/#{@description}.act")
4
5
  end
5
6
  end
6
7
  module ActionInFile
@@ -3,7 +3,7 @@ require File.dirname(__FILE__)+'/utf8encoder'
3
3
  require 'rchardet'
4
4
  require 'iconv'
5
5
 
6
- ENCODING_HANDLER = UTF8Encoder.new true
6
+ ENCODING_HANDLER = UTF8Encoder.new GTDConfig[:BOM]
7
7
  def os_file_name(file_name)
8
8
  begin
9
9
  Iconv.conv(GTDConfig[:file_name_encoding],'utf-8',file_name)
@@ -39,7 +39,7 @@ def read_and_decode(file_name)
39
39
  end
40
40
 
41
41
  def write_to_encoded_file(file_name,text)
42
- File.open(os_file_name(file_name),"w") do |file|
42
+ File.open(file_name,"w") do |file|
43
43
  file.puts ENCODING_HANDLER.encode(text)
44
44
  end
45
45
 
data/lib/gtd.rb CHANGED
@@ -171,10 +171,14 @@ class GTDSystem
171
171
  def empty_inbox
172
172
  @inbox.entries.each do |entry|
173
173
  log "[Inbox]\t\t#{entry}"
174
- project = Project.new(entry,:review)
175
- project << Action.new(entry,@inbox)
176
- project.set_dirty
177
- @projects << project
174
+ unless entry[0]='@' then
175
+ project = Project.new(entry,:review)
176
+ project.infos << entry
177
+ project.set_dirty
178
+ @projects << project
179
+ else
180
+ puts "Action"
181
+ end
178
182
  end
179
183
  @inbox.empty!
180
184
  end
@@ -1,11 +1,12 @@
1
1
  GTDConfig = {
2
2
  :encoding=>"utf-8",
3
3
  :console_encoding=>"cp1252",
4
- :file_name_encoding=>"cp1252"
4
+ :file_name_encoding=>"cp1252",
5
+ :BOM=>true
5
6
  }
6
7
  ABBREVIATIONS = {
7
- "�berall"=>"Irgendwo/",
8
- "�berall"=>"Irgendwo/",
8
+ "�berall"=>"Irgendwo/",
9
+ "�berall"=>"Irgendwo/",
9
10
 
10
11
  "online"=>"Computer/Online/",
11
12
  "windows"=>"Computer/Windows/",
@@ -24,6 +25,8 @@ GTDConfig = {
24
25
  "24"=>"Computer/Handy/",
25
26
  "25"=>"Computer/Linux/",
26
27
  "26"=>"Computer/Online/",
28
+ "261"=>"Computer/Online/Amazon",
29
+ "262"=>"Computer/Online/GDocs",
27
30
  "264"=>"Computer/Online/GCal/",
28
31
  "266"=>"Computer/Online/Mail/",
29
32
  "27"=>"Computer/Online/P2P/",
@@ -48,6 +51,7 @@ GTDConfig = {
48
51
  "75"=>"Passau/Lesen/",
49
52
  "76"=>"Passau/Mintraching/",
50
53
 
51
- "8"=>"�berall/",
54
+ "8"=>"Uni/",
55
+ "88"=>"Uni/Türkisch/"
52
56
  }
53
57
 
@@ -32,7 +32,7 @@ require 'choice'
32
32
  require File.dirname(__FILE__)+'/persistence'
33
33
  require File.dirname(__FILE__)+'/logging'
34
34
  class GTDFiles
35
- VERSION = '0.8.1'
35
+ VERSION = '0.8.2'
36
36
  end
37
37
 
38
38
 
@@ -51,6 +51,12 @@ Choice.options do
51
51
  long '--process=DIRECTORY'
52
52
  desc 'Processes the given directory'
53
53
  end
54
+ option :inbox do
55
+ short '-i'
56
+ long '--inbox=DIRECTORY'
57
+ desc 'Empties the inbox in the given directory'
58
+ end
59
+
54
60
  option :reset do
55
61
  short '-r'
56
62
  long '--reset=DIRECTORY'
@@ -85,6 +91,14 @@ if __FILE__ == $0
85
91
  gtd_system.do_process
86
92
  #gtd_system.read_actions_in_done_folder
87
93
  end
94
+ if Choice.choices.inbox then
95
+ gtd_system = GTDFileSystem.new Choice.choices.inbox
96
+ log "Emptying Inbox in #{Choice.choices.inbox}"
97
+ gtd_system.read
98
+ #gtd_system.parse_action_files
99
+ gtd_system.empty_inbox
100
+ #gtd_system.read_actions_in_done_folder
101
+ end
88
102
 
89
103
  if not Choice.choices.simulate then
90
104
  log "Writing"
@@ -39,7 +39,7 @@ module ProjectFileWriter
39
39
  File.makedirs folder
40
40
  @actions.sort! {|a,b| index(b.status) <=> index(a.status)}
41
41
 
42
- write_to_encoded_file("#{folder}/#{@name}.prj", project_file_string)
42
+ write_to_encoded_file(os_file_name("#{folder}/#{@name}.prj"), project_file_string)
43
43
  end
44
44
 
45
45
  def project_file_string
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: gtdfiles
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.1
7
- date: 2007-06-07 00:00:00 +02:00
6
+ version: 0.8.2
7
+ date: 2007-06-19 00:00:00 +02:00
8
8
  summary: The author was too lazy to write a summary
9
9
  require_paths:
10
10
  - lib