qotd 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c40d0d024d6c68946cd406f607b65b164dc4f2eb
4
- data.tar.gz: 8414433fc8c7fa005102f17720f6d845263183ae
3
+ metadata.gz: d9c60639e62a9928072dc2d06377d6857b25e93c
4
+ data.tar.gz: 7a800932681b2e6a69f9dbeab1ac95f2c89b0ab4
5
5
  SHA512:
6
- metadata.gz: 18a44e856fd71155511ead40c13b02b529ace81e18e22a2248131eb4c6bef744e3569d00c70f1b2dcf4aa1d7dbf736267279afe846fd2c92f10ab08a8a61cce4
7
- data.tar.gz: 5740ad365ff336f57bc78598b7fc7e25f58f2ec3c7c7316b99da90b4b24573bbc18fb49df484e68f5a5825c6a7000a087f88aaf7ac5194be63624d4c84a28dbd
6
+ metadata.gz: e9446ba0cb8fcbfcad35455dd896ca262f49467201b909cef7949249d1b778d508567a7d045437afb78bb7e1a2e82b0b84f01368b512c0975771e3982b697f6f
7
+ data.tar.gz: 7fe7f0e8c1d38c8c4e028b442f159f5b8d8f7f36be690b1546dc9d4d127720197ebff04cd097aa04397f793173e55ac1ae9856f19af6817afc3ca985961cb036
data/README.md CHANGED
@@ -14,9 +14,7 @@ the quotes in it numbers over 3000 lines!
14
14
 
15
15
  ## Todo
16
16
 
17
- - Make a method that returns a quotes array.
18
- - Make a method that returns the same formatted array as before.
19
- - Test each of them.
17
+ - Find a way to test it.
20
18
 
21
19
  ## Installation
22
20
 
data/bin/qotd CHANGED
@@ -1,22 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # The first argument can be used as a quote to print, but if no arg is given,
4
- # print a random quote from the file.
3
+ # The first argument can be used as a quote to print. If the arg is '--web',
4
+ # then a Sinatra application will launch and display quotes on localhost:4567.
5
+ # If no arguments given, rint a random quote from the quotes file.
5
6
 
6
7
  require 'qotd'
7
8
 
8
- puts "Quote of the Day:"
9
-
10
- quote = []
11
- if ARGV.first
12
- quote = Format.format_quote(ARGV.first)
9
+ if ARGV.first == "--web"
10
+ `open http://localhost:4567`
11
+ `ruby lib/qweb.rb`
13
12
  else
14
- quote = Format.format_quote(Qotd.quote)
15
- end
16
13
 
17
- last = quote.length - 1
14
+ puts "Quote of the Day:"
15
+
16
+ quote = []
17
+ if ARGV.first
18
+ quote = Format.format_quote(ARGV.first)
19
+ else
20
+ quote = Format.format_quote(Qotd.quote)
21
+ end
18
22
 
19
- print quote[0]
20
- puts quote[(1...last)]
21
- print quote[last]
23
+ last = quote.length - 1
24
+
25
+ print quote[0]
26
+ puts quote[(1...last)]
27
+ print quote[last]
28
+
29
+ end
22
30
 
@@ -0,0 +1,67 @@
1
+ body {
2
+ background-color: #666;
3
+ color: #999;
4
+ font-family: "Georgia", "Times New Roman", "Times", Serif;
5
+ -webkit-font-smoothing: antialiased;
6
+ }
7
+
8
+ button {
9
+ height: 100%;
10
+ width: 100%;
11
+ border: 0.5em double #787878;
12
+ background-color: #333;
13
+ color: inherit;
14
+ }
15
+
16
+ button:hover {
17
+ cursor: pointer;
18
+ }
19
+
20
+ div#page {
21
+ margin: 3em 25%;
22
+ }
23
+
24
+ div#info {
25
+ position: fixed;
26
+ top: 80px;
27
+ left: 50%;
28
+ width: 600px;
29
+ margin-left: -300px;
30
+ }
31
+
32
+ div#title {
33
+ position: fixed;
34
+ top: 1em;
35
+ left: 50%;
36
+ height: 100px;
37
+ width: 600px;
38
+ margin-left: -300px;
39
+ }
40
+
41
+ div#quote {
42
+ position: fixed;
43
+ width: 600px;
44
+ top: 35%;
45
+ left: 50%;
46
+ margin-left: -300px;
47
+ }
48
+
49
+ h1 {
50
+ text-align: center;
51
+ font-size: 4em;
52
+ font-weight: lighter;
53
+ }
54
+
55
+ h2 {
56
+ text-align: center;
57
+ font-size: 1em;
58
+ font-weight: lighter;
59
+ }
60
+
61
+ p {
62
+ margin: 0;
63
+ text-align: center;
64
+ font-size: 3em;
65
+ font-family: "Georgia", "Times New Roman", "Times", Serif;
66
+ }
67
+
data/lib/qotd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qotd
2
- VERSION = "1.3.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/lib/qweb.rb ADDED
@@ -0,0 +1,10 @@
1
+ require_relative "qotd"
2
+ require_relative "format"
3
+ require "sinatra"
4
+ require "erb"
5
+
6
+ get '/' do
7
+ qarray = params[:quote] || Format.to_array(Qotd.quote)
8
+ erb :fancy, :locals => {:qarray => qarray}
9
+ end
10
+
@@ -0,0 +1,4 @@
1
+ <% qarray.each do |line| %>
2
+ <p><%= line %></p>
3
+ <% end %>
4
+
@@ -0,0 +1,23 @@
1
+ <html>
2
+ <head>
3
+ <title>Quote of the Day</title>
4
+ <link type="text/css" rel="stylesheet" href="default.css" />
5
+ <meta http-equiv="refresh" content="60" />
6
+ </head>
7
+ <body>
8
+ <button type="button" onclick="history.go(0)">
9
+ <div id="page">
10
+ <div id="info">
11
+ <h2>Click to go to next quote.</h2>
12
+ </div>
13
+ <div id="title">
14
+ <h1>Quote of the Day</h1>
15
+ </div>
16
+ <div id="quote">
17
+ <%= yield %>
18
+ </div>
19
+ </div>
20
+ </button>
21
+ </body>
22
+ </html>
23
+
data/qotd.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake", "~> 10.1"
22
+ spec.add_development_dependency "rake", "~> 1.4"
23
+ spec.add_development_dependency "sinatra", "~> 10.1"
23
24
  spec.add_development_dependency "rspec", "~> 2.14"
24
25
  end
data/spec/qweb_spec.rb ADDED
@@ -0,0 +1,13 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe "Qweb" do
4
+ include Rack::Test::Methods
5
+
6
+ it "says hello world" do
7
+ get '/'
8
+ expect(last_response).to be_ok
9
+ expect(last_response.body).to eq("Hello World!")
10
+ end
11
+
12
+ end
13
+
@@ -0,0 +1,12 @@
1
+ require_relative "../lib/qweb"
2
+ require "rspec"
3
+ require "rack/test"
4
+
5
+ ENV['RACK_ENV'] = 'test'
6
+
7
+ def app
8
+ Sinatra::Application
9
+ end
10
+
11
+ # Will need to `include Rack::Test::Methods` in the describe block.
12
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qotd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfjhh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -26,6 +26,20 @@ dependencies:
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ~>
@@ -67,13 +81,19 @@ files:
67
81
  - Rakefile
68
82
  - bin/qotd
69
83
  - lib/format.rb
84
+ - lib/public/default.css
70
85
  - lib/qotd.rb
71
86
  - lib/qotd/version.rb
72
87
  - lib/quotes/quotes.txt
88
+ - lib/qweb.rb
89
+ - lib/views/fancy.erb
90
+ - lib/views/layout.erb
73
91
  - qotd.gemspec
74
92
  - screenshot/screenshot.png
75
93
  - spec/format_spec.rb
76
94
  - spec/qotd_spec.rb
95
+ - spec/qweb_spec.rb
96
+ - spec/spec_helper.rb
77
97
  homepage: https://github.com/jfjhh/qotd
78
98
  licenses:
79
99
  - MIT
@@ -101,4 +121,6 @@ summary: Displays a new quote on login to terminal.
101
121
  test_files:
102
122
  - spec/format_spec.rb
103
123
  - spec/qotd_spec.rb
124
+ - spec/qweb_spec.rb
125
+ - spec/spec_helper.rb
104
126
  has_rdoc: