eventmaker 0.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.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/LICENSE +20 -0
- data/README.md +35 -0
- data/Rakefile +1 -0
- data/bin/eventmaker +5 -0
- data/eventmaker.gemspec +26 -0
- data/lib/eventmaker.rb +21 -0
- data/lib/eventmaker/version.rb +3 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d6537101c6aee5a91618d74fbef8a8dc0e7f912
|
4
|
+
data.tar.gz: 2acf97c4954fd6819b363cbb91b22d40ebc80b93
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8d3ee0f76ddbd7899ecdb7863c278df2a59e5668239bfd0298babab65a5eb5d5b1d3cdfab258c4643ae77bcd0fe76615103a7804c1c1e195368e1d86993070ab
|
7
|
+
data.tar.gz: a20406698ad300cd2f40c49a9a7bfeabc5060640df0145f1b85ee87828a7d51e3163d92c1f79a305578e959d17f9d1daca060e96194f1c4b673ff53f055d6414
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
eventmaker (0.0.1)
|
5
|
+
icalendar
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
icalendar (2.4.1)
|
12
|
+
json (1.8.3)
|
13
|
+
rake (10.4.2)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
bundler (~> 1.5)
|
20
|
+
eventmaker!
|
21
|
+
rake
|
22
|
+
|
23
|
+
BUNDLED WITH
|
24
|
+
1.13.1
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Christian Sampaio
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# JSON ➡️ .ics
|
2
|
+
Micro CLI to create [.ics files](https://www.ietf.org/rfc/rfc2445.txt) from a JSON on the fly.
|
3
|
+
|
4
|
+
# Where can I use this?
|
5
|
+
This is particularly convenient if you use the iOS Simulator to develop apps that have calendar integration.
|
6
|
+
Dragging the .ics file to the Simulator will allow you to add the event to the calendar with one click.
|
7
|
+
|
8
|
+
This can also be useful for any other case in which you need .ics files to be created systematically.
|
9
|
+
|
10
|
+
# Installation
|
11
|
+
`$ gem install eventmaker`
|
12
|
+
|
13
|
+
# Usage
|
14
|
+
The first thing you need is to create a file with the event information in the form of JSON, here's one example:
|
15
|
+
```json
|
16
|
+
{
|
17
|
+
"name" : "Event name",
|
18
|
+
"organizer": "christian.fsampaio@gmail.com",
|
19
|
+
"start" : "2016/12/25 19:00",
|
20
|
+
"end": "2016/12/25 21:00",
|
21
|
+
"attendees": ["christian.fsampaio@gmail.com", "foo@bar.com", "bar@foo.com"]
|
22
|
+
}
|
23
|
+
```
|
24
|
+
|
25
|
+
Once you have this file saved somewhere, you can run
|
26
|
+
|
27
|
+
`$ eventmaker ~/location/to/file.json >> ./event.ics`
|
28
|
+
|
29
|
+
# Supported fields
|
30
|
+
For the moment, the only supported event fields are the ones listed in the example above.
|
31
|
+
If you feel like you could benefit from a field that is not supported, I'll gladly accept a PR adding it 😉.
|
32
|
+
|
33
|
+
If you are not really sure how to do that, it is really easy. Basically, there are two parts to it:
|
34
|
+
1) Take a look at `lib/eventmaker.rb` to see how the event information is read from the JSON file.
|
35
|
+
2) See [icalendar docs](https://github.com/icalendar/icalendar) and look for the field that you want to support
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/eventmaker
ADDED
data/eventmaker.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eventmaker/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "eventmaker"
|
8
|
+
spec.version = Eventmaker::VERSION
|
9
|
+
spec.authors = ["Christian Sampaio"]
|
10
|
+
spec.email = ["christian.fsampaio@gmail.com"]
|
11
|
+
spec.date = '2016-11-15'
|
12
|
+
spec.summary = "CLI to create .ics files on the fly"
|
13
|
+
spec.homepage = 'https://github.com/chrisfsampaio/eventmaker'
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables << 'eventmaker'
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_runtime_dependency "icalendar"
|
24
|
+
spec.add_runtime_dependency "json"
|
25
|
+
end
|
26
|
+
|
data/lib/eventmaker.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'icalendar'
|
2
|
+
require 'json'
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
module Eventmaker
|
6
|
+
def self.from_json_file(file_name)
|
7
|
+
input = OpenStruct.new(JSON.parse(File.read(file_name)))
|
8
|
+
event = Icalendar::Event.new
|
9
|
+
event.summary = input.name
|
10
|
+
event.organizer = "mailto:#{input.organizer}"
|
11
|
+
event.dtstart = DateTime.parse input.start
|
12
|
+
event.dtend = DateTime.parse input.end
|
13
|
+
input.attendees.each { |attendee|
|
14
|
+
event.append_attendee "mailto:#{attendee}"
|
15
|
+
}
|
16
|
+
cal = Icalendar::Calendar.new
|
17
|
+
cal.add_event event
|
18
|
+
|
19
|
+
return cal.to_ical
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eventmaker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christian Sampaio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: icalendar
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- christian.fsampaio@gmail.com
|
72
|
+
executables:
|
73
|
+
- eventmaker
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/eventmaker
|
84
|
+
- eventmaker.gemspec
|
85
|
+
- lib/eventmaker.rb
|
86
|
+
- lib/eventmaker/version.rb
|
87
|
+
homepage: https://github.com/chrisfsampaio/eventmaker
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.5.1
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: CLI to create .ics files on the fly
|
111
|
+
test_files: []
|