lita-chm 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec33c0570030ee457a4173433595e03732496838
4
+ data.tar.gz: 453dc1d0d7bb59222de41f5afcfb580c8e0b0a53
5
+ SHA512:
6
+ metadata.gz: 79a8d0825b5297fbcc796f50df543a881eff4d983385d9234dcebec2c5aa4ac67ef726d5111a5ce64c2795a5ccfe89997354766fac2964accc9f1a3897a73930
7
+ data.tar.gz: b6677b4a46a8ca3a85892bbec4a2bbefede2470124fe34ef49dc53b4bd34c8755e4e88bb5013c68a973478a68b7f66fd4ae88ba2c0b0fa52b17327f24604cf2c
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ .coveralls.yml
4
+ coverage
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
9
+ notifications:
10
+ email: false
11
+ webhooks:
12
+ urls:
13
+ - https://lita-freenode.herokuapp.com/travis
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lita-chm (0.0.1)
5
+ lita (>= 3.2.0)
6
+ nokogiri
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ coveralls (0.7.0)
12
+ multi_json (~> 1.3)
13
+ rest-client
14
+ simplecov (>= 0.7)
15
+ term-ansicolor
16
+ thor
17
+ diff-lcs (1.2.5)
18
+ docile (1.1.3)
19
+ faraday (0.9.0)
20
+ multipart-post (>= 1.2, < 3)
21
+ http_router (0.11.1)
22
+ rack (>= 1.0.0)
23
+ url_mount (~> 0.2.1)
24
+ i18n (0.6.9)
25
+ ice_nine (0.11.0)
26
+ lita (3.2.0)
27
+ bundler (>= 1.3)
28
+ faraday (>= 0.8.7)
29
+ http_router (>= 0.11.1)
30
+ i18n (>= 0.6.9)
31
+ ice_nine (>= 0.11.0)
32
+ multi_json (>= 1.7.7)
33
+ puma (>= 2.7.1)
34
+ rack (>= 1.5.2)
35
+ redis-namespace (>= 1.3.0)
36
+ thor (>= 0.18.1)
37
+ mime-types (2.2)
38
+ mini_portile (0.6.0)
39
+ multi_json (1.10.0)
40
+ multipart-post (2.0.0)
41
+ nokogiri (1.6.2.1)
42
+ mini_portile (= 0.6.0)
43
+ puma (2.8.2)
44
+ rack (>= 1.1, < 2.0)
45
+ rack (1.5.2)
46
+ rake (10.3.2)
47
+ redis (3.0.7)
48
+ redis-namespace (1.4.1)
49
+ redis (~> 3.0.4)
50
+ rest-client (1.6.7)
51
+ mime-types (>= 1.16)
52
+ rspec (3.0.0.beta2)
53
+ rspec-core (= 3.0.0.beta2)
54
+ rspec-expectations (= 3.0.0.beta2)
55
+ rspec-mocks (= 3.0.0.beta2)
56
+ rspec-core (3.0.0.beta2)
57
+ rspec-support (= 3.0.0.beta2)
58
+ rspec-expectations (3.0.0.beta2)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (= 3.0.0.beta2)
61
+ rspec-mocks (3.0.0.beta2)
62
+ rspec-support (= 3.0.0.beta2)
63
+ rspec-support (3.0.0.beta2)
64
+ simplecov (0.8.2)
65
+ docile (~> 1.1.0)
66
+ multi_json
67
+ simplecov-html (~> 0.8.0)
68
+ simplecov-html (0.8.0)
69
+ term-ansicolor (1.3.0)
70
+ tins (~> 1.0)
71
+ thor (0.19.1)
72
+ tins (1.3.0)
73
+ url_mount (0.2.1)
74
+ rack
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ bundler
81
+ coveralls
82
+ lita-chm!
83
+ rake
84
+ rspec (>= 3.0.0.beta1)
85
+ simplecov
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Carlos Paramio
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # lita-chm
2
+
3
+ [![Build Status](https://travis-ci.org/carlosparamio/lita-chm.png?branch=master)](https://travis-ci.org/carlosparamio/lita-chm)
4
+ [![Code Climate](https://codeclimate.com/github/carlosparamio/lita-chm.png)](https://codeclimate.com/github/carlosparamio/lita-chm)
5
+ [![Coverage Status](https://coveralls.io/repos/carlosparamio/lita-chm/badge.png)](https://coveralls.io/r/carlosparamio/lita-chm)
6
+
7
+ **lita-chm** is a handler for [Lita](http://lita.io/) that shows a short history lesson of the day from the [Computer History Museum](http://www.computerhistory.org/).
8
+
9
+ ## Installation
10
+
11
+ Add lita-chm to your Lita instance's Gemfile:
12
+
13
+ ``` ruby
14
+ gem "lita-chm"
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```
20
+ You: Lita: today in computer history|tdih|chm
21
+ Lita: May 18, 1998
22
+ United States Justice Department Files Antitrust against Microsoft
23
+ The United States Department of Justice and twenty US states filed a set of civil actions against Microsoft Corporation. The plaintiffs alleged that Microsoft abused monopoly power regarding operating system and Web browser sales. The central issue was whether it was monopolistic of Microsoft to bundle Internet Explorer software with its Windows operating system. This practice was alleged to have been responsible for Microsoft's victory in the “browser wars” because every Windows user had a copy of Internet Explorer. It was further alleged that this unfairly restricted the market for competing web browsers (such as Netscape Navigator or Opera), which were slow to download over a modem or had to be purchased at a store. The case was tried before U.S. District Court Judge Thomas Penfield Jackson. Joel I. Klein was the lead prosecutor. David Boies initially represented the Department of Justice.
24
+ ```
25
+
26
+ ## License
27
+
28
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,46 @@
1
+ require "lita"
2
+ require "nokogiri"
3
+
4
+ module Lita
5
+ module Handlers
6
+ class Chm < Handler
7
+
8
+ CHM_URL = "http://www.computerhistory.org/tdih/"
9
+
10
+ route(/(today in computer history|tdih|chm)$/i, :history, command: true, help: {
11
+ "today in computer history|tdih|chm" => "Shows a short history lesson of the day from the Computer History Museum."
12
+ })
13
+
14
+ def history(response)
15
+ http_response = http.get(CHM_URL)
16
+ if http_response.status == 200
17
+ doc = parse_http_response(http_response)
18
+ title = extract_title(doc)
19
+ date = extract_date(doc)
20
+ desc = extract_desc(doc)
21
+ response.reply("#{date}\n#{title}\n#{desc}")
22
+ else
23
+ response.reply("I think the Computer History Museum website (#{CHM_URL}) is down.")
24
+ end
25
+ end
26
+
27
+ def parse_http_response(http_response)
28
+ Nokogiri::HTML(http_response.body)
29
+ end
30
+
31
+ def extract_title(doc)
32
+ doc.css('.tdihevent p')[0].text
33
+ end
34
+
35
+ def extract_date(doc)
36
+ doc.css('.title').text
37
+ end
38
+
39
+ def extract_desc(doc)
40
+ doc.css('.tdihevent p')[1].text
41
+ end
42
+
43
+ end
44
+ Lita.register_handler(Chm)
45
+ end
46
+ end
data/lib/lita-chm.rb ADDED
@@ -0,0 +1 @@
1
+ require "lita/handlers/chm"
data/lita-chm.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-chm"
3
+ spec.version = "0.0.1"
4
+ spec.authors = ["Carlos Paramio"]
5
+ spec.email = ["hola@carlosparamio.com"]
6
+ spec.description = %q{Shows a short history lesson of the day from the Computer History Museum.}
7
+ spec.summary = %q{Shows a short history lesson of the day from the Computer History Museum}
8
+ spec.homepage = "https://github.com/carlosparamio/lita-chm"
9
+ spec.metadata = { "lita_plugin_type" => "handler" }
10
+
11
+ spec.files = `git ls-files`.split($/)
12
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
14
+ spec.require_paths = ["lib"]
15
+
16
+ spec.add_runtime_dependency "lita", ">= 3.2.0"
17
+
18
+ spec.add_dependency "nokogiri"
19
+
20
+ spec.add_development_dependency "bundler"
21
+ spec.add_development_dependency "coveralls"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", ">= 3.0.0.beta1"
24
+ spec.add_development_dependency "simplecov"
25
+ end
@@ -0,0 +1,192 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
6
+ <title>Computer History Museum | Exhibits | This Day in History: May 18 </title>
7
+ <link rel="stylesheet" type="text/css" charset="utf-8" href="/_common/css/common/base.css" />
8
+ <link rel="stylesheet" type="text/css" charset="utf-8" href="/_common/css/common/common.css" />
9
+ <link rel="stylesheet" type="text/css" charset="utf-8" href="/_common/css/exhibits/exhibits.css" />
10
+ <link rel="stylesheet" type="text/css" charset="utf-8" href="/_common/js/fancybox/csearch.css" />
11
+ <script type="text/javascript" src="/_common/lib/min/?g=jsExhibits"></script>
12
+
13
+ <!--[if IE]>
14
+ <style>
15
+ .wraptocenter span { display: inline-block; height: 100%; }
16
+ .layout { height: 0; he\ight: auto; zoom: 1; }
17
+ </style>
18
+ <![endif]-->
19
+
20
+ <!--[if lt IE 9]>
21
+ <style>
22
+ .today { margin: 80px 0px 0px 60px }
23
+ .today-date { margin: 0px 0px 0px 60px; }
24
+ </style>
25
+ <![endif]-->
26
+
27
+
28
+ <style type="text/css">
29
+ .rotate-date { -moz-transform: rotate(13deg); -o-transform: rotate(13deg); -webkit-transform: rotate(13deg); transform: rotate(13deg); }
30
+ .today { display: block; width: 200px; height: 20px; line-height: 1.4em; color: #990000; font-size: 1.25em; margin: 90px 0px 0px 60px }
31
+ .today-date { display: block; width: 200px; height: 20px; margin: 0px 0px 0px 55px; }
32
+ </style>
33
+
34
+
35
+ </head>
36
+ <body>
37
+ <!-- main container here -->
38
+ <div id="page">
39
+ <!-- header here -->
40
+ <!-- HEADER for EDUCATION Section, new CSS styles -->
41
+
42
+ <div id="header">
43
+ <div id="menunav">
44
+ <div id="search">
45
+ <form id="searchform" method="get" action="/search/">
46
+ <fieldset>
47
+ <label for="searchinput">Search</label>
48
+ <input class="query swap_value" id="searchinput" type="text" name="q" size="15" maxlength="255" value="Site Search ..." />
49
+ <input type="image" id="searchicon" name="submit" src="/_common/img/searchicon.png" width="30" height="30" alt="Go" />
50
+ <input type="hidden" name="site" value="chm_collection"/>
51
+ <input type="hidden" name="client" value="chm_collection"/>
52
+ <input type="hidden" name="proxystylesheet" value="chm_collection"/>
53
+ <input type="hidden" name="output" value="xml_no_dtd"/>
54
+ </fieldset>
55
+ </form>
56
+ </div>
57
+
58
+ <div id="quicklinks"><a href="/">Home</a> &middot; <a href="/directions/">Directions</a> &middot; <a href="/contact/">Contact</a></div>
59
+ </div>
60
+ <div id="banner">
61
+ <a href="/"><img id="logo" src="/_common/img/header-chmlogosmall.png" alt="Computer History Museum" /></a>
62
+ <img id="chmbuilding" src="/_common/img/header-building.jpg" alt="Computer History Museum Mountain View Building" />
63
+ <div id="globalnav">
64
+ <ul class="globalnav">
65
+ <li id="visitus"><a href="/visit/">Visit Us</a></li>
66
+ <li id="exhibits"><a href="/exhibits/">Exhibits</a></li>
67
+ <li id="explore"><a href="/explore/">Explore</a></li>
68
+ <li id="getinvolved"><a href="/getinvolved/">Get Involved</a></li>
69
+ <li id="education"><a href="/education/">Education</a></li>
70
+ <li id="events"><a href="/events/upcoming/">Events</a></li>
71
+ <li id="atchm"><a href="/atchm/">@CHM</a></li>
72
+ </ul>
73
+ </div>
74
+ </div>
75
+
76
+ </div>
77
+
78
+
79
+ <!-- left nav menu here -->
80
+ <!-- Left NAV Menu for Exhibits Section, new CSS styles -->
81
+ <div id="localnav">
82
+ <img src="/_common/img/exhibits/heading-exhibits.png" alt="Exhibits" />
83
+ <ul class="localnav">
84
+ <li><a href="/exhibits/">Overview</a></li>
85
+ <li><a href="/revolution/">Revolution</a></li>
86
+ <li><a href="/fellowawards/hall/">Hall of Fellows</a></li>
87
+ <li><a href="/internet_history/">Internet History 1962 to 1992</a></li>
88
+ <li><a href="/chess/">Mastering the Game</a></li>
89
+ <li><a href="/microprocessors/">Microprocessors 1971 to 1996</a></li>
90
+ <li><a href="/pdp-1/">PDP-1 Restoration Project</a></li>
91
+ <li><a href="/brochures/">Selling the Computer Revolution</a></li>
92
+ <li><a href="/babbage/">The Babbage Engine</a></li>
93
+ <li><a href="/semiconductor/">The Silicon Engine</a></li>
94
+ <li><a href="/tdih/">This Day in History</a></li>
95
+ <li><a href="/timeline/">Timeline of Computer History</a></li>
96
+ <li><a href="/virtualvisiblestorage/">Visible Storage</a></li>
97
+ </ul>
98
+
99
+ <img src="/_common/img/exhibits/heading-atthemuseum.png" alt="At the Museum" />
100
+ <ul class="localnav">
101
+ <li><a href="/atmuseum/">Overview<img style="padding-left: 7px; margin: 0 0;" src="/_common/img/icon-linkin-grey.gif" /></a></li>
102
+ </ul>
103
+ </div>
104
+
105
+
106
+
107
+ <!-- MAIN CONTENT HERE **************************************************************************************************************************************************** -->
108
+ <div id="content">
109
+
110
+ <!-- INTRO BLOCK with the main image and content here -->
111
+ <div id="intro">
112
+ <h1><span class="t-red">This Day in History</span></h1>
113
+
114
+ <div id="tdihcontent">
115
+ <div id="tdihheader">
116
+ <div id="tdihcalendar">
117
+ <!-- PHP Dynamic Calendar here -->
118
+ <table class="calendar" border="0" cellspacing="0" cellpadding="0"><tr><th id="prev"><a href="/tdih/April/18/">&nbsp;&nbsp;&nbsp;</a></th><th id="next"><a href="/tdih/June/18/">&nbsp;&nbsp;&nbsp;</a></th><th class="calendar_header" colspan="5">May 2014</th></tr><tr><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td></tr><tr><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar">&nbsp;</td><td class="calendar "><a href="/tdih/May/1/">1</a></td><td class="calendar "><a href="/tdih/May/2/">2</a></td><td class="weekend calendar "><a href="/tdih/May/3/">3</a></td></tr><tr><td class="weekend calendar "><a href="/tdih/May/4/">4</a></td><td class="calendar "><a href="/tdih/May/5/">5</a></td><td class="calendar "><a href="/tdih/May/6/">6</a></td><td class="calendar "><a href="/tdih/May/7/">7</a></td><td class="calendar "><a href="/tdih/May/8/">8</a></td><td class="calendar "><a href="/tdih/May/9/">9</a></td><td class="weekend calendar "><a href="/tdih/May/10/">10</a></td></tr><tr><td class="weekend calendar "><a href="/tdih/May/11/">11</a></td><td class="calendar "><a href="/tdih/May/12/">12</a></td><td class="calendar "><a href="/tdih/May/13/">13</a></td><td class="calendar "><a href="/tdih/May/14/">14</a></td><td class="calendar "><a href="/tdih/May/15/">15</a></td><td class="calendar "><a href="/tdih/May/16/">16</a></td><td class="weekend calendar "><a href="/tdih/May/17/">17</a></td></tr><tr><td class="weekend actday "><a href="/tdih/May/18/">18</a></td><td class="calendar "><a href="/tdih/May/19/">19</a></td><td class="calendar "><a href="/tdih/May/20/">20</a></td><td class="calendar "><a href="/tdih/May/21/">21</a></td><td class="calendar "><a href="/tdih/May/22/">22</a></td><td class="calendar "><a href="/tdih/May/23/">23</a></td><td class="weekend calendar "><a href="/tdih/May/24/">24</a></td></tr><tr><td class="weekend calendar "><a href="/tdih/May/25/">25</a></td><td class="calendar "><a href="/tdih/May/26/">26</a></td><td class="calendar "><a href="/tdih/May/27/">27</a></td><td class="calendar "><a href="/tdih/May/28/">28</a></td><td class="calendar "><a href="/tdih/May/29/">29</a></td><td class="calendar "><a href="/tdih/May/30/">30</a></td><td class="weekend calendar "><a href="/tdih/May/31/">31</a></td></tr></table>
119
+ </div>
120
+
121
+ <div id="tdihdate">
122
+ <span class="today rotate-date">Today: </span>
123
+ <span class="today-date rotate-date">May 18, 2014</span>
124
+ </div>
125
+ </div>
126
+
127
+
128
+ <div id="tdihbody">
129
+ <!-- Computing History Content starts here -->
130
+ <div class="tdihevent">
131
+ <div class="tdihimage">
132
+ <div class="image layout"><img class='main' src='/tdih/img/no_image.jpg' title='No image available' /></div><!-- image here -->
133
+ <div class="caption"></div><!-- image captions here -->
134
+ </div>
135
+
136
+ <h3 class="title">May 18, 1998</h3>
137
+ <p class="subtitle">United States Justice Department Files Antitrust against Microsoft </p>
138
+ <p>The United States Department of Justice and twenty US states filed a set of civil actions against Microsoft Corporation. The plaintiffs alleged that Microsoft abused monopoly power regarding operating system and Web browser sales. The central issue was whether it was monopolistic of Microsoft to bundle Internet Explorer software with its Windows operating system. This practice was alleged to have been responsible for Microsoft's victory in the “browser wars” because every Windows user had a copy of Internet Explorer. It was further alleged that this unfairly restricted the market for competing web browsers (such as Netscape Navigator or Opera), which were slow to download over a modem or had to be purchased at a store. The case was tried before U.S. District Court Judge Thomas Penfield Jackson. Joel I. Klein was the lead prosecutor. David Boies initially represented the Department of Justice.</p>
139
+
140
+ <br style="clear: both;" />
141
+ </div>
142
+ <!-- Computing History Content ends here -->
143
+ <br style="clear: both;" />
144
+ </div>
145
+ </div>
146
+
147
+
148
+ </div>
149
+ <!--// MAIN BLOCK with the main image and content -->
150
+ </div>
151
+ <!--// MAIN CONTENT ******************************************************************************************************************************************************* -->
152
+
153
+
154
+ <br class="clear" /><!-- This clearing element should immediately follow the div#content in order to force div#page to contain all child floats -->
155
+ <!-- footer here -->
156
+ <!-- FOOTER for GetInvolved Section, new CSS styles -->
157
+
158
+
159
+ <div id="footer">
160
+ <span id="copyright" class="floatleft">
161
+ Copyright &copy; <script type="text/javascript">var currentTime = new Date(); document.write(currentTime.getFullYear()); </script> Computer History Museum
162
+ </span>
163
+ <span id="navigation" class="floatright">
164
+ <a href="/terms/">TERMS OF USE</a> &nbsp;
165
+ <a href="/privacy/">PRIVACY</a> &nbsp;
166
+ <a href="/sitemap/">SITE MAP</a>
167
+ </span>
168
+ </div>
169
+
170
+
171
+
172
+ </div>
173
+ <!--// main container -->
174
+
175
+ <script type="text/javascript">
176
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
177
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
178
+ </script>
179
+ <script type="text/javascript" src="/_common/lib/minify102/minify.php?files=/_common/js/google-ga.js"></script>
180
+
181
+
182
+ <script type="text/javascript">
183
+ $(document).ready(function() {
184
+ $('div.tdihimage a').fancybox({ 'hideOnContentClick': true }); //Activate FancyBox
185
+
186
+ // local nav
187
+ var path=location.pathname.substring(0,6);
188
+ $('.localnav li a[href$="' + path + '"]').addClass('active');
189
+ });
190
+ </script>
191
+ </body>
192
+ </html>
@@ -0,0 +1,28 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Handlers::Chm, lita_handler: true do
4
+
5
+ it { routes_command("today in computer history").to(:history) }
6
+ it { routes_command("tdih").to(:history) }
7
+ it { routes_command("chm").to(:history) }
8
+
9
+ describe("#history") do
10
+
11
+ let(:http_response) do
12
+ double("Faraday::Response").tap do |response|
13
+ allow(response).to receive(:status).and_return(200)
14
+ allow(response).to receive(:body).and_return(File.read("spec/fixtures/chm.html"))
15
+ end
16
+ end
17
+
18
+ before do
19
+ allow_any_instance_of(Faraday::Connection).to receive(:get).and_return(http_response)
20
+ end
21
+
22
+ it "replies with the short history lesson of the day" do
23
+ send_command("today in computer history")
24
+ expect(replies.last).to eq("May 18, 1998\nUnited States Justice Department Files Antitrust against Microsoft \nThe United States Department of Justice and twenty US states filed a set of civil actions against Microsoft Corporation. The plaintiffs alleged that Microsoft abused monopoly power regarding operating system and Web browser sales. The central issue was whether it was monopolistic of Microsoft to bundle Internet Explorer software with its Windows operating system. This practice was alleged to have been responsible for Microsoft's victory in the “browser wars” because every Windows user had a copy of Internet Explorer. It was further alleged that this unfairly restricted the market for competing web browsers (such as Netscape Navigator or Opera), which were slow to download over a modem or had to be purchased at a store. The case was tried before U.S. District Court Judge Thomas Penfield Jackson. Joel I. Klein was the lead prosecutor. David Boies initially represented the Department of Justice.")
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,12 @@
1
+ require "coveralls"
2
+ require "simplecov"
3
+
4
+ require "lita-chm"
5
+ require "lita/rspec"
6
+
7
+ Coveralls.wear!
8
+
9
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
10
+ SimpleCov::Formatter::HTMLFormatter,
11
+ ]
12
+ SimpleCov.start { add_filter "/spec/" }
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-chm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Paramio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: lita
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.0.beta1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 3.0.0.beta1
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Shows a short history lesson of the day from the Computer History Museum.
112
+ email:
113
+ - hola@carlosparamio.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .travis.yml
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - lib/lita-chm.rb
126
+ - lib/lita/handlers/chm.rb
127
+ - lita-chm.gemspec
128
+ - spec/fixtures/chm.html
129
+ - spec/lita/handlers/chm_spec.rb
130
+ - spec/spec_helper.rb
131
+ homepage: https://github.com/carlosparamio/lita-chm
132
+ licenses: []
133
+ metadata:
134
+ lita_plugin_type: handler
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.1.11
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: Shows a short history lesson of the day from the Computer History Museum
155
+ test_files:
156
+ - spec/fixtures/chm.html
157
+ - spec/lita/handlers/chm_spec.rb
158
+ - spec/spec_helper.rb
159
+ has_rdoc: