ptf 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ptf.rb +5 -2
- data/lib/ptf/client.rb +4 -2
- data/lib/ptf/client/group.rb +5 -10
- data/lib/ptf/client/summary.rb +3 -3
- data/lib/ptf/client/task.rb +10 -10
- data/lib/ptf/commands/group.rb +1 -0
- data/lib/ptf/commands/group/add.rb +13 -18
- data/lib/ptf/commands/group/remove.rb +52 -0
- data/lib/ptf/commands/init.rb +19 -20
- data/lib/ptf/commands/list.rb +76 -21
- data/lib/ptf/commands/task.rb +19 -23
- data/lib/ptf/commands/task/create.rb +11 -11
- data/lib/ptf/commands/task/edit.rb +104 -20
- data/lib/ptf/data_file.rb +40 -0
- data/lib/ptf/date.rb +61 -0
- data/lib/ptf/file_system.rb +81 -0
- data/lib/ptf/group.rb +115 -0
- data/lib/ptf/metadata_file.rb +301 -0
- data/lib/ptf/version.rb +1 -1
- metadata +8 -9
- data/lib/ptf/data.rb +0 -9
- data/lib/ptf/data/data_file.rb +0 -42
- data/lib/ptf/data/group.rb +0 -107
- data/lib/ptf/data/metadata_file.rb +0 -237
- data/lib/ptf/utilities.rb +0 -28
- data/lib/ptf/utilities/date.rb +0 -63
- data/lib/ptf/utilities/file_system.rb +0 -83
@@ -1,83 +0,0 @@
|
|
1
|
-
module Ptf
|
2
|
-
module Utilities
|
3
|
-
module FileSystem
|
4
|
-
class << self
|
5
|
-
|
6
|
-
def file_exist?(filepath)
|
7
|
-
File.file?(filepath)
|
8
|
-
end
|
9
|
-
|
10
|
-
def config
|
11
|
-
@config = Ptf::Config.get_config if @config.nil?
|
12
|
-
|
13
|
-
@config
|
14
|
-
end
|
15
|
-
|
16
|
-
def file_permission
|
17
|
-
@config[:file_permission]
|
18
|
-
end
|
19
|
-
|
20
|
-
def base_dir
|
21
|
-
config[:base_dir]
|
22
|
-
end
|
23
|
-
|
24
|
-
def id_counter_file
|
25
|
-
File.join(base_dir, config[:task_counter_file])
|
26
|
-
end
|
27
|
-
|
28
|
-
def id_counter_starting_content
|
29
|
-
config[:id_counter_start]
|
30
|
-
end
|
31
|
-
|
32
|
-
def group_list_file
|
33
|
-
File.join(base_dir, config[:group_list_file])
|
34
|
-
end
|
35
|
-
|
36
|
-
def metadata_dir
|
37
|
-
File.join(base_dir, config[:task_metadata_dir])
|
38
|
-
end
|
39
|
-
|
40
|
-
def metadata_open_dir
|
41
|
-
File.join(metadata_dir, config[:in_progress_dir])
|
42
|
-
end
|
43
|
-
|
44
|
-
def metadata_closed_dir
|
45
|
-
File.join(metadata_dir, config[:completed_dir])
|
46
|
-
end
|
47
|
-
|
48
|
-
def data_dir
|
49
|
-
File.join(base_dir, config[:task_data_dir])
|
50
|
-
end
|
51
|
-
|
52
|
-
def tmp_dir
|
53
|
-
File.join(base_dir, config[:tmp_dir])
|
54
|
-
end
|
55
|
-
|
56
|
-
def id_exist?(id)
|
57
|
-
next_id = File.read(id_counter_file).to_i
|
58
|
-
|
59
|
-
(id < next_id && id > 0)
|
60
|
-
end
|
61
|
-
|
62
|
-
def find_file(id, open = true)
|
63
|
-
raise ArgumentError, "No task with id #{id} exists." unless id_exist?(id)
|
64
|
-
|
65
|
-
search_dir = (open ? metadata_open_dir : metadata_closed_dir)
|
66
|
-
groups = Ptf::Data::Group.all_groups
|
67
|
-
|
68
|
-
groups.each do |g|
|
69
|
-
dir = File.join(search_dir, g.name)
|
70
|
-
possible_id_file = File.join(dir, id.to_s)
|
71
|
-
|
72
|
-
if file_exist?(possible_id_file)
|
73
|
-
return possible_id_file
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
nil
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|