Created
September 21, 2015 00:24
-
-
Save denisemauldin/287efe8e1cd1fc5a712b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'optparse' | |
namespace :schedule do |args| | |
desc "Create schedule entries for recurring events" | |
task :create_recurring => :environment do | |
options = {} | |
optparse = OptionParser.new(args) do |opts| | |
opts.on("--from_date {from_date}", "Date to start creating Schedules") do |from_date| | |
options[:from_date] = from_date | |
end | |
opts.on("-e", "--event_id {event_id}", "Event to create Schedules for") do |event_id| | |
options[:event_id] = event_id | |
end | |
opts.on("-c","--calendar_id {calendar_id}", "Calendar to create Schedules for") do |calendar_id| | |
options[:calendar_id] = calendar_id | |
end | |
end | |
begin | |
optparse.parse! | |
rescue OptionsParser::InvalidOption => e | |
puts "invalid option : e.inspect" | |
end | |
puts "options #{options.inspect}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment