ical_punch 1.0.0 → 1.0.1
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/README.rdoc +8 -0
- data/VERSION +1 -1
- data/bin/ical_punch +1 -1
- data/ical_punch.gemspec +1 -1
- data/lib/ical_punch.rb +14 -3
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -9,6 +9,14 @@ ical_punch converts between iCalendar files and the punch.yml format
|
|
9
9
|
|
10
10
|
* sudo gem install ical_punch
|
11
11
|
|
12
|
+
== USAGE:
|
13
|
+
|
14
|
+
For project PROJ_NAME:
|
15
|
+
ical_punch to_ical PROJ_NAME
|
16
|
+
|
17
|
+
For all:
|
18
|
+
ical_punch to_ical
|
19
|
+
|
12
20
|
== Note on Patches/Pull Requests
|
13
21
|
|
14
22
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/bin/ical_punch
CHANGED
data/ical_punch.gemspec
CHANGED
data/lib/ical_punch.rb
CHANGED
@@ -44,9 +44,11 @@ module IcalPunch
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def punch_to_calendars
|
47
|
+
@all_calendars = []
|
47
48
|
data.keys.each do |key|
|
48
|
-
punch_to_calendar(key)
|
49
|
+
@all_calendars << punch_to_calendar(key)
|
49
50
|
end
|
51
|
+
return @all_calendars
|
50
52
|
end
|
51
53
|
|
52
54
|
def punch_to_calendar(project)
|
@@ -93,8 +95,17 @@ module IcalPunch
|
|
93
95
|
end
|
94
96
|
|
95
97
|
def to_ical(project_name, file_path = "~/punch.ics")
|
96
|
-
|
97
|
-
|
98
|
+
if project_name && project_name.size > 0
|
99
|
+
File.open(File.expand_path(file_path), "w") do |file|
|
100
|
+
file.write(punch_to_calendar(project_name).to_ical)
|
101
|
+
end
|
102
|
+
else
|
103
|
+
punch_to_calendars.each_with_index do |calendar_data, i|
|
104
|
+
file_name = file_path.gsub(".ics", "#{i}.ics")
|
105
|
+
File.open(File.expand_path(file_name), "w") do |file|
|
106
|
+
file.write(calendar_data.to_ical)
|
107
|
+
end
|
108
|
+
end
|
98
109
|
end
|
99
110
|
end
|
100
111
|
|