├── Rakefile ├── screenshot.png ├── bin └── wedding ├── Gemfile ├── lib ├── wedding │ ├── version.rb │ ├── post_install_message.rb │ ├── groom.rb │ ├── bride.rb │ ├── default_config.rb │ ├── cli.rb │ └── ceremony.rb └── wedding.rb ├── .gitignore ├── LICENSE.txt ├── spec └── wedding_spec.rb ├── wedding.gemspec └── README.md /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaipandya/wedding/HEAD/screenshot.png -------------------------------------------------------------------------------- /bin/wedding: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'wedding' 4 | require 'wedding/cli' 5 | Wedding::CLI.start -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in wedding.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /lib/wedding/version.rb: -------------------------------------------------------------------------------- 1 | module Wedding 2 | # No major releases scheduled after this one 3 | VERSION = "0.0.3" unless const_defined?(:VERSION) 4 | end 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | .yardoc 6 | Gemfile.lock 7 | InstalledFiles 8 | _yardoc 9 | coverage 10 | doc/ 11 | lib/bundler/man 12 | pkg 13 | rdoc 14 | spec/reports 15 | test/tmp 16 | test/version_tmp 17 | tmp 18 | .DS_Store 19 | -------------------------------------------------------------------------------- /lib/wedding/post_install_message.rb: -------------------------------------------------------------------------------- 1 | module Wedding 2 | class << self 3 | def post_install_message 4 | footer = <<'EOS' 5 | 6 | ==== Release notes for wedding gem ==== 7 | 8 | Now that you have installed this gem, you earn our immense respect. 9 | You are the star guest of our wedding, you will receive our special 10 | attention. 11 | Go ahead and type `wedding` (wihtout backticks) on the command 12 | prompt to see the list of commands available with it. Print your 13 | personal invitation, and fire your browser to see the location of 14 | the event. We love you! 15 | 16 | Prerita and Jai 17 | 18 | ======================================= 19 | 20 | EOS 21 | end 22 | end 23 | end -------------------------------------------------------------------------------- /lib/wedding/groom.rb: -------------------------------------------------------------------------------- 1 | module Wedding 2 | # No wedding without a groom 3 | class Groom 4 | # Get him ready for all pomp and show 5 | def initialize(config) 6 | self.name = config[:groom_name] 7 | self.about = config[:groom_about] 8 | self.occupation = config[:groom_occupation] 9 | self.email = config[:groom_email] 10 | end 11 | 12 | # Overriding for pretty printing 13 | def to_s 14 | groom_gungaan = %Q[ 15 | ========= Groom ========== 16 | 17 | The groom's name is #{self.name} 18 | He is a #{self.about} 19 | He works as a #{self.occupation} 20 | If you want to contact him, his email ID 21 | is #{self.email} 22 | 23 | ] 24 | end 25 | attr_accessor :name, :about, :occupation, :email 26 | end 27 | end -------------------------------------------------------------------------------- /lib/wedding/bride.rb: -------------------------------------------------------------------------------- 1 | module Wedding 2 | # No wedding without a bride 3 | class Bride 4 | # Get her ready for all the jazz and buzz 5 | def initialize(config) 6 | self.name = config[:bride_name] 7 | self.about = config[:bride_about] 8 | self.occupation = config[:bride_occupation] 9 | self.email = config[:bride_email] 10 | end 11 | 12 | # Overriding for pretty printing 13 | def to_s 14 | bride_gungaan = %Q[ 15 | ========= Bride ========== 16 | 17 | The bride's name is #{self.name} 18 | She is a #{self.about} 19 | She works as #{self.occupation} 20 | If you want to contact her, her email ID 21 | is #{self.email} 22 | 23 | ] 24 | end 25 | attr_accessor :name, :about, :occupation, :email 26 | end 27 | end -------------------------------------------------------------------------------- /lib/wedding/default_config.rb: -------------------------------------------------------------------------------- 1 | module Wedding 2 | module DefaultConfig 3 | def self.options 4 | { 5 | :groom_name => "Jai", 6 | :groom_about => "Programmer, Traveller, Photographer, Biker, SlideShare Engineer", 7 | :groom_occupation => "Hacker at SlideShare", 8 | :groom_email => "jaipandya@gmail.com", 9 | :bride_name => "Prerita", 10 | :bride_about => "Banker, Traveller, Dancer, Painter, Dreamer", 11 | :bride_occupation => "Asst. Manager at Bank of Baroda", 12 | :bride_email => "preritayadav@gmail.com", 13 | :location => "+26° 52' 57.3024\", +75° 48' 24.75\"", 14 | :event_schedule => [ 15 | " 7:00 pm Barat starts from Home", 16 | " 8:00 pm Barat reaches venue", 17 | "12:00 am Phere" 18 | ], 19 | :date => "2013-11-29" 20 | } 21 | end 22 | end 23 | end -------------------------------------------------------------------------------- /lib/wedding.rb: -------------------------------------------------------------------------------- 1 | require 'launchy' 2 | require 'thor' 3 | require 'wedding/default_config' 4 | 5 | # Lets bring the bride, groom here and 6 | # ring the bells to start the ceremony 7 | require 'wedding/bride' 8 | require 'wedding/groom' 9 | require 'wedding/ceremony' 10 | 11 | module Wedding 12 | 13 | class << self 14 | 15 | # Sets the default options used when calling Wedding#new. 16 | attr_writer :default_config 17 | 18 | # There is a weddig, there is a ceremony. Time for celebrations. 19 | attr_accessor :ceremony 20 | 21 | 22 | # Returns new Ceremony object that can be used to query details 23 | # about the wedding 24 | # @param [Hash] config A hash of config values for wedding. Check 25 | # default_config.rb 26 | def new(config = nil) 27 | config = config ? default_config.merge(config) : default_config.dup 28 | Ceremony.new(config) 29 | end 30 | 31 | # Getter method for default_config for the wedding. 32 | def default_config 33 | DefaultConfig.options 34 | end 35 | 36 | end 37 | 38 | end -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Jai Pandya 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /lib/wedding/cli.rb: -------------------------------------------------------------------------------- 1 | require 'wedding' 2 | require 'launchy' 3 | module Wedding 4 | 5 | # We have a new wedding taking place here 6 | self.ceremony = self.ceremony || self.new 7 | 8 | # Command line interface for the wedding 9 | class CLI < Thor 10 | desc 'invitation', 'Your invitation card is inside this envelope' 11 | def invitation 12 | puts Wedding.ceremony.invitation 13 | end 14 | 15 | desc 'location', 'Google maps link to the wedding venue' 16 | def location 17 | puts map_location = Wedding.ceremony.location 18 | answer = yes?('Do you want to open this link in browser? (yes/no)') 19 | if (answer) 20 | begin 21 | Launchy.open(map_location) 22 | rescue StandardError => e 23 | puts "Sorry, you are probably not using a graphical terminal" 24 | end 25 | end 26 | end 27 | 28 | desc 'rsvp', 'RSVP for the event' 29 | def rsvp 30 | puts Wedding.ceremony.rsvp 31 | end 32 | 33 | desc 'groom', 'Glory words about the groom' 34 | def groom 35 | puts Wedding.ceremony.groom 36 | end 37 | 38 | desc 'bride', 'Glory words about the bride' 39 | def bride 40 | puts Wedding.ceremony.bride 41 | end 42 | 43 | end 44 | end -------------------------------------------------------------------------------- /spec/wedding_spec.rb: -------------------------------------------------------------------------------- 1 | require 'wedding' 2 | 3 | describe "Wedding#default_config" do 4 | it "returns default config options" do 5 | Wedding.default_config.should eql({ 6 | :groom_name => "Jai", 7 | :groom_about => "Programmer, Traveller, Photographer, Biker, SlideShare Engineer", 8 | :groom_occupation => "Hacker at SlideShare", 9 | :groom_email => "jaipandya@gmail.com", 10 | :bride_name => "Prerita", 11 | :bride_about => "Banker, Traveller, Dancer, Painter, Dreamer", 12 | :bride_occupation => "Asst. Manager at Bank of Baroda", 13 | :bride_email => "preritayadav@gmail.com", 14 | :location => "26° 53.415', 75° 48.466'", 15 | :event_schedule => [ 16 | "7:00 pm Barats starts from Home", 17 | "8:00 pm Barat reaches venue", 18 | "12:00 pm Fere" 19 | ], 20 | :date => "29 November 2013" 21 | }) 22 | end 23 | end 24 | 25 | describe "Wedding::Ceremony" do 26 | 27 | it "correctly initializes all the instance variables" do 28 | end 29 | 30 | it "launches the browser for map location" do 31 | end 32 | 33 | it "prints an awesome invitation message" do 34 | end 35 | 36 | it 'RSVPs for the event' do 37 | end 38 | 39 | end -------------------------------------------------------------------------------- /wedding.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'wedding/version' 5 | require 'wedding/post_install_message' 6 | 7 | Gem::Specification.new do |spec| 8 | spec.name = "wedding" 9 | spec.version = Wedding::VERSION 10 | spec.authors = ["Jai Pandya"] 11 | spec.email = ["jaipandya@gmail.com"] 12 | spec.description = <<-EOS 13 | What could be better than a gem for a wedding. A fun experiment that generates 14 | an invite for my wedding. The gem is generic in nature that accepts a configuration 15 | object to work on. 16 | EOS 17 | spec.summary = %q{I created this gem for inviting friends to my wedding.} 18 | spec.homepage = "http://jaipandya.github.io/wedding" 19 | spec.license = "MIT" 20 | 21 | spec.files = `git ls-files`.split($/) 22 | spec.executables = ['wedding'] 23 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 24 | spec.require_paths = ["lib"] 25 | 26 | spec.add_development_dependency "bundler", "~> 1.3" 27 | spec.add_development_dependency "rake", "~> 13.2.1" 28 | spec.add_development_dependency "rspec", "~> 2.6" 29 | 30 | spec.post_install_message = Wedding.post_install_message 31 | 32 | spec.add_runtime_dependency 'launchy', '2.3.0' 33 | spec.add_runtime_dependency 'require_all', '~> 1.3.2' 34 | spec.add_runtime_dependency 'thor', '~> 0.18' 35 | spec.add_runtime_dependency 'artii', '~> 2.0.3' 36 | spec.add_runtime_dependency 'rainbow', '~> 1.1.4' 37 | 38 | end 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wedding 2 | 3 | > How would be a wedding without a gem? 4 | 5 | screenshot 6 | 7 | ## Overview 8 | 9 | A fun experiment to invite my geeky friends 10 | via this ruby gem. 11 | 12 | ## Installation 13 | 14 | Command line install 15 | 16 | $ gem install wedding 17 | 18 | Add this line to your application's Gemfile: 19 | 20 | gem 'wedding' 21 | 22 | And then execute: 23 | 24 | $ bundle 25 | 26 | ## Usage 27 | 28 | ### Command Line 29 | 30 | List of all available commands 31 | 32 | wedding 33 | 34 | Print a personalized wedding invitation 35 | 36 | wedding invitation 37 | 38 | Glory words for the groom 39 | 40 | wedding groom 41 | 42 | Glory words for the bride 43 | 44 | wedding bride 45 | 46 | RSVP for the event 47 | 48 | wedding rsvp 49 | 50 | Map location of the venue 51 | 52 | wedding location 53 | 54 | ### Public API 55 | 56 | New wedding 57 | 58 | # By default it would take config options from 59 | # lib/wedding/default_config.rb, which can be overridden 60 | # by passing your own hash 61 | 62 | wedding = Wedding.new 63 | 64 | Returns invitation card string 65 | 66 | wedding.invitation 67 | 68 | Wedding venue coordinates 69 | 70 | wedding.location 71 | 72 | Returns google maps URL of the venue 73 | 74 | wedding.map_location 75 | 76 | Access the groom 'object' 77 | 78 | wedding.groom 79 | 80 | Access the bride 'object' 81 | 82 | wedding.bride 83 | 84 | RSVP information about the event 85 | 86 | wedding.rsvp 87 | 88 | 89 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/jaipandya/wedding/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 90 | 91 | -------------------------------------------------------------------------------- /lib/wedding/ceremony.rb: -------------------------------------------------------------------------------- 1 | require 'cgi' 2 | require 'artii' 3 | require 'date' 4 | require 'rainbow' 5 | 6 | module Wedding 7 | # The magic happens here 8 | # Sing, dance, eat and enjoy 9 | class Ceremony 10 | 11 | # Time to set the things in the right direction 12 | # Groom, bride, location, date and event schedule. 13 | # @param [Hash] config configuration object for the constructor 14 | def initialize(config) 15 | @groom = Wedding::Groom.new(config) 16 | @bride = Wedding::Bride.new(config) 17 | @location = config[:location] 18 | @date = Date.parse(config[:date]) 19 | @event_schedule = config[:event_schedule] 20 | 21 | @artii = Artii::Base.new :font => 'slant' 22 | end 23 | 24 | # We need to access what we have set earlier 25 | attr_reader :groom, :bride, :location, :event_schedule, :date 26 | 27 | # Venue coordinates 28 | def coordinates 29 | @location 30 | end 31 | 32 | # Lets have a more readable format of coordinates method 33 | # with a URL to google maps 34 | def location 35 | "https://maps.google.com/?q=" + CGI.escape(coordinates) 36 | end 37 | 38 | # Number of days left 39 | def days_left 40 | (date - Date.today) 41 | end 42 | 43 | # Event schedule 44 | def events 45 | @event_schedule.join("\n") 46 | end 47 | 48 | # Forms a pretty invitation card for the wedding 49 | def invitation 50 | invitation = %Q[ 51 | #{print_ganesha.color(:green)} 52 | ========= Wedding invitation ========== 53 | 54 | #{@artii.asciify(groom.name).color(:blue)} 55 | with 56 | #{@artii.asciify(bride.name).color(:blue)} 57 | 58 | 59 | Hi #{`whoami`.strip.capitalize} 60 | 61 | We are getting married on #{date.strftime("%d %B %y")}. It will 62 | be a great pleasure for us to have your presence 63 | in the wedding ceremony. 64 | 65 | Event schedule: 66 | 67 | #{events} 68 | 69 | Pack your bags! Only #{days_left.to_s.color(:red)} days left. 70 | ] 71 | 72 | rescue StandardError => e 73 | 74 | invitation = %Q[ 75 | ========= Wedding invitation ========== 76 | 77 | Looks like something went wrong here, did you you fake 78 | the invitation? 79 | 80 | ] 81 | 82 | end 83 | 84 | # In Hindu mythology it is a custom to start 85 | # anything new worshipping lord Ganesha 86 | # http://en.wikipedia.org/wiki/Ganesha 87 | def print_ganesha 88 | ganesh = %Q[ 89 | _.!._ 90 | /O*@*O\\ 91 | <\\@(_)@/> 92 | ,;, .--;` `;--. , 93 | O@O_ / |d b| \\ _hnn 94 | | `/ \\ | | / \\` | 95 | &&&& :##;\\ /;##; &&&& 96 | | \\ / `##/| |##' \\ / | 97 | \\ %%%%`