calfilter 1.2.0 → 1.2.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/.gitignore +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -0
- data/History.txt +8 -0
- data/{README.txt → README.rdoc} +0 -0
- data/Rakefile +6 -22
- data/calfilter.gemspec +35 -0
- data/example.rb +1 -1
- data/lib/calfilter.rb +0 -1
- data/lib/calfilter/cgi.rb +9 -1
- data/lib/calfilter/version.rb +3 -0
- data/{test/test_calfilter_cgi.rb → spec/calfilter/calfilter_cgi_spec.rb} +4 -8
- data/{test/test_calfilter.rb → spec/calfilter/calfilter_spec.rb} +18 -23
- data/spec/spec_helper.rb +19 -0
- metadata +116 -87
- data.tar.gz.sig +0 -4
- metadata.gz.sig +0 -0
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p392
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
calfilter (1.2.1)
|
5
|
+
icalendar
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.1.2)
|
11
|
+
icalendar (1.1.6)
|
12
|
+
mocha (0.9.12)
|
13
|
+
rake (0.9.2)
|
14
|
+
rspec (2.6.0)
|
15
|
+
rspec-core (~> 2.6.0)
|
16
|
+
rspec-expectations (~> 2.6.0)
|
17
|
+
rspec-mocks (~> 2.6.0)
|
18
|
+
rspec-core (2.6.4)
|
19
|
+
rspec-expectations (2.6.0)
|
20
|
+
diff-lcs (~> 1.1.2)
|
21
|
+
rspec-mocks (2.6.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
calfilter!
|
28
|
+
mocha
|
29
|
+
rake
|
30
|
+
rspec
|
data/History.txt
CHANGED
data/{README.txt → README.rdoc}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -1,24 +1,8 @@
|
|
1
|
-
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
2
3
|
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
desc "Run all examples"
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
7
|
|
7
|
-
|
8
|
-
def extra_deps
|
9
|
-
@extra_deps.reject do |x|
|
10
|
-
Array(x).first == 'hoe'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# Class structure isn't complex enough to make diagrams worthwhile.
|
16
|
-
ENV['NODOT'] = "true"
|
17
|
-
|
18
|
-
Hoe.new('calfilter', CalFilter::VERSION) do |p|
|
19
|
-
p.rubyforge_name = 'thinkrelevance'
|
20
|
-
p.developer('Glenn Vanderburg', 'glenn@thinkrelevance.com')
|
21
|
-
p.extra_deps = %w{icalendar}
|
22
|
-
end
|
23
|
-
|
24
|
-
# vim: syntax=Ruby
|
8
|
+
task :default => :spec
|
data/calfilter.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "calfilter/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "calfilter"
|
7
|
+
s.version = CalFilter::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Glenn Vanderburg"]
|
10
|
+
s.email = ["glv@vanderburg.org"]
|
11
|
+
s.homepage = "http://github.com/glv/calfilter"
|
12
|
+
s.summary = %q{Filter icalendar files or streams}
|
13
|
+
s.description = %q{calfilter is a small library to assist in writing filtering
|
14
|
+
programs for icalendar files or streams.}
|
15
|
+
|
16
|
+
s.rubyforge_project = "calfilter"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
# s.required_ruby_version = '>= 1.9.2'
|
24
|
+
|
25
|
+
add_runtime_dependency = if s.respond_to?(:specification_version) && Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
:add_runtime_dependency
|
27
|
+
else
|
28
|
+
:add_dependency
|
29
|
+
end
|
30
|
+
s.send(add_runtime_dependency, 'icalendar')
|
31
|
+
|
32
|
+
s.add_development_dependency 'mocha'
|
33
|
+
s.add_development_dependency 'rake'
|
34
|
+
s.add_development_dependency 'rspec'
|
35
|
+
end
|
data/example.rb
CHANGED
@@ -8,7 +8,7 @@ gem 'calfilter'
|
|
8
8
|
require 'calfilter'
|
9
9
|
require 'calfilter/cgi'
|
10
10
|
|
11
|
-
filter_calendars(CalFilter::CGI.query_string
|
11
|
+
filter_calendars(CalFilter::CGI.query_string) do |cal|
|
12
12
|
cal.keep(:events) # drop todos, journals, etc.
|
13
13
|
|
14
14
|
cal.filter_events do |evt|
|
data/lib/calfilter.rb
CHANGED
data/lib/calfilter/cgi.rb
CHANGED
@@ -25,8 +25,16 @@ module CalFilter
|
|
25
25
|
CGI.new
|
26
26
|
end
|
27
27
|
|
28
|
+
def cgi_constant_defined?
|
29
|
+
if RUBY_VERSION < "1.9"
|
30
|
+
CalFilter.const_defined?('CGI')
|
31
|
+
else
|
32
|
+
CalFilter.const_defined?('CGI', false)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
28
36
|
def set_cgi_constant
|
29
|
-
CalFilter.const_set('CGI', create_cgi_instance) unless
|
37
|
+
CalFilter.const_set('CGI', create_cgi_instance) unless cgi_constant_defined?
|
30
38
|
end
|
31
39
|
|
32
40
|
def finish
|
@@ -1,8 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'test/spec'
|
3
|
-
require 'mocha'
|
4
|
-
|
5
|
-
require 'calfilter'
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
6
2
|
|
7
3
|
def at_exit(&block)
|
8
4
|
$at_exit_block = block
|
@@ -15,12 +11,12 @@ describe "calfilter cgi scripts" do
|
|
15
11
|
end
|
16
12
|
|
17
13
|
it "should initialize a CGIWrapper object" do
|
18
|
-
|
14
|
+
CalFilter::CGIWrapper.should_not be_nil
|
19
15
|
end
|
20
16
|
|
21
17
|
it "should set CalFilter's output stream" do
|
22
|
-
|
23
|
-
|
18
|
+
CalFilter::CGIWRAPPER.output_stream.should_not be_nil
|
19
|
+
CalFilter.output_stream.should == CalFilter::CGIWRAPPER.output_stream
|
24
20
|
end
|
25
21
|
|
26
22
|
it "should finish the CGI on process exit" do
|
@@ -1,8 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'test/spec'
|
3
|
-
require 'mocha'
|
4
|
-
|
5
|
-
require 'calfilter'
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
6
2
|
|
7
3
|
describe "filtering calendars" do
|
8
4
|
it "should fetch urls and parse them" do
|
@@ -23,19 +19,19 @@ describe "filtering calendars" do
|
|
23
19
|
end
|
24
20
|
|
25
21
|
it "should pass things straight through" do
|
26
|
-
expected_cals =
|
22
|
+
expected_cals = %w{1 2 3}
|
27
23
|
actual_cals = filter_calendars(expected_cals.dup)
|
28
|
-
|
24
|
+
actual_cals.size.should == expected_cals.size
|
29
25
|
end
|
30
26
|
|
31
27
|
it "should delete a calendar when told" do
|
32
|
-
cals = filter_calendars(
|
33
|
-
|
28
|
+
cals = filter_calendars(%w{1 2 3}){|cal| cal.remove if cal.__delegate__ == "2"}
|
29
|
+
cals.should == %w{1 3}
|
34
30
|
end
|
35
31
|
|
36
32
|
it "should keep a calendar when told" do
|
37
|
-
cals = filter_calendars(
|
38
|
-
|
33
|
+
cals = filter_calendars(%w{1 2 3}){|cal| cal.keep if cal.__delegate__ == "2"}
|
34
|
+
cals.should == %w{2}
|
39
35
|
end
|
40
36
|
|
41
37
|
it "should delete parts of a calendar when told" do
|
@@ -55,26 +51,24 @@ describe "filtering calendars" do
|
|
55
51
|
end
|
56
52
|
|
57
53
|
it "should complain if we both keep and remove a calendar" do
|
58
|
-
|
59
|
-
cals = filter_calendars([1]){|cal| cal.keep; cal.remove}
|
60
|
-
end
|
54
|
+
expect{filter_calendars(%w{1}){|cal| cal.keep; cal.remove}}.to raise_error(CalFilter::FilterError)
|
61
55
|
end
|
62
56
|
|
63
57
|
it "should complain if we keep one calendar and remove another" do
|
64
|
-
|
65
|
-
cals = filter_calendars(
|
58
|
+
expect {
|
59
|
+
cals = filter_calendars(%w{1 2 3}) do |cal|
|
66
60
|
case cal.__delegate__
|
67
|
-
when 1
|
68
|
-
when 2
|
61
|
+
when "1" then cal.keep;
|
62
|
+
when "2" then cal.remove;
|
69
63
|
end
|
70
64
|
end
|
71
|
-
|
65
|
+
}.to raise_error(CalFilter::FilterError)
|
72
66
|
end
|
73
67
|
|
74
68
|
it "should delegate unknown methods to the Calendar objects" do
|
75
69
|
results = []
|
76
|
-
cals = filter_calendars([
|
77
|
-
|
70
|
+
cals = filter_calendars(["a", "aa"]){|cal| results << (cal.size == 1)}
|
71
|
+
results.should == [true, false]
|
78
72
|
end
|
79
73
|
|
80
74
|
end
|
@@ -98,9 +92,10 @@ describe "filtering resources" do
|
|
98
92
|
end
|
99
93
|
end
|
100
94
|
|
101
|
-
|
95
|
+
it "should leave resources alone if no block specified" do
|
96
|
+
events = @cal.events
|
102
97
|
filter_calendars([@cal]) do |cal|
|
103
|
-
cal.__delegate__.expects(:events).returns(
|
98
|
+
cal.__delegate__.expects(:events).returns(events)
|
104
99
|
cal.filter_events
|
105
100
|
end
|
106
101
|
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
require 'mocha'
|
3
|
+
|
4
|
+
require 'calfilter'
|
5
|
+
|
6
|
+
Dir['./spec/support/**/*.rb'].map {|f| require f}
|
7
|
+
|
8
|
+
def in_editor?
|
9
|
+
ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec.configure do |c|
|
13
|
+
c.color_enabled = !in_editor?
|
14
|
+
c.filter_run :focus => true
|
15
|
+
c.mock_with :mocha
|
16
|
+
c.run_all_when_everything_filtered = true
|
17
|
+
c.add_formatter :progress
|
18
|
+
#c.add_formatter :documentation, 'rspec.txt'
|
19
|
+
end
|
metadata
CHANGED
@@ -1,76 +1,99 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: calfilter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Glenn Vanderburg
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
bjEeMBwGCgmSJomT8ixkARkWDnRoaW5rcmVsZXZhbmNlMRYwFAYKCZImiZPyLGQB
|
15
|
-
GRYGY29tZ2x2MB4XDTA4MDMwNDIwNDIzNFoXDTA5MDMwNDIwNDIzNFowSDEOMAwG
|
16
|
-
A1UEAwwFZ2xlbm4xHjAcBgoJkiaJk/IsZAEZFg50aGlua3JlbGV2YW5jZTEWMBQG
|
17
|
-
CgmSJomT8ixkARkWBmNvbWdsdjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
ggEBALXdD5Y00ZMPO/dL8sj1IcfomhezB+9rsO/FoCnR9TJyaOGPBAJBEfyA3SkP
|
19
|
-
hpbCkkUDpNlRR2sQHrtqBJovpw2oX6zakrG8PnDQQPU1oo0tWkiDtPFQc9lgDJOA
|
20
|
-
S/nQiS2D9rusOmpj84KpC6DUN80M+ap9z04Xadobuv7Cer/dTOfs4skUBiN/aonA
|
21
|
-
qtaRNOlOPGyPGiCa8tUQd53fVml2hSKIgt/+HfBHHWZkHs9UQRsqd7GICFi5R24i
|
22
|
-
ZNXbaRzw4637eCcjBhlEes9KMJOwayZ1KXHWzOdSzRJUI6nT4AQjw3GCyuXBmCY0
|
23
|
-
LFrbGOLYuqfiv/zr+Z+qqyI3Ul0CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8E
|
24
|
-
BAMCBLAwHQYDVR0OBBYEFOsd6jtw384ogcRecKkFdFpm9SQkMA0GCSqGSIb3DQEB
|
25
|
-
BQUAA4IBAQBokYH6Pe63OU1O9t4z6jEom2NDieUlLWD9PTshI4UXUjxd83mjmg/Y
|
26
|
-
Cer/yqFHqQEW6BLNRmH6l2lw2Rb8CZdlh7K8Q8F/94M+actty2UvMgTyVEtOnyh/
|
27
|
-
QU8nqEil5vl7ppCwDeSF32cebsQoimkgAamOxVZVe5ipP1+UIO+Eu92Jt5k0hrnd
|
28
|
-
1Fz3W+wrffm45P2X/6Z36dXgZKn8dlHuYtsqgpQxBC92oE7UqHXvwAu3FFe+1EV7
|
29
|
-
LrV1pr2EyieDotJOooYNz/E+9ZeL14MBhDOVmPr4KHTTK4VwdxFtAKu2QK/NfAAl
|
30
|
-
zrNa6ECLh1VS/pV78rYbAO1ZXsg3l7bY
|
31
|
-
-----END CERTIFICATE-----
|
32
|
-
|
33
|
-
date: 2008-08-06 00:00:00 -05:00
|
34
|
-
default_executable:
|
35
|
-
dependencies:
|
36
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
37
15
|
name: icalendar
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
38
22
|
type: :runtime
|
39
|
-
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: mocha
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
48
38
|
type: :development
|
49
|
-
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: ! "calfilter is a small library to assist in writing filtering\n programs
|
79
|
+
for icalendar files or streams."
|
80
|
+
email:
|
81
|
+
- glv@vanderburg.org
|
59
82
|
executables: []
|
60
|
-
|
61
83
|
extensions: []
|
62
|
-
|
63
|
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .gitignore
|
87
|
+
- .ruby-version
|
88
|
+
- .travis.yml
|
89
|
+
- Gemfile
|
90
|
+
- Gemfile.lock
|
69
91
|
- History.txt
|
70
92
|
- Manifest.txt
|
71
|
-
- README.
|
93
|
+
- README.rdoc
|
72
94
|
- Rakefile
|
73
95
|
- ToDo.txt
|
96
|
+
- calfilter.gemspec
|
74
97
|
- example.rb
|
75
98
|
- lib/calfilter.rb
|
76
99
|
- lib/calfilter/cgi.rb
|
@@ -78,35 +101,41 @@ files:
|
|
78
101
|
- lib/calfilter/icalendar_extensions.rb
|
79
102
|
- lib/calfilter/time_extensions.rb
|
80
103
|
- lib/calfilter/tripit.rb
|
81
|
-
-
|
82
|
-
-
|
83
|
-
|
84
|
-
|
104
|
+
- lib/calfilter/version.rb
|
105
|
+
- spec/calfilter/calfilter_cgi_spec.rb
|
106
|
+
- spec/calfilter/calfilter_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: http://github.com/glv/calfilter
|
109
|
+
licenses: []
|
85
110
|
post_install_message:
|
86
|
-
rdoc_options:
|
87
|
-
|
88
|
-
- README.txt
|
89
|
-
require_paths:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
90
113
|
- lib
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
hash: 3909444746793208583
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
hash: 3909444746793208583
|
103
132
|
requirements: []
|
104
|
-
|
105
|
-
|
106
|
-
rubygems_version: 1.2.0
|
133
|
+
rubyforge_project: calfilter
|
134
|
+
rubygems_version: 1.8.23
|
107
135
|
signing_key:
|
108
|
-
specification_version:
|
109
|
-
summary:
|
110
|
-
test_files:
|
111
|
-
-
|
112
|
-
-
|
136
|
+
specification_version: 3
|
137
|
+
summary: Filter icalendar files or streams
|
138
|
+
test_files:
|
139
|
+
- spec/calfilter/calfilter_cgi_spec.rb
|
140
|
+
- spec/calfilter/calfilter_spec.rb
|
141
|
+
- spec/spec_helper.rb
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
Binary file
|