ical2gcal 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ical2gcal.gemspec +3 -2
- data/lib/ical2gcal.rb +18 -1
- data/spec/ical2gcal_spec.rb +27 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/ical2gcal.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ical2gcal"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["wtnabe"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-06-01"
|
13
13
|
s.description = "You can sync local and remote ics file(s) to google calendar"
|
14
14
|
s.email = "wtnabe@gmail.com"
|
15
15
|
s.executables = ["ical2gcal"]
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/ics.rb",
|
34
34
|
"lib/ics/events.rb",
|
35
35
|
"lib/ics/list.rb",
|
36
|
+
"spec/ical2gcal_spec.rb",
|
36
37
|
"spec/ics/events_spec.rb",
|
37
38
|
"spec/ics/list_spec.rb",
|
38
39
|
"spec/spec_helper.rb",
|
data/lib/ical2gcal.rb
CHANGED
@@ -5,7 +5,11 @@ require File.dirname( __FILE__ ) + '/google'
|
|
5
5
|
require 'optparse'
|
6
6
|
require 'pit'
|
7
7
|
|
8
|
+
Version = open(File.dirname(__FILE__) + '/../VERSION').read
|
9
|
+
|
8
10
|
module Ical2gcal
|
11
|
+
class MissingPitConfigOfGoogleAccount < StandardError; end
|
12
|
+
|
9
13
|
class App
|
10
14
|
def initialize
|
11
15
|
@ics = nil
|
@@ -17,7 +21,7 @@ module Ical2gcal
|
|
17
21
|
def run
|
18
22
|
opts.parse( ARGV )
|
19
23
|
|
20
|
-
conf =
|
24
|
+
conf = pit_get_google
|
21
25
|
conf.merge!( {'calendar' => {'name' => @target}} ) if @target
|
22
26
|
g = Ical2gcal::Google.new( conf )
|
23
27
|
g.remove_all_events
|
@@ -38,6 +42,19 @@ module Ical2gcal
|
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
45
|
+
#
|
46
|
+
# [return] Hash
|
47
|
+
#
|
48
|
+
def pit_get_google
|
49
|
+
info = ::Pit.get('google')
|
50
|
+
|
51
|
+
if info.size > 0
|
52
|
+
info
|
53
|
+
else
|
54
|
+
raise MissingPitConfigOfGoogleAccount, 'execute "pit set google"'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
41
58
|
#
|
42
59
|
# [return] Array
|
43
60
|
#
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe Ical2gcal::App do
|
4
|
+
describe '#pit_get_google' do
|
5
|
+
context 'has google conf' do
|
6
|
+
before {
|
7
|
+
Pit.stub(:get) { {'username' => 'foo'} }
|
8
|
+
}
|
9
|
+
subject {
|
10
|
+
Ical2gcal::App.new.pit_get_google.class
|
11
|
+
}
|
12
|
+
it {
|
13
|
+
should == Hash
|
14
|
+
}
|
15
|
+
end
|
16
|
+
context 'doen\'t have google conf' do
|
17
|
+
before {
|
18
|
+
Pit.stub(:get) { {} }
|
19
|
+
}
|
20
|
+
it {
|
21
|
+
expect{
|
22
|
+
Ical2gcal::App.new.pit_get_google.class
|
23
|
+
}.to raise_error(Ical2gcal::MissingPitConfigOfGoogleAccount)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ical2gcal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ri_cal
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/ics.rb
|
228
228
|
- lib/ics/events.rb
|
229
229
|
- lib/ics/list.rb
|
230
|
+
- spec/ical2gcal_spec.rb
|
230
231
|
- spec/ics/events_spec.rb
|
231
232
|
- spec/ics/list_spec.rb
|
232
233
|
- spec/spec_helper.rb
|
@@ -247,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
248
|
version: '0'
|
248
249
|
segments:
|
249
250
|
- 0
|
250
|
-
hash:
|
251
|
+
hash: 1351007073461572694
|
251
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
253
|
none: false
|
253
254
|
requirements:
|