ical_punch 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
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.0
1
+ 1.0.1
data/bin/ical_punch CHANGED
@@ -50,7 +50,7 @@ IcalPunch.load
50
50
 
51
51
  commands = {
52
52
  'to_ical' => lambda do |project|
53
- if OPTIONS[:file_name]
53
+ if OPTIONS[:file_name] && OPTIONS[:file_name].size > 0
54
54
  IcalPunch.to_ical(project, OPTIONS[:file_name])
55
55
  else
56
56
  IcalPunch.to_ical(project)
data/ical_punch.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ical_punch}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Kaufman"]
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
- File.open(File.expand_path(file_path), "w") do |file|
97
- file.write(punch_to_calendar(project_name).to_ical)
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
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rob Kaufman