vkhal 0.1.0
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 +8 -0
- data/.rspec +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +39 -0
- data/LICENSE.txt +8 -0
- data/README.md +25 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/vkhal +14 -0
- data/lib/vkhal.rb +13 -0
- data/lib/vkhal/cli.rb +34 -0
- data/lib/vkhal/khal_service.rb +11 -0
- data/lib/vkhal/presenter.rb +27 -0
- data/vkhal.gemspec +33 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5b4a6eb02e17d76b613311fac2c05914cbe534df73a60c1a91b50d83b6478fe4
|
4
|
+
data.tar.gz: 76c50ad2f6aac196a1038cfc354899ed933273681ad1c918980a16131de371fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2889ba149886e41230174fe325da41abe90f3cc16561ef5049c6e287dc9976e44d4e146ea37caeaf340b51437c39fa48cae631445724ce40cc2670ef66c8b6bf
|
7
|
+
data.tar.gz: 843aa7609ed8e44c0079f4dc2de69bf9d95968ccfc271ffe09417b7b8e5af2718d1861a6591c27fdd9a88bf60a4431e5eda2ea3448c20b6a2e1c125b35ed4a56
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vkhal (0.1.0)
|
5
|
+
icalendar (~> 2.5)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
icalendar (2.5.3)
|
12
|
+
ice_cube (~> 0.16)
|
13
|
+
ice_cube (0.16.3)
|
14
|
+
rake (10.5.0)
|
15
|
+
rspec (3.8.0)
|
16
|
+
rspec-core (~> 3.8.0)
|
17
|
+
rspec-expectations (~> 3.8.0)
|
18
|
+
rspec-mocks (~> 3.8.0)
|
19
|
+
rspec-core (3.8.2)
|
20
|
+
rspec-support (~> 3.8.0)
|
21
|
+
rspec-expectations (3.8.4)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.8.0)
|
24
|
+
rspec-mocks (3.8.1)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-support (3.8.2)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 2.0)
|
34
|
+
rake (~> 10.0)
|
35
|
+
rspec (~> 3.8)
|
36
|
+
vkhal!
|
37
|
+
|
38
|
+
BUNDLED WITH
|
39
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* ----------------------------------------------------------------------------
|
3
|
+
* "THE BEER-WARE LICENSE" (Revision 42):
|
4
|
+
* <ngw@nofeed.org> wrote this file. As long as you retain this notice you
|
5
|
+
* can do whatever you want with this stuff. If we meet some day, and you think
|
6
|
+
* this stuff is worth it, you can buy me a beer in return. Nicholas Wieland
|
7
|
+
* ----------------------------------------------------------------------------
|
8
|
+
*/
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Vkhal
|
2
|
+
|
3
|
+
Utility to help integrate the amazing [Mutt][1]/[NeoMutt][2] with the beautiful calendaring application [Khal][3]
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install vkhal
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
|
12
|
+
text/calendar; ~/Projects/vkhal/bin/vkhal -s %s; copiousoutput
|
13
|
+
application/ics; ~/Projects/vkhal/bin/vkhal -s %s; copiousoutput
|
14
|
+
|
15
|
+
|
16
|
+
"\
|
17
|
+
<enter-command>unset wait_key<enter>\
|
18
|
+
<shell-escape>rm -f /tmp/events.ics<enter>\
|
19
|
+
<save-entry><kill-line>/tmp/events.ics<enter>\
|
20
|
+
<shell-escape> ~/Projects/vkhal/bin/vkhal -k /tmp/events.ics<enter>\
|
21
|
+
"
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
The gem is available as open source under the terms of the [Beerware License](https://people.freebsd.org/~phk/).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vkhal"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/vkhal
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib_path = File.expand_path('../lib', __dir__)
|
5
|
+
$:.unshift(lib_path) if !$:.include?(lib_path)
|
6
|
+
require 'vkhal'
|
7
|
+
|
8
|
+
Signal.trap('INT') do
|
9
|
+
warn("\n#{ caller.join }\n: interrupted")
|
10
|
+
exit(1)
|
11
|
+
end
|
12
|
+
|
13
|
+
cli = Vkhal::CLI.new
|
14
|
+
cli.perform
|
data/lib/vkhal.rb
ADDED
data/lib/vkhal/cli.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Vkhal
|
2
|
+
class CLI
|
3
|
+
def initialize
|
4
|
+
@options = options_parse
|
5
|
+
end
|
6
|
+
|
7
|
+
def perform
|
8
|
+
if @options[:khal]
|
9
|
+
ks = KhalService.new(file: @options[:khal])
|
10
|
+
ks.import!
|
11
|
+
elsif @options[:show]
|
12
|
+
p = Presenter.new(events: events_parse(@options[:show]))
|
13
|
+
p.display
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def options_parse
|
20
|
+
options = {}
|
21
|
+
OptionParser.new do |opts|
|
22
|
+
opts.banner = 'Usage: vkhal [options]'
|
23
|
+
opts.on('-s', '--show FILE', String, 'Show ical file FILE')
|
24
|
+
opts.on('-k', '--khal FILE', String, 'Insert ical FILE into Khal')
|
25
|
+
end.parse!(into: options)
|
26
|
+
options
|
27
|
+
end
|
28
|
+
|
29
|
+
def events_parse(file)
|
30
|
+
events_file = File.open(file)
|
31
|
+
Icalendar::Event.parse(events_file)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Vkhal
|
2
|
+
class Presenter
|
3
|
+
def initialize(events:)
|
4
|
+
@events = events
|
5
|
+
end
|
6
|
+
|
7
|
+
def display
|
8
|
+
@events.each do |event|
|
9
|
+
puts <<~EVTEND
|
10
|
+
Summary: #{event.summary}
|
11
|
+
Location: #{event.location}
|
12
|
+
Organizer: #{event.organizer}
|
13
|
+
Description: #{event.description}
|
14
|
+
Start: #{format_datetime(event.dtstart)}
|
15
|
+
End: #{format_datetime(event.dtend)}
|
16
|
+
|
17
|
+
EVTEND
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def format_datetime(dt)
|
24
|
+
dt.strftime("%A, %d %b %Y %l:%M %p")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/vkhal.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "vkhal"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "vkhal"
|
7
|
+
spec.version = Vkhal::VERSION
|
8
|
+
spec.authors = ["Nicholas Wieland"]
|
9
|
+
spec.email = ["ngw@nofeed.org"]
|
10
|
+
|
11
|
+
spec.summary = %q{Send vcalendar invites to Khal}
|
12
|
+
spec.homepage = "https://gitlab.com/nofeed/vkhal"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/nofeed/vkhal"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "icalendar", "~> 2.5"
|
30
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.8"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vkhal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicholas Wieland
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-20 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.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.8'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- ngw@nofeed.org
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- bin/vkhal
|
87
|
+
- lib/vkhal.rb
|
88
|
+
- lib/vkhal/cli.rb
|
89
|
+
- lib/vkhal/khal_service.rb
|
90
|
+
- lib/vkhal/presenter.rb
|
91
|
+
- vkhal.gemspec
|
92
|
+
homepage: https://gitlab.com/nofeed/vkhal
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata:
|
96
|
+
allowed_push_host: https://rubygems.org
|
97
|
+
homepage_uri: https://gitlab.com/nofeed/vkhal
|
98
|
+
source_code_uri: https://github.com/nofeed/vkhal
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubygems_version: 3.0.4
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Send vcalendar invites to Khal
|
118
|
+
test_files: []
|