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 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
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.2
7
+ before_install: gem install bundler -v 2.0.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in vkhal.gemspec
4
+ gemspec
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
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
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
@@ -0,0 +1,13 @@
1
+ require 'optionparser'
2
+
3
+ require 'icalendar'
4
+ require 'open3'
5
+
6
+ require 'vkhal/cli'
7
+ require 'vkhal/khal_service'
8
+ require 'vkhal/presenter'
9
+
10
+ module Vkhal
11
+ VERSION = '0.1.0'
12
+ class Error < StandardError; end
13
+ end
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,11 @@
1
+ module Vkhal
2
+ class KhalService
3
+ def initialize(file:)
4
+ @file = file
5
+ end
6
+
7
+ def import!
8
+ exec "khal import #{@file}"
9
+ end
10
+ end
11
+ 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: []