cinch-pax-timer 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cinch-pax-timer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Brian Haberer
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.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Cinch::Pax::Timer
2
+
3
+ Cinch Plugin to track th time till PAX.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'cinch-pax-timer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install cinch-pax-timer
18
+
19
+ ## Contributing
20
+
21
+ 1. Fork it
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
24
+ 4. Push to the branch (`git push origin my-new-feature`)
25
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cinch/plugins/pax-timer/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "cinch-pax-timer"
8
+ gem.version = Cinch::Plugins::PaxTimer::VERSION
9
+ gem.authors = ["Brian Haberer"]
10
+ gem.email = ["bhaberer@gmail.com"]
11
+ gem.description = %q{Cinch plugin that allows users to see the relative time till the various PAX events}
12
+ gem.summary = %q{Cinch Plugin that acts as a PAX countdown}
13
+ gem.homepage = "https://github.com/bhaberer/cinch-pax-timer"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'cinch-cooldown', '>= 1.0.0'
21
+ gem.add_dependency 'cinch-toolbox', '~> 1.0.1'
22
+
23
+ end
data/config/pax.yml ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ - :type: east
3
+ :name: PAX East
4
+ :date: 2013-03-21 08:00:00 -08:00
5
+ :estimated: false
6
+ - :type: prime
7
+ :name: PAX Prime
8
+ :date: 2013-08-30 08:00:00 -08:00
9
+ :estimated: false
10
+ - :type: aus
11
+ :name: PAX Australia
12
+ :date: 2013-07-19 08:00:00 -08:00
13
+ :estimated: false
14
+ - :type: east
15
+ :name: PAX East
16
+ :date: 2014-04-11 08:00:00 -08:00
17
+ :estimated: false
@@ -0,0 +1,50 @@
1
+ require 'time-lord'
2
+ require 'cinch-cooldown'
3
+ require 'cinch-toolbox'
4
+
5
+ module Cinch::Plugins
6
+ class PaxTimer
7
+ include Cinch::Plugin
8
+
9
+ enforce_cooldown
10
+
11
+ self.help = "Use .pax for the next pax or .east, .prime, or .aus for the time to a specific pax."
12
+
13
+ match /(time|pax|timetillpax)\z/, method: :next_pax
14
+ match /east|paxeast/, method: :next_east
15
+ match /prime|paxprime/, method: :next_prime
16
+ match /aus|paxaus/, method: :next_aus
17
+
18
+ def next_pax(m)
19
+ m.reply get_next_pax
20
+ end
21
+
22
+ ['east', 'aus', 'prime'].each do |pax_type|
23
+ define_method "next_#{pax_type}" do |m|
24
+ m.reply get_next_pax(pax_type)
25
+ end
26
+ end
27
+
28
+ def get_next_pax(type = nil)
29
+ @filename = File.join(File.dirname(__FILE__), "../../../../config/pax.yml")
30
+ if File::exist?(@filename)
31
+ @paxes = YAML::load(File.open(@filename))
32
+
33
+ @paxes.delete_if { |pax| pax[:date] - Time.now < 0 }
34
+ @paxes.delete_if { |pax| pax[:type] != type } unless type.nil?
35
+ @paxes.sort! { |a,b| b[:date] <=> a[:date] }
36
+
37
+ @pax = @paxes.pop
38
+ message = "#{@pax[:name]} is "
39
+ message << 'approximately ' if @pax[:estimated]
40
+
41
+ # Uncomment this once we can specify granularity in Time Lord.
42
+ # message << TimeLord::Period.new(@pax[:date], Time.now).to_words
43
+ message << "#{Cinch::Toolbox.time_format(@pax[:date] - Time.now, [:days])} from now"
44
+
45
+ message << " (No official date, yet)" if @pax[:estimated]
46
+ return message
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,7 @@
1
+ module Cinch
2
+ module Plugins
3
+ class PaxTimer
4
+ VERSION = "0.0.2"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ require 'cinch/plugins/pax-timer/version'
2
+ require 'cinch/plugins/pax-timer/pax-timer'
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cinch-pax-timer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Brian Haberer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cinch-cooldown
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: cinch-toolbox
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.0.1
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.1
46
+ description: Cinch plugin that allows users to see the relative time till the various
47
+ PAX events
48
+ email:
49
+ - bhaberer@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - cinch-pax-timer.gemspec
60
+ - config/pax.yml
61
+ - lib/cinch-pax-timer.rb
62
+ - lib/cinch/plugins/pax-timer/pax-timer.rb
63
+ - lib/cinch/plugins/pax-timer/version.rb
64
+ homepage: https://github.com/bhaberer/cinch-pax-timer
65
+ licenses: []
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 1.8.24
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Cinch Plugin that acts as a PAX countdown
88
+ test_files: []
89
+ has_rdoc: