festibals 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/festibals.gemspec +31 -0
- data/lib/festibals.rb +8 -0
- data/lib/festibals/festibal.rb +34 -0
- data/lib/festibals/festibal_calendar.rb +42 -0
- data/lib/festibals/list/sinulog.yml +6 -0
- data/lib/festibals/version.rb +3 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6b2cc266dacabe26ddb6aa12e336ec07f9771d4
|
4
|
+
data.tar.gz: 760a6ba31a85a569c7a83b09aa16b159a6a9a678
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20af6793092e58bf1b5b7c31753a97a09fc15eed0d5764c295b047edb7ba6670236fc160c63fa99730dd8b0189c7e0af253a3eb9b344138dc1128d7e8451e9a5
|
7
|
+
data.tar.gz: fe929b2aa75e5546e6dcbabaf8d8009799120ff70a3c8206c0c5b01dbb087bc24eec6cf59369523687b09b35768e101ec8374a8c35daee01465b1d44f370f756
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Gerda Decio
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Festibals
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'festibals'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install festibals
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/festibals/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/festibals.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'festibals/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "festibals"
|
8
|
+
spec.version = Festibals::VERSION
|
9
|
+
spec.authors = ["Gerda Decio"]
|
10
|
+
spec.email = ["gerdadecio@gmail.com"]
|
11
|
+
spec.summary = %q{Ical Philippine Festivals}
|
12
|
+
spec.description = %q{A ruby gem that easily integrates a schedule of philippine festivals to your calendar. Feel free to use and add more schedules or events.}
|
13
|
+
spec.homepage = "https://github.com/gerdadecio/festibals"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.files += [
|
18
|
+
"lib/festibals/festibal.rb",
|
19
|
+
"lib/festibals/festibal_calendar.rb"
|
20
|
+
]
|
21
|
+
spec.files += Dir.glob("lib/festivals/*.yml")
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency('icalendar', '~> 2.2')
|
27
|
+
spec.add_runtime_dependency("activesupport")
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
30
|
+
spec.add_development_dependency "rake", "~> 0"
|
31
|
+
end
|
data/lib/festibals.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Festibals
|
2
|
+
require 'ostruct'
|
3
|
+
require 'icalendar'
|
4
|
+
|
5
|
+
class Festibal < OpenStruct
|
6
|
+
|
7
|
+
#ATTRS: date_start, summary, recurrence_rule
|
8
|
+
SUMMARY_PARAMS = {"language" => "ENGLISH"}
|
9
|
+
|
10
|
+
def to_ical_event
|
11
|
+
event = Icalendar::Event.new
|
12
|
+
event.dtstart = Date.new(start_year, start_month, start_day) || DateTime.now
|
13
|
+
event.summary = Icalendar::Values::Text.new summary || "An Awesome Festival", SUMMARY_PARAMS
|
14
|
+
event.categories = "Holidays"
|
15
|
+
event = set_alarm(event)
|
16
|
+
|
17
|
+
# RRULE value --> RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR (Monthly on the 1st Friday for ten occurrences)
|
18
|
+
# Checkout RFC2445 for more info: http://tools.ietf.org/html/rfc2445#section-4.8.5
|
19
|
+
event.rrule = recurrence_rule
|
20
|
+
|
21
|
+
return event
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_alarm(event)
|
25
|
+
event.alarm do |a|
|
26
|
+
a.action = "DISPLAY" # This line isn't necessary, it's the default
|
27
|
+
a.summary = "Alarm notification"
|
28
|
+
a.trigger = "-P1DT9H0M0S" # 1 day before
|
29
|
+
end
|
30
|
+
return event
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Festibals
|
2
|
+
require 'yaml'
|
3
|
+
require 'icalendar'
|
4
|
+
|
5
|
+
class FestibalCalendar
|
6
|
+
attr_reader :calendar
|
7
|
+
|
8
|
+
FILES = Dir[File.join(File.expand_path('lib/festibals/list/*.yml'))]
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@calendar = Icalendar::Calendar.new
|
12
|
+
add_events
|
13
|
+
set_calendar_name
|
14
|
+
set_calendar_lang
|
15
|
+
set_calendar_region
|
16
|
+
@calendar.publish
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_calendar_name
|
20
|
+
@calendar.append_custom_property("X-WR-CALNAME", "Philippine Festivals")
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_calendar_lang
|
24
|
+
@calendar.append_custom_property("X-APPLE-LANGUAGE", "en")
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_calendar_region
|
28
|
+
@calendar.append_custom_property("X-APPLE-REGION", "PH")
|
29
|
+
end
|
30
|
+
|
31
|
+
def add_events
|
32
|
+
FILES.each do |file|
|
33
|
+
fileContent = File.open(File.expand_path(file))
|
34
|
+
festivalParams = YAML::load(fileContent)['name']
|
35
|
+
@calendar.add_event Festibal.new(festivalParams).to_ical_event
|
36
|
+
end
|
37
|
+
|
38
|
+
#@calendar.add_event(Festival.new(params).to_ical_event)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: festibals
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerda Decio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: icalendar
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A ruby gem that easily integrates a schedule of philippine festivals
|
70
|
+
to your calendar. Feel free to use and add more schedules or events.
|
71
|
+
email:
|
72
|
+
- gerdadecio@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- festibals.gemspec
|
83
|
+
- lib/festibals.rb
|
84
|
+
- lib/festibals/festibal.rb
|
85
|
+
- lib/festibals/festibal_calendar.rb
|
86
|
+
- lib/festibals/list/sinulog.yml
|
87
|
+
- lib/festibals/version.rb
|
88
|
+
homepage: https://github.com/gerdadecio/festibals
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Ical Philippine Festivals
|
112
|
+
test_files: []
|