Class: Vgcal::Handlers::Describer
- Inherits:
-
Thor
- Object
- Thor
- Vgcal::Handlers::Describer
- Defined in:
- lib/vgcal/handlers/describer.rb
Overview
Describer
Instance Method Summary collapse
Instance Method Details
#init ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vgcal/handlers/describer.rb', line 15 def init vgcal_dir = "#{Dir.home}/.vgcal" cred_json = "#{vgcal_dir}/credentials.json" dot_env = "#{vgcal_dir}/.env" gem_root = File.('../../../', __dir__ || '.') FileUtils.mkdir_p(vgcal_dir, mode: 0o755) FileUtils.cp(File.join(gem_root, 'template-credentials.json'), cred_json) unless File.exist?(cred_json) FileUtils.cp(File.join(gem_root, 'template.env'), dot_env) unless File.exist?(dot_env) puts "Fix the __FIX_ME__ in #{cred_json} and #{dot_env}" end |
#show ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vgcal/handlers/describer.rb', line 35 def show Dotenv.load("#{Dir.home}/.vgcal/.env") my_calendar = MyCalendar.new(DateCalculator.start_date(), DateCalculator.end_date()) events = my_calendar.events case [:output] when 'json' stdout_json(my_calendar.tasks(events), my_calendar.invited_meetings(events)) else stdout_default(my_calendar.tasks(events), my_calendar.invited_meetings(events)) end end |
#version ⇒ Object
50 51 52 |
# File 'lib/vgcal/handlers/describer.rb', line 50 def version puts VERSION end |