lyracyst 0.0.5 → 0.0.6
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 +4 -4
- data/bin/lyracyst +66 -222
- data/lib/lyracyst.rb +66 -222
- data/lib/lyracyst/fetch.rb +83 -0
- data/lib/lyracyst/search.rb +92 -0
- data/lib/lyracyst/version.rb +4 -0
- metadata +75 -6
- data/changelog.md +0 -17
- data/license.md +0 -22
- data/readme.md +0 -94
- data/scaffold.md +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8723f57fb79a4ce8acbe30465686e5c04f8fd93c
|
4
|
+
data.tar.gz: 7ac5df788e079525c4bd72c53ebea08ca08cb23a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b4fc7346156ff36f9080d1f211ed8a019dd1954510e4cfbc6861e13f933a02e45631989a18542738515ac41ca6346520c859f63033404aba25ce5e13884a961
|
7
|
+
data.tar.gz: b5f8385b1dcb2d6f20742d6bf75095d4618652a4b28f1d754024108d12f1ada0c90caacc99150e31baa18e8f5cd65ba8f5cf65d3f84d5430b3fd90295c642cba
|
data/bin/lyracyst
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'commander/import'
|
4
|
+
require 'lyracyst/fetch'
|
5
|
+
require 'lyracyst/search'
|
6
|
+
require 'lyracyst/version'
|
7
|
+
|
2
8
|
# The program takes a search term and returns a list.
|
3
9
|
# The list can be either definitions, related words,
|
4
10
|
# rhymes, or all three at once.
|
@@ -6,238 +12,76 @@
|
|
6
12
|
# Author:: Drew Prentice (mailto:weirdpercent@gmail.com)
|
7
13
|
# Copyright:: Copyright (c) 2014 Drew Prentice
|
8
14
|
# License:: MIT
|
15
|
+
module Lyracyst
|
16
|
+
environment = 'ruby'
|
17
|
+
program :name, 'lyracyst'
|
18
|
+
program :version, VERSION
|
19
|
+
program :description, 'A powerful word search tool that fetches definitions, related words, and rhymes.'
|
9
20
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
def search(url, result)
|
30
|
-
result=open(url).read
|
31
|
-
end
|
32
|
-
|
33
|
-
# Sets today's date and writes it with querycount to syncqc.json.
|
34
|
-
#
|
35
|
-
# @param dateint [Fixnum] Today's date in integer form.
|
36
|
-
# @param querycount [Fixnum] Number of daily queries in integer form.
|
37
|
-
def update(dateint, querycount)
|
38
|
-
qct={'date' => dateint, 'querycount' => querycount}
|
39
|
-
fo=File.open("json/synqc.json", "w+")
|
40
|
-
tofile=MultiJson.dump(qct)
|
41
|
-
fo.print tofile
|
42
|
-
fo.close
|
43
|
-
end
|
44
|
-
|
45
|
-
# Extracts related words from JSON response and prints them.
|
46
|
-
#
|
47
|
-
# @param x [Fixnum] Integer always set to zero.
|
48
|
-
# @param y [Fixnum] Number of items in resulta Array minus 1.
|
49
|
-
# @param resulta [Array] An array of values from JSON response.
|
50
|
-
def rel(x, y, resulta)
|
51
|
-
while x <= y
|
52
|
-
resultl=resulta[x]
|
53
|
-
list=resultl['list']
|
54
|
-
cat=list['category'].gsub(/\(|\)/, '')
|
55
|
-
puts "Related words: #{list['category']} - #{list['synonyms']}"
|
56
|
-
x+=1
|
21
|
+
command :get do |c|
|
22
|
+
c.syntax = 'lyracyst get word'
|
23
|
+
c.summary = 'Fetches all sources'
|
24
|
+
c.description = 'Searches definitions, related words, and rhymes for a given query'
|
25
|
+
c.example 'Fetches info about the word test', 'lyracyst get test'
|
26
|
+
#c.option = '--lang en_US', String, 'Sets search language'
|
27
|
+
#c.option = '--fmt json', String, 'Sets XML or JSON format'
|
28
|
+
c.action do |args, options|
|
29
|
+
#options.default :lang => 'en_US', :fmt => 'json'
|
30
|
+
lang = 'en_US'
|
31
|
+
fmt = 'json'
|
32
|
+
search = args[0]
|
33
|
+
fmt = 'json'
|
34
|
+
result = []
|
35
|
+
s = Lyracyst::Search.new
|
36
|
+
puts "Getting all for [#{search}]"
|
37
|
+
s.define(search)
|
38
|
+
s.related(search, result, lang, fmt)
|
39
|
+
s.rhyme(search, result)
|
57
40
|
end
|
58
41
|
end
|
59
42
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
# @param querycount [Fixnum] Number of daily queries in integer form.
|
71
|
-
def submit(search, dateint, result, environment, querycount)
|
72
|
-
urlprefix='http://thesaurus.altervista.org/thesaurus/v1'
|
73
|
-
apikey=ENV['THESAURUS']
|
74
|
-
searchlang='en_US'
|
75
|
-
dataoutput='json'
|
76
|
-
url="#{urlprefix}?key=#{apikey}&word=#{search}&language=#{searchlang}&output=#{dataoutput}"
|
77
|
-
if environment == 'javascript'
|
78
|
-
url="#{url}&callback=synonymSearch"
|
43
|
+
command :define do |c|
|
44
|
+
c.syntax = 'lyracyst define word'
|
45
|
+
c.summary = 'Fetches definitions'
|
46
|
+
c.description = 'Uses the Wordnik API to get definitions'
|
47
|
+
c.example 'Uses the Wordnik API to get definitions of the word test', 'lyracyst define test'
|
48
|
+
c.action do |args, options|
|
49
|
+
search = args[0]
|
50
|
+
s = Lyracyst::Search.new
|
51
|
+
puts "Getting definitions for [#{search}]"
|
52
|
+
s.define(search)
|
79
53
|
end
|
80
|
-
f=Fetch.new()
|
81
|
-
resultj=f.search(url, result)
|
82
|
-
resultp=MultiJson.load(resultj)
|
83
|
-
resulta=resultp['response']
|
84
|
-
x=0
|
85
|
-
y=resulta.length-1
|
86
|
-
f.rel(x, y, resulta)
|
87
|
-
querycount+=1
|
88
|
-
f.update(dateint, querycount)
|
89
54
|
end
|
90
55
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
fix=parse[x]
|
106
|
-
parse[x]=fix.gsub(' ', "'")
|
107
|
-
end
|
108
|
-
print "#{parse[x]} "
|
109
|
-
x+=1
|
56
|
+
command :related do |c|
|
57
|
+
c.syntax = 'lyracyst related word'
|
58
|
+
c.summary = 'Fetches related words'
|
59
|
+
c.description = 'Uses the Altervista API to get related words'
|
60
|
+
c.example 'Uses the Altervista API to get words related to test', 'lyracyst related test'
|
61
|
+
#c.option = '--lang', String, 'Sets search language'
|
62
|
+
c.action do |args, options|
|
63
|
+
lang = 'en_US'
|
64
|
+
fmt = 'json'
|
65
|
+
search = args[0]
|
66
|
+
result = []
|
67
|
+
s = Lyracyst::Search.new
|
68
|
+
puts "Getting related words for [#{search}]"
|
69
|
+
s.related(search, result, lang, fmt)
|
110
70
|
end
|
111
71
|
end
|
112
|
-
end
|
113
72
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
if d < 10 then d="0#{d}" else d=d.to_s; end
|
127
|
-
date="#{y}#{m}#{d}"
|
128
|
-
dateint=date.to_i
|
129
|
-
if File.exist?("json/synqc.json") == true
|
130
|
-
rl=File.readlines("json/synqc.json")
|
131
|
-
rl=rl[0]
|
132
|
-
loadrl=MultiJson.load(rl)
|
133
|
-
testdate=loadrl['date']
|
134
|
-
testcount=loadrl['querycount']
|
135
|
-
pdateint=testdate.to_i
|
136
|
-
if dateint > pdateint == true
|
137
|
-
f=Fetch.new()
|
138
|
-
f.update(dateint, querycount)
|
139
|
-
end
|
140
|
-
else
|
141
|
-
testcount=0
|
142
|
-
end
|
143
|
-
if testcount < maxqueries
|
144
|
-
f=Fetch.new()
|
145
|
-
f.submit(search, dateint, result, environment, querycount)
|
146
|
-
else
|
147
|
-
puts "Max queries per day has been reached."
|
148
|
-
end
|
149
|
-
end
|
150
|
-
# Wordnik.com's service provides definitions. The logger
|
151
|
-
# defaults to Rails.logger or Logger.new(STDOUT). Set to
|
152
|
-
# Logger.new('/dev/null') to disable logging.
|
153
|
-
#
|
154
|
-
# @param search [String] The word or phrase to search for.
|
155
|
-
def define(search)
|
156
|
-
apikey=ENV['WORDNIK']
|
157
|
-
Wordnik.configure do |cfg|
|
158
|
-
cfg.api_key=apikey
|
159
|
-
cfg.response_format='json'
|
160
|
-
cfg.logger = Logger.new('/dev/null')
|
73
|
+
command :rhyme do |c|
|
74
|
+
c.syntax = 'lyracyst rhyme word'
|
75
|
+
c.summary = 'Fetches rhymes'
|
76
|
+
c.description = 'Uses the ARPABET system to get rhymes'
|
77
|
+
c.example 'Uses the ARPABET system to get rhymes with test', 'lyracyst rhyme test'
|
78
|
+
c.option '--some-switch', 'Some switch that does something'
|
79
|
+
c.action do |args, options|
|
80
|
+
result = []
|
81
|
+
search = args[0]
|
82
|
+
s = Lyracyst::Search.new
|
83
|
+
puts "Getting rhymes for [#{search}]"
|
84
|
+
s.rhyme(search, result)
|
161
85
|
end
|
162
|
-
define=Wordnik.word.get_definitions(search)
|
163
|
-
define.map { |defi|
|
164
|
-
text=defi['text']; att=defi['attributionText']; part=defi['partOfSpeech'];
|
165
|
-
puts "Definition: #{part} - #{text}"
|
166
|
-
#puts "Definition: #{part} - #{text} - #{att}" #With attribution to source
|
167
|
-
}
|
168
|
-
end
|
169
|
-
|
170
|
-
# ARPA created ARPABET decades ago to find words that
|
171
|
-
# rhyme. The technology is still quite relevant today.
|
172
|
-
# This program uses the Heroku app based on ARPABET.
|
173
|
-
#
|
174
|
-
# @param search [String] The word or phrase to search for.
|
175
|
-
def rhyme(search)
|
176
|
-
url="http://arpabet.heroku.com/words/#{search}"
|
177
|
-
f=Fetch.new()
|
178
|
-
result=f.search(url, result) #submit search query
|
179
|
-
parse=MultiJson.load(result)
|
180
|
-
print "Rhymes with: "
|
181
|
-
x=0
|
182
|
-
y=parse.length - 1
|
183
|
-
f.parse(x, y, parse)
|
184
|
-
print "\n"
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
program :name, 'lyracyst'
|
189
|
-
program :version, '0.0.5'
|
190
|
-
program :description, 'A powerful word search tool that fetches definitions, related words, and rhymes.'
|
191
|
-
command :get do |c|
|
192
|
-
c.syntax = 'lyracyst get [options]'
|
193
|
-
c.summary = 'Fetches all sources'
|
194
|
-
c.description = 'Searches definitions, related words, and rhymes for a given query'
|
195
|
-
c.example 'Searches definitions, related words, and rhymes for a given query', 'lyracyst get test'
|
196
|
-
c.action do |args, options|
|
197
|
-
search=args[0]
|
198
|
-
s=Search.new
|
199
|
-
puts "Searching for [#{search}]:"
|
200
|
-
s.define(search)
|
201
|
-
s.related(search, result)
|
202
|
-
s.rhyme(search)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
command :define do |c|
|
207
|
-
c.syntax = 'lyracyst define [options]'
|
208
|
-
c.summary = 'Fetches definitions'
|
209
|
-
c.description = 'Uses the Wordnik API to get definitions'
|
210
|
-
c.example 'Uses the Wordnik API to get definitions', 'lyracyst define test'
|
211
|
-
c.action do |args, options|
|
212
|
-
search=args[0]
|
213
|
-
s=Search.new
|
214
|
-
puts "Searching for [#{search}]:"
|
215
|
-
s.define(search)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
command :related do |c|
|
220
|
-
c.syntax = 'lyracyst related [options]'
|
221
|
-
c.summary = 'Fetches related words'
|
222
|
-
c.description = 'Uses the Altervista API to get related words'
|
223
|
-
c.example 'Uses the Altervista API to get related words', 'lyracyst related test'
|
224
|
-
c.action do |args, options|
|
225
|
-
search=args[0]
|
226
|
-
s=Search.new
|
227
|
-
puts "Searching for [#{search}]:"
|
228
|
-
s.related(search)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
command :rhyme do |c|
|
233
|
-
c.syntax = 'lyracyst rhyme [options]'
|
234
|
-
c.summary = 'Fetches rhymes'
|
235
|
-
c.description = 'Uses the ARPABET system to get rhymes'
|
236
|
-
c.example 'Uses the ARPABET system to get rhymes', 'lyracyst rhyme test'
|
237
|
-
c.action do |args, options|
|
238
|
-
search=args[0]
|
239
|
-
s=Search.new
|
240
|
-
puts "Searching for [#{search}]:"
|
241
|
-
s.rhyme(search)
|
242
86
|
end
|
243
87
|
end
|
data/lib/lyracyst.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'commander/import'
|
4
|
+
require './lib/lyracyst/fetch.rb'
|
5
|
+
require './lib/lyracyst/search.rb'
|
6
|
+
require './lib/lyracyst/version.rb'
|
7
|
+
|
2
8
|
# The program takes a search term and returns a list.
|
3
9
|
# The list can be either definitions, related words,
|
4
10
|
# rhymes, or all three at once.
|
@@ -6,238 +12,76 @@
|
|
6
12
|
# Author:: Drew Prentice (mailto:weirdpercent@gmail.com)
|
7
13
|
# Copyright:: Copyright (c) 2014 Drew Prentice
|
8
14
|
# License:: MIT
|
15
|
+
module Lyracyst
|
16
|
+
environment = 'ruby'
|
17
|
+
program :name, 'lyracyst'
|
18
|
+
program :version, VERSION
|
19
|
+
program :description, 'A powerful word search tool that fetches definitions, related words, and rhymes.'
|
9
20
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
def search(url, result)
|
30
|
-
result=open(url).read
|
31
|
-
end
|
32
|
-
|
33
|
-
# Sets today's date and writes it with querycount to syncqc.json.
|
34
|
-
#
|
35
|
-
# @param dateint [Fixnum] Today's date in integer form.
|
36
|
-
# @param querycount [Fixnum] Number of daily queries in integer form.
|
37
|
-
def update(dateint, querycount)
|
38
|
-
qct={'date' => dateint, 'querycount' => querycount}
|
39
|
-
fo=File.open("json/synqc.json", "w+")
|
40
|
-
tofile=MultiJson.dump(qct)
|
41
|
-
fo.print tofile
|
42
|
-
fo.close
|
43
|
-
end
|
44
|
-
|
45
|
-
# Extracts related words from JSON response and prints them.
|
46
|
-
#
|
47
|
-
# @param x [Fixnum] Integer always set to zero.
|
48
|
-
# @param y [Fixnum] Number of items in resulta Array minus 1.
|
49
|
-
# @param resulta [Array] An array of values from JSON response.
|
50
|
-
def rel(x, y, resulta)
|
51
|
-
while x <= y
|
52
|
-
resultl=resulta[x]
|
53
|
-
list=resultl['list']
|
54
|
-
cat=list['category'].gsub(/\(|\)/, '')
|
55
|
-
puts "Related words: #{list['category']} - #{list['synonyms']}"
|
56
|
-
x+=1
|
21
|
+
command :get do |c|
|
22
|
+
c.syntax = 'lyracyst get word'
|
23
|
+
c.summary = 'Fetches all sources'
|
24
|
+
c.description = 'Searches definitions, related words, and rhymes for a given query'
|
25
|
+
c.example 'Fetches info about the word test', 'lyracyst get test'
|
26
|
+
#c.option = '--lang en_US', String, 'Sets search language'
|
27
|
+
#c.option = '--fmt json', String, 'Sets XML or JSON format'
|
28
|
+
c.action do |args, options|
|
29
|
+
#options.default :lang => 'en_US', :fmt => 'json'
|
30
|
+
lang = 'en_US'
|
31
|
+
fmt = 'json'
|
32
|
+
search = args[0]
|
33
|
+
fmt = 'json'
|
34
|
+
result = []
|
35
|
+
s = Lyracyst::Search.new
|
36
|
+
puts "Getting all for [#{search}]"
|
37
|
+
s.define(search)
|
38
|
+
s.related(search, result, lang, fmt)
|
39
|
+
s.rhyme(search, result)
|
57
40
|
end
|
58
41
|
end
|
59
42
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
# @param querycount [Fixnum] Number of daily queries in integer form.
|
71
|
-
def submit(search, dateint, result, environment, querycount)
|
72
|
-
urlprefix='http://thesaurus.altervista.org/thesaurus/v1'
|
73
|
-
apikey=ENV['THESAURUS']
|
74
|
-
searchlang='en_US'
|
75
|
-
dataoutput='json'
|
76
|
-
url="#{urlprefix}?key=#{apikey}&word=#{search}&language=#{searchlang}&output=#{dataoutput}"
|
77
|
-
if environment == 'javascript'
|
78
|
-
url="#{url}&callback=synonymSearch"
|
43
|
+
command :define do |c|
|
44
|
+
c.syntax = 'lyracyst define word'
|
45
|
+
c.summary = 'Fetches definitions'
|
46
|
+
c.description = 'Uses the Wordnik API to get definitions'
|
47
|
+
c.example 'Uses the Wordnik API to get definitions of the word test', 'lyracyst define test'
|
48
|
+
c.action do |args, options|
|
49
|
+
search = args[0]
|
50
|
+
s = Lyracyst::Search.new
|
51
|
+
puts "Getting definitions for [#{search}]"
|
52
|
+
s.define(search)
|
79
53
|
end
|
80
|
-
f=Fetch.new()
|
81
|
-
resultj=f.search(url, result)
|
82
|
-
resultp=MultiJson.load(resultj)
|
83
|
-
resulta=resultp['response']
|
84
|
-
x=0
|
85
|
-
y=resulta.length-1
|
86
|
-
f.rel(x, y, resulta)
|
87
|
-
querycount+=1
|
88
|
-
f.update(dateint, querycount)
|
89
54
|
end
|
90
55
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
fix=parse[x]
|
106
|
-
parse[x]=fix.gsub(' ', "'")
|
107
|
-
end
|
108
|
-
print "#{parse[x]} "
|
109
|
-
x+=1
|
56
|
+
command :related do |c|
|
57
|
+
c.syntax = 'lyracyst related word'
|
58
|
+
c.summary = 'Fetches related words'
|
59
|
+
c.description = 'Uses the Altervista API to get related words'
|
60
|
+
c.example 'Uses the Altervista API to get words related to test', 'lyracyst related test'
|
61
|
+
#c.option = '--lang', String, 'Sets search language'
|
62
|
+
c.action do |args, options|
|
63
|
+
lang = 'en_US'
|
64
|
+
fmt = 'json'
|
65
|
+
search = args[0]
|
66
|
+
result = []
|
67
|
+
s = Lyracyst::Search.new
|
68
|
+
puts "Getting related words for [#{search}]"
|
69
|
+
s.related(search, result, lang, fmt)
|
110
70
|
end
|
111
71
|
end
|
112
|
-
end
|
113
72
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
if d < 10 then d="0#{d}" else d=d.to_s; end
|
127
|
-
date="#{y}#{m}#{d}"
|
128
|
-
dateint=date.to_i
|
129
|
-
if File.exist?("json/synqc.json") == true
|
130
|
-
rl=File.readlines("json/synqc.json")
|
131
|
-
rl=rl[0]
|
132
|
-
loadrl=MultiJson.load(rl)
|
133
|
-
testdate=loadrl['date']
|
134
|
-
testcount=loadrl['querycount']
|
135
|
-
pdateint=testdate.to_i
|
136
|
-
if dateint > pdateint == true
|
137
|
-
f=Fetch.new()
|
138
|
-
f.update(dateint, querycount)
|
139
|
-
end
|
140
|
-
else
|
141
|
-
testcount=0
|
142
|
-
end
|
143
|
-
if testcount < maxqueries
|
144
|
-
f=Fetch.new()
|
145
|
-
f.submit(search, dateint, result, environment, querycount)
|
146
|
-
else
|
147
|
-
puts "Max queries per day has been reached."
|
148
|
-
end
|
149
|
-
end
|
150
|
-
# Wordnik.com's service provides definitions. The logger
|
151
|
-
# defaults to Rails.logger or Logger.new(STDOUT). Set to
|
152
|
-
# Logger.new('/dev/null') to disable logging.
|
153
|
-
#
|
154
|
-
# @param search [String] The word or phrase to search for.
|
155
|
-
def define(search)
|
156
|
-
apikey=ENV['WORDNIK']
|
157
|
-
Wordnik.configure do |cfg|
|
158
|
-
cfg.api_key=apikey
|
159
|
-
cfg.response_format='json'
|
160
|
-
cfg.logger = Logger.new('/dev/null')
|
73
|
+
command :rhyme do |c|
|
74
|
+
c.syntax = 'lyracyst rhyme word'
|
75
|
+
c.summary = 'Fetches rhymes'
|
76
|
+
c.description = 'Uses the ARPABET system to get rhymes'
|
77
|
+
c.example 'Uses the ARPABET system to get rhymes with test', 'lyracyst rhyme test'
|
78
|
+
c.option '--some-switch', 'Some switch that does something'
|
79
|
+
c.action do |args, options|
|
80
|
+
result = []
|
81
|
+
search = args[0]
|
82
|
+
s = Lyracyst::Search.new
|
83
|
+
puts "Getting rhymes for [#{search}]"
|
84
|
+
s.rhyme(search, result)
|
161
85
|
end
|
162
|
-
define=Wordnik.word.get_definitions(search)
|
163
|
-
define.map { |defi|
|
164
|
-
text=defi['text']; att=defi['attributionText']; part=defi['partOfSpeech'];
|
165
|
-
puts "Definition: #{part} - #{text}"
|
166
|
-
#puts "Definition: #{part} - #{text} - #{att}" #With attribution to source
|
167
|
-
}
|
168
|
-
end
|
169
|
-
|
170
|
-
# ARPA created ARPABET decades ago to find words that
|
171
|
-
# rhyme. The technology is still quite relevant today.
|
172
|
-
# This program uses the Heroku app based on ARPABET.
|
173
|
-
#
|
174
|
-
# @param search [String] The word or phrase to search for.
|
175
|
-
def rhyme(search)
|
176
|
-
url="http://arpabet.heroku.com/words/#{search}"
|
177
|
-
f=Fetch.new()
|
178
|
-
result=f.search(url, result) #submit search query
|
179
|
-
parse=MultiJson.load(result)
|
180
|
-
print "Rhymes with: "
|
181
|
-
x=0
|
182
|
-
y=parse.length - 1
|
183
|
-
f.parse(x, y, parse)
|
184
|
-
print "\n"
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
program :name, 'lyracyst'
|
189
|
-
program :version, '0.0.5'
|
190
|
-
program :description, 'A powerful word search tool that fetches definitions, related words, and rhymes.'
|
191
|
-
command :get do |c|
|
192
|
-
c.syntax = 'lyracyst get [options]'
|
193
|
-
c.summary = 'Fetches all sources'
|
194
|
-
c.description = 'Searches definitions, related words, and rhymes for a given query'
|
195
|
-
c.example 'Searches definitions, related words, and rhymes for a given query', 'lyracyst get test'
|
196
|
-
c.action do |args, options|
|
197
|
-
search=args[0]
|
198
|
-
s=Search.new
|
199
|
-
puts "Searching for [#{search}]:"
|
200
|
-
s.define(search)
|
201
|
-
s.related(search, result)
|
202
|
-
s.rhyme(search)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
command :define do |c|
|
207
|
-
c.syntax = 'lyracyst define [options]'
|
208
|
-
c.summary = 'Fetches definitions'
|
209
|
-
c.description = 'Uses the Wordnik API to get definitions'
|
210
|
-
c.example 'Uses the Wordnik API to get definitions', 'lyracyst define test'
|
211
|
-
c.action do |args, options|
|
212
|
-
search=args[0]
|
213
|
-
s=Search.new
|
214
|
-
puts "Searching for [#{search}]:"
|
215
|
-
s.define(search)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
command :related do |c|
|
220
|
-
c.syntax = 'lyracyst related [options]'
|
221
|
-
c.summary = 'Fetches related words'
|
222
|
-
c.description = 'Uses the Altervista API to get related words'
|
223
|
-
c.example 'Uses the Altervista API to get related words', 'lyracyst related test'
|
224
|
-
c.action do |args, options|
|
225
|
-
search=args[0]
|
226
|
-
s=Search.new
|
227
|
-
puts "Searching for [#{search}]:"
|
228
|
-
s.related(search)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
command :rhyme do |c|
|
233
|
-
c.syntax = 'lyracyst rhyme [options]'
|
234
|
-
c.summary = 'Fetches rhymes'
|
235
|
-
c.description = 'Uses the ARPABET system to get rhymes'
|
236
|
-
c.example 'Uses the ARPABET system to get rhymes', 'lyracyst rhyme test'
|
237
|
-
c.action do |args, options|
|
238
|
-
search=args[0]
|
239
|
-
s=Search.new
|
240
|
-
puts "Searching for [#{search}]:"
|
241
|
-
s.rhyme(search)
|
242
86
|
end
|
243
87
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#!/usr/bin/env ruby
|
3
|
+
# require 'configatron'
|
4
|
+
require 'multi_json'
|
5
|
+
require 'open-uri/cached'
|
6
|
+
|
7
|
+
module Lyracyst
|
8
|
+
# Handles tasks related to fetching queries
|
9
|
+
class Fetch
|
10
|
+
# Opens URL and returns the JSON response.
|
11
|
+
#
|
12
|
+
# @param url [String] The query URL
|
13
|
+
# @param result [String] The JSON response.
|
14
|
+
def search(url, result)
|
15
|
+
OpenURI::Cache.cache_path = 'tmp/open-uri'
|
16
|
+
uri = URI.parse(url)
|
17
|
+
status = uri.open.meta[:status]
|
18
|
+
if status[0] == '200'
|
19
|
+
result = uri.open.read
|
20
|
+
return result
|
21
|
+
else
|
22
|
+
puts "HTTP Status #{status[0]} #{status[1]}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
# Sets today's date and writes it with querycount to syncqc.json.
|
26
|
+
#
|
27
|
+
# @param dateint [Fixnum] Today's date in integer form.
|
28
|
+
# @param querycount [Fixnum] Number of daily queries in integer form.
|
29
|
+
def update(dateint, querycount)
|
30
|
+
qct = { 'date' => dateint, 'querycount' => querycount }
|
31
|
+
if File.exist?('json/synqc.json') == true
|
32
|
+
fo = File.open('json/synqc.json', "w+")
|
33
|
+
else
|
34
|
+
fo = File.new('json/synqc.json', "w+")
|
35
|
+
end
|
36
|
+
tofile = MultiJson.dump(qct)
|
37
|
+
fo.print tofile
|
38
|
+
fo.close
|
39
|
+
end
|
40
|
+
# Extracts related words from JSON response and prints them.
|
41
|
+
#
|
42
|
+
# @param x [Fixnum] Integer always set to zero.
|
43
|
+
# @param y [Fixnum] Number of items in resulta Array minus 1.
|
44
|
+
# @param resulta [Array] An array of values from JSON response.
|
45
|
+
def rel(x, y, resulta)
|
46
|
+
while x <= y
|
47
|
+
resultl = resulta[x]
|
48
|
+
list = resultl['list']
|
49
|
+
puts "Related words: #{list['category'].gsub(/\(|\)/, '')} - #{list['synonyms']}"
|
50
|
+
x += 1
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# Submits search term and parameters to Altervista.
|
54
|
+
# lang can be de_DE, el_GR, en_US, es_ES, fr_FR,
|
55
|
+
# it_IT, no_NO, pt_PT, ro_RO, ru_RU, or sk_SK.
|
56
|
+
# fmt only takes 'json' right now. This method calls
|
57
|
+
# {Fetch#search}, {Fetch#rel} and {Fetch#update}.
|
58
|
+
#
|
59
|
+
# @param search [String] The word or phrase to search for.
|
60
|
+
# @param dateint [Fixnum] Today's date.
|
61
|
+
# @param result [String] The JSON response.
|
62
|
+
# @param querycount [Fixnum] Number of queries today.
|
63
|
+
# @param lang [String] Search language code
|
64
|
+
# @param fmt [String] json or xml, currently just json.
|
65
|
+
def submit(search, dateint, result, querycount, lang, fmt)
|
66
|
+
urlprefix = 'http://thesaurus.altervista.org/thesaurus/v1'
|
67
|
+
apikey = ENV['THESAURUS']
|
68
|
+
url = "#{urlprefix}?key=#{apikey}&word=#{search}&language=#{lang}&output=#{fmt}"
|
69
|
+
#if environment == 'javascript'
|
70
|
+
#url = "#{url}&callback=synonymSearch"
|
71
|
+
#end
|
72
|
+
f = Lyracyst::Fetch.new
|
73
|
+
resultj = f.search(url, result)
|
74
|
+
resultp = MultiJson.load(resultj)
|
75
|
+
resulta = resultp['response']
|
76
|
+
x = 0
|
77
|
+
y = resulta.length - 1
|
78
|
+
f.rel(x, y, resulta)
|
79
|
+
querycount += 1
|
80
|
+
#f.update(dateint, querycount) # FIXME Won't run in Aruba/Cucumber
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#!/usr/bin/env ruby
|
3
|
+
# require 'configatron'
|
4
|
+
require 'multi_json'
|
5
|
+
require 'wordnik'
|
6
|
+
|
7
|
+
module Lyracyst
|
8
|
+
# Defines three methods for submitting queries.
|
9
|
+
class Search
|
10
|
+
# Altervista.org's thesaurus service provides related words.
|
11
|
+
# The service limits each API key to 5000 queries a day. If
|
12
|
+
# maximum number of queries has been reached, this methods
|
13
|
+
# will exit. Search language can be it_IT, fr_FR, de_DE,
|
14
|
+
# en_US, el_GR, es_ES, de_DE, no_NO, pt_PT, ro_RO, ru_RU,
|
15
|
+
# sk_SK. This method calls {Fetch#update} and {Fetch#submit}.
|
16
|
+
#
|
17
|
+
# @param search [String] The word or phrase to search for.
|
18
|
+
# @param result [Array] The JSON response.
|
19
|
+
# @param lang [String] Search language code.
|
20
|
+
# @param fmt [String] json or xml, currently just json.
|
21
|
+
def related(search, result, lang, fmt)
|
22
|
+
environment = 'ruby'
|
23
|
+
maxqueries = 5000
|
24
|
+
querycount = 0
|
25
|
+
t = Time.now
|
26
|
+
y = t.year.to_s
|
27
|
+
m = t.month
|
28
|
+
d = t.day
|
29
|
+
if m < 10 then m = "0#{m}" else m = m.to_s; end
|
30
|
+
if d < 10 then d = "0#{d}" else d = d.to_s; end
|
31
|
+
date = "#{y}#{m}#{d}"
|
32
|
+
dateint = date.to_i
|
33
|
+
if File.exist?('json/synqc.json') == true
|
34
|
+
rl = File.readlines('json/synqc.json')
|
35
|
+
rl = rl[0]
|
36
|
+
loadrl = MultiJson.load(rl)
|
37
|
+
testdate = loadrl['date']
|
38
|
+
testcount = loadrl['querycount']
|
39
|
+
pdateint = testdate.to_i
|
40
|
+
if dateint > pdateint == true
|
41
|
+
f = Lyracyst::Fetch.new
|
42
|
+
f.update(dateint, querycount)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
testcount = 0
|
46
|
+
end
|
47
|
+
if testcount < maxqueries
|
48
|
+
f = Lyracyst::Fetch.new
|
49
|
+
f.submit(search, dateint, result, querycount, lang, fmt)
|
50
|
+
else
|
51
|
+
puts 'Max queries per day has been reached.'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
# Wordnik.com's service provides definitions. The logger
|
55
|
+
# defaults to Rails.logger or Logger.new(STDOUT). Set to
|
56
|
+
# Logger.new('/dev/null') to disable logging.
|
57
|
+
#
|
58
|
+
# @param search [String] The word or phrase to search for.
|
59
|
+
def define(search)
|
60
|
+
apikey = ENV['WORDNIK']
|
61
|
+
Wordnik.configure do |cfg|
|
62
|
+
cfg.api_key = apikey
|
63
|
+
cfg.response_format = 'json'
|
64
|
+
cfg.logger = Logger.new('/dev/null')
|
65
|
+
end
|
66
|
+
define = Wordnik.word.get_definitions(search)
|
67
|
+
if define != ''
|
68
|
+
define.map { |defi|
|
69
|
+
text = defi['text']
|
70
|
+
# att = defi['attributionText']
|
71
|
+
part = defi['partOfSpeech']
|
72
|
+
puts "Definition: #{part} - #{text}"
|
73
|
+
# puts "Definition: #{part} - #{text} - #{att}" #With attribution
|
74
|
+
}
|
75
|
+
else
|
76
|
+
puts 'Wordnik returned an empty string.'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
# ARPA created ARPABET decades ago to find words that
|
80
|
+
# rhyme. The technology is still quite relevant today.
|
81
|
+
# This program uses the Heroku app based on ARPABET.
|
82
|
+
# This method calls {Fetch#search}.
|
83
|
+
#
|
84
|
+
# @param search [String] The word or phrase to search for.
|
85
|
+
def rhyme(search, result)
|
86
|
+
url = "http://arpabet.heroku.com/words/#{search}"
|
87
|
+
f = Lyracyst::Fetch.new
|
88
|
+
result = f.search(url, result)
|
89
|
+
puts "Rhymes with: #{result}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lyracyst
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drew Prentice
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: configatron
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: multi_json
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0.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: '10.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.3'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: wordnik
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +94,48 @@ dependencies:
|
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '4.12'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aruba
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.5'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: coveralls
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.7'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: cucumber
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.3'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.3'
|
69
139
|
description: Search Wordnik, thesaurus.altervista.org, and Arpabet from the command
|
70
140
|
line.
|
71
141
|
email:
|
@@ -76,11 +146,10 @@ extensions: []
|
|
76
146
|
extra_rdoc_files: []
|
77
147
|
files:
|
78
148
|
- bin/lyracyst
|
79
|
-
- changelog.md
|
80
149
|
- lib/lyracyst.rb
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
150
|
+
- lib/lyracyst/fetch.rb
|
151
|
+
- lib/lyracyst/search.rb
|
152
|
+
- lib/lyracyst/version.rb
|
84
153
|
homepage: http://github.com/weirdpercent/lyracyst
|
85
154
|
licenses:
|
86
155
|
- MIT
|
data/changelog.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
Changelog
|
2
|
-
===
|
3
|
-
|
4
|
-
Version 0.0.5 - Basic documentation
|
5
|
-
- Command-line interface works
|
6
|
-
- No more Code Climate because it doesn't like commander gem
|
7
|
-
- Fixed /bin executable
|
8
|
-
|
9
|
-
Version 0.0.1 - Feature complete
|
10
|
-
- Ruby environment works
|
11
|
-
- Secure Travis build works
|
12
|
-
- JSON data handling works
|
13
|
-
- Definitions work
|
14
|
-
- Related words work
|
15
|
-
- Thesaurus daily query limit enforced
|
16
|
-
- Rhymes work
|
17
|
-
- Improved Code Climate
|
data/license.md
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
========
|
3
|
-
|
4
|
-
**Copyright (c) 2014 Drew Prentice**
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
8
|
-
in the Software without restriction, including without limitation the rights
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
11
|
-
furnished to do so, subject to the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
14
|
-
copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
SOFTWARE.**
|
data/readme.md
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
lyracyst
|
2
|
-
===
|
3
|
-
|
4
|
-
[](http://en.wikipedia.org/wiki/File:Lyra_constellation_detail_long_exposure.jpg)
|
5
|
-
|
6
|
-
Constellation Lyra photo by [Scott Roy Atwood](http://en.wikipedia.org/wiki/File:Lyra_constellation_detail_long_exposure.jpg)
|
7
|
-
|
8
|
-
[](https://travis-ci.org/weirdpercent/lyracyst)[](http://badge.fury.io/rb/lyracyst)[](https://gemnasium.com/weirdpercent/lyracyst)
|
9
|
-
|
10
|
-
A powerful word search tool for writers of all kinds.
|
11
|
-
|
12
|
-
### Synopsis
|
13
|
-
|
14
|
-
Search [Wordnik](http://www.wordnik.com/), [thesaurus.altervista.org](http://thesaurus.altervista.org/), and [Arpabet](http://en.wikipedia.org/wiki/Arpabet) from the command line. Get API search keys as follows:
|
15
|
-
Altervista - http://thesaurus.altervista.org/mykey
|
16
|
-
Wordnik - http://developer.wordnik.com/
|
17
|
-
Put them in environment variables THESAURUS and WORDNIK respectively. Adding these to .bashrc or .zshrc is the easiest way.
|
18
|
-
|
19
|
-
### Features
|
20
|
-
|
21
|
-
- Open URI fetching w/ transparent caching
|
22
|
-
- Definitions from Wordnik
|
23
|
-
- Rhymes from arpabet.heroku.com
|
24
|
-
- Related words from thesaurus.altervista.org
|
25
|
-
- JSON parsing
|
26
|
-
|
27
|
-
### Usage
|
28
|
-
|
29
|
-
gem install lyracyst
|
30
|
-
lyracyst get test
|
31
|
-
|
32
|
-
### Code Example
|
33
|
-
|
34
|
-
s=Search.new
|
35
|
-
s.define(search) # Wordnik definitions
|
36
|
-
s.related(search, result) # Altervista related words
|
37
|
-
s.rhyme(search) # Arpabet rhymes
|
38
|
-
|
39
|
-
### Motivation
|
40
|
-
|
41
|
-
I do a lot of writing and I wanted a tool for constructing song lyrics, poetry, and stories that rock.
|
42
|
-
|
43
|
-
### Tests
|
44
|
-
|
45
|
-
TODO
|
46
|
-
|
47
|
-
### Developers
|
48
|
-
|
49
|
-
bundle install
|
50
|
-
rake lyracyst:get[test]
|
51
|
-
|
52
|
-
### Contributing workflow
|
53
|
-
|
54
|
-
Here’s how we suggest you go about proposing a change to this project:
|
55
|
-
|
56
|
-
1. [Fork this project][fork] to your account.
|
57
|
-
2. [Create a branch][branch] for the change you intend to make.
|
58
|
-
3. Make your changes to your fork.
|
59
|
-
4. [Send a pull request][pr] from your fork’s branch to our `master` branch.
|
60
|
-
|
61
|
-
Using the web-based interface to make changes is fine too, and will help you
|
62
|
-
by automatically forking the project and prompting to send a pull request too.
|
63
|
-
|
64
|
-
[fork]: http://help.github.com/forking/
|
65
|
-
[branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository
|
66
|
-
[pr]: http://help.github.com/pull-requests/
|
67
|
-
|
68
|
-
### License
|
69
|
-
|
70
|
-
The MIT License (MIT)
|
71
|
-
|
72
|
-
**Copyright (c) 2014 Drew Prentice**
|
73
|
-
|
74
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
75
|
-
of this software and associated documentation files (the "Software"), to deal
|
76
|
-
in the Software without restriction, including without limitation the rights
|
77
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
78
|
-
copies of the Software, and to permit persons to whom the Software is
|
79
|
-
furnished to do so, subject to the following conditions:
|
80
|
-
|
81
|
-
The above copyright notice and this permission notice shall be included in all
|
82
|
-
copies or substantial portions of the Software.
|
83
|
-
|
84
|
-
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
85
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
86
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
87
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
88
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
89
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
90
|
-
SOFTWARE.**
|
91
|
-
|
92
|
-
### Gratitude
|
93
|
-
|
94
|
-
Many thanks to all contributors to the gems used in this project!
|
data/scaffold.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
### Generate eye-popping scaffolds for rails
|
2
|
-
|
3
|
-
rails g beautiful_scaffold scaffoldname title:string id:integer calc:float about:text cost:price rainbow:color doc:richtext markup:wysiwyg
|
4
|
-
|
5
|
-
Types available:
|
6
|
-
|
7
|
-
- integer
|
8
|
-
- float
|
9
|
-
- text
|
10
|
-
- string
|
11
|
-
- price
|
12
|
-
- color
|
13
|
-
- richtext
|
14
|
-
- wysiwyg
|