Initial commit

This commit is contained in:
Trevor Vallender 2024-03-02 14:50:16 +00:00
commit a73e0e7a0b
8 changed files with 103 additions and 0 deletions

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
3.2.2

3
Gemfile Normal file
View File

@ -0,0 +1,3 @@
source "https://rubygems.org"
gemspec

29
Gemfile.lock Normal file
View File

@ -0,0 +1,29 @@
PATH
remote: .
specs:
birthdaze (0.0.1)
carddav
thor
GEM
remote: https://rubygems.org/
specs:
carddav (0.1.0)
curb
nokogiri
vcardigan
curb (1.0.5)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
racc (1.7.3)
thor (1.3.1)
vcardigan (0.0.9)
PLATFORMS
x86_64-linux
DEPENDENCIES
birthdaze!
BUNDLED WITH
2.4.10

20
MIT-LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2023 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# Birthdaze
Birthdaze is a tool to generate a calendar of your contacts birthdays
from a CardDAV server account.

5
bin/birthdaze Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require 'birthdaze'
Birthdaze.start(ARGV)

14
birthdaze.gemspec Normal file
View File

@ -0,0 +1,14 @@
Gem::Specification.new do |s|
s.name = "birthdaze"
s.version = "0.0.1"
s.summary = "Generate a birthday calendar from CardDAV"
s.authors = ["T S Vallender"]
s.email = "t@tsvallender.co.uk"
s.homepage = "https://git.tsvallender.co.uk/tsv/birthdaze"
s.files = Dir["lib/**/*", "MIT-LICENSE", "README.md"]
s.license = "MIT"
s.executables << "birthdaze"
s.add_dependency "thor"
s.add_dependency "carddav"
end

27
lib/birthdaze.rb Normal file
View File

@ -0,0 +1,27 @@
require "carddav"
require "thor"
require "yaml"
class Birthdaze < Thor
desc "generate", "Generate calendars"
def generate
puts "Generate calendars"
auth(config["url"], config["username"], config["password"])
end
private
def config
config_file = "#{ENV["HOME"]}/.config/birthdaze.yaml"
unless File.file?(config_file)
puts "Please add a configuration file"
return
end
@config ||= YAML.load_file(config_file)
end
def auth(url, username, password)
config
client = Carddav::Client.new(url, username, password)
end
end