shindan 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/GPL3.txt +282 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +51 -0
- data/Rakefile +49 -0
- data/VERSION +1 -1
- data/bin/shindan +29 -0
- data/bin/shindan-open +28 -0
- data/lib/shindan.rb +80 -0
- data/spec/shindan_spec.rb +4 -0
- data/spec/spec_helper.rb +12 -0
- metadata +39 -27
data/.document
ADDED
data/GPL3.txt
ADDED
@@ -0,0 +1,282 @@
|
|
1
|
+
|
2
|
+
GNU GENERAL PUBLIC LICENSE
|
3
|
+
Version 2, June 1991
|
4
|
+
|
5
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
6
|
+
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
7
|
+
Everyone is permitted to copy and distribute verbatim copies
|
8
|
+
of this license document, but changing it is not allowed.
|
9
|
+
|
10
|
+
Preamble
|
11
|
+
|
12
|
+
The licenses for most software are designed to take away your
|
13
|
+
freedom to share and change it. By contrast, the GNU General Public
|
14
|
+
License is intended to guarantee your freedom to share and change free
|
15
|
+
software--to make sure the software is free for all its users. This
|
16
|
+
General Public License applies to most of the Free Software
|
17
|
+
Foundation's software and to any other program whose authors commit to
|
18
|
+
using it. (Some other Free Software Foundation software is covered by
|
19
|
+
the GNU Library General Public License instead.) You can apply it to
|
20
|
+
your programs, too.
|
21
|
+
|
22
|
+
When we speak of free software, we are referring to freedom, not
|
23
|
+
price. Our General Public Licenses are designed to make sure that you
|
24
|
+
have the freedom to distribute copies of free software (and charge for
|
25
|
+
this service if you wish), that you receive source code or can get it
|
26
|
+
if you want it, that you can change the software or use pieces of it
|
27
|
+
in new free programs; and that you know you can do these things.
|
28
|
+
|
29
|
+
To protect your rights, we need to make restrictions that forbid
|
30
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
31
|
+
These restrictions translate to certain responsibilities for you if you
|
32
|
+
distribute copies of the software, or if you modify it.
|
33
|
+
|
34
|
+
For example, if you distribute copies of such a program, whether
|
35
|
+
gratis or for a fee, you must give the recipients all the rights that
|
36
|
+
you have. You must make sure that they, too, receive or can get the
|
37
|
+
source code. And you must show them these terms so they know their
|
38
|
+
rights.
|
39
|
+
|
40
|
+
We protect your rights with two steps: (1) copyright the software, and
|
41
|
+
(2) offer you this license which gives you legal permission to copy,
|
42
|
+
distribute and/or modify the software.
|
43
|
+
|
44
|
+
Also, for each author's protection and ours, we want to make certain
|
45
|
+
that everyone understands that there is no warranty for this free
|
46
|
+
software. If the software is modified by someone else and passed on, we
|
47
|
+
want its recipients to know that what they have is not the original, so
|
48
|
+
that any problems introduced by others will not reflect on the original
|
49
|
+
authors' reputations.
|
50
|
+
|
51
|
+
Finally, any free program is threatened constantly by software
|
52
|
+
patents. We wish to avoid the danger that redistributors of a free
|
53
|
+
program will individually obtain patent licenses, in effect making the
|
54
|
+
program proprietary. To prevent this, we have made it clear that any
|
55
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
56
|
+
|
57
|
+
The precise terms and conditions for copying, distribution and
|
58
|
+
modification follow.
|
59
|
+
|
60
|
+
GNU GENERAL PUBLIC LICENSE
|
61
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
62
|
+
|
63
|
+
0. This License applies to any program or other work which contains
|
64
|
+
a notice placed by the copyright holder saying it may be distributed
|
65
|
+
under the terms of this General Public License. The "Program", below,
|
66
|
+
refers to any such program or work, and a "work based on the Program"
|
67
|
+
means either the Program or any derivative work under copyright law:
|
68
|
+
that is to say, a work containing the Program or a portion of it,
|
69
|
+
either verbatim or with modifications and/or translated into another
|
70
|
+
language. (Hereinafter, translation is included without limitation in
|
71
|
+
the term "modification".) Each licensee is addressed as "you".
|
72
|
+
|
73
|
+
Activities other than copying, distribution and modification are not
|
74
|
+
covered by this License; they are outside its scope. The act of
|
75
|
+
running the Program is not restricted, and the output from the Program
|
76
|
+
is covered only if its contents constitute a work based on the
|
77
|
+
Program (independent of having been made by running the Program).
|
78
|
+
Whether that is true depends on what the Program does.
|
79
|
+
|
80
|
+
1. You may copy and distribute verbatim copies of the Program's
|
81
|
+
source code as you receive it, in any medium, provided that you
|
82
|
+
conspicuously and appropriately publish on each copy an appropriate
|
83
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
84
|
+
notices that refer to this License and to the absence of any warranty;
|
85
|
+
and give any other recipients of the Program a copy of this License
|
86
|
+
along with the Program.
|
87
|
+
|
88
|
+
You may charge a fee for the physical act of transferring a copy, and
|
89
|
+
you may at your option offer warranty protection in exchange for a fee.
|
90
|
+
|
91
|
+
2. You may modify your copy or copies of the Program or any portion
|
92
|
+
of it, thus forming a work based on the Program, and copy and
|
93
|
+
distribute such modifications or work under the terms of Section 1
|
94
|
+
above, provided that you also meet all of these conditions:
|
95
|
+
|
96
|
+
a) You must cause the modified files to carry prominent notices
|
97
|
+
stating that you changed the files and the date of any change.
|
98
|
+
|
99
|
+
b) You must cause any work that you distribute or publish, that in
|
100
|
+
whole or in part contains or is derived from the Program or any
|
101
|
+
part thereof, to be licensed as a whole at no charge to all third
|
102
|
+
parties under the terms of this License.
|
103
|
+
|
104
|
+
c) If the modified program normally reads commands interactively
|
105
|
+
when run, you must cause it, when started running for such
|
106
|
+
interactive use in the most ordinary way, to print or display an
|
107
|
+
announcement including an appropriate copyright notice and a
|
108
|
+
notice that there is no warranty (or else, saying that you provide
|
109
|
+
a warranty) and that users may redistribute the program under
|
110
|
+
these conditions, and telling the user how to view a copy of this
|
111
|
+
License. (Exception: if the Program itself is interactive but
|
112
|
+
does not normally print such an announcement, your work based on
|
113
|
+
the Program is not required to print an announcement.)
|
114
|
+
|
115
|
+
These requirements apply to the modified work as a whole. If
|
116
|
+
identifiable sections of that work are not derived from the Program,
|
117
|
+
and can be reasonably considered independent and separate works in
|
118
|
+
themselves, then this License, and its terms, do not apply to those
|
119
|
+
sections when you distribute them as separate works. But when you
|
120
|
+
distribute the same sections as part of a whole which is a work based
|
121
|
+
on the Program, the distribution of the whole must be on the terms of
|
122
|
+
this License, whose permissions for other licensees extend to the
|
123
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
124
|
+
|
125
|
+
Thus, it is not the intent of this section to claim rights or contest
|
126
|
+
your rights to work written entirely by you; rather, the intent is to
|
127
|
+
exercise the right to control the distribution of derivative or
|
128
|
+
collective works based on the Program.
|
129
|
+
|
130
|
+
In addition, mere aggregation of another work not based on the Program
|
131
|
+
with the Program (or with a work based on the Program) on a volume of
|
132
|
+
a storage or distribution medium does not bring the other work under
|
133
|
+
the scope of this License.
|
134
|
+
|
135
|
+
3. You may copy and distribute the Program (or a work based on it,
|
136
|
+
under Section 2) in object code or executable form under the terms of
|
137
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
138
|
+
|
139
|
+
a) Accompany it with the complete corresponding machine-readable
|
140
|
+
source code, which must be distributed under the terms of Sections
|
141
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
142
|
+
|
143
|
+
b) Accompany it with a written offer, valid for at least three
|
144
|
+
years, to give any third party, for a charge no more than your
|
145
|
+
cost of physically performing source distribution, a complete
|
146
|
+
machine-readable copy of the corresponding source code, to be
|
147
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
148
|
+
customarily used for software interchange; or,
|
149
|
+
|
150
|
+
c) Accompany it with the information you received as to the offer
|
151
|
+
to distribute corresponding source code. (This alternative is
|
152
|
+
allowed only for noncommercial distribution and only if you
|
153
|
+
received the program in object code or executable form with such
|
154
|
+
an offer, in accord with Subsection b above.)
|
155
|
+
|
156
|
+
The source code for a work means the preferred form of the work for
|
157
|
+
making modifications to it. For an executable work, complete source
|
158
|
+
code means all the source code for all modules it contains, plus any
|
159
|
+
associated interface definition files, plus the scripts used to
|
160
|
+
control compilation and installation of the executable. However, as a
|
161
|
+
special exception, the source code distributed need not include
|
162
|
+
anything that is normally distributed (in either source or binary
|
163
|
+
form) with the major components (compiler, kernel, and so on) of the
|
164
|
+
operating system on which the executable runs, unless that component
|
165
|
+
itself accompanies the executable.
|
166
|
+
|
167
|
+
If distribution of executable or object code is made by offering
|
168
|
+
access to copy from a designated place, then offering equivalent
|
169
|
+
access to copy the source code from the same place counts as
|
170
|
+
distribution of the source code, even though third parties are not
|
171
|
+
compelled to copy the source along with the object code.
|
172
|
+
|
173
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
174
|
+
except as expressly provided under this License. Any attempt
|
175
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
176
|
+
void, and will automatically terminate your rights under this License.
|
177
|
+
However, parties who have received copies, or rights, from you under
|
178
|
+
this License will not have their licenses terminated so long as such
|
179
|
+
parties remain in full compliance.
|
180
|
+
|
181
|
+
5. You are not required to accept this License, since you have not
|
182
|
+
signed it. However, nothing else grants you permission to modify or
|
183
|
+
distribute the Program or its derivative works. These actions are
|
184
|
+
prohibited by law if you do not accept this License. Therefore, by
|
185
|
+
modifying or distributing the Program (or any work based on the
|
186
|
+
Program), you indicate your acceptance of this License to do so, and
|
187
|
+
all its terms and conditions for copying, distributing or modifying
|
188
|
+
the Program or works based on it.
|
189
|
+
|
190
|
+
6. Each time you redistribute the Program (or any work based on the
|
191
|
+
Program), the recipient automatically receives a license from the
|
192
|
+
original licensor to copy, distribute or modify the Program subject to
|
193
|
+
these terms and conditions. You may not impose any further
|
194
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
195
|
+
You are not responsible for enforcing compliance by third parties to
|
196
|
+
this License.
|
197
|
+
|
198
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
199
|
+
infringement or for any other reason (not limited to patent issues),
|
200
|
+
conditions are imposed on you (whether by court order, agreement or
|
201
|
+
otherwise) that contradict the conditions of this License, they do not
|
202
|
+
excuse you from the conditions of this License. If you cannot
|
203
|
+
distribute so as to satisfy simultaneously your obligations under this
|
204
|
+
License and any other pertinent obligations, then as a consequence you
|
205
|
+
may not distribute the Program at all. For example, if a patent
|
206
|
+
license would not permit royalty-free redistribution of the Program by
|
207
|
+
all those who receive copies directly or indirectly through you, then
|
208
|
+
the only way you could satisfy both it and this License would be to
|
209
|
+
refrain entirely from distribution of the Program.
|
210
|
+
|
211
|
+
If any portion of this section is held invalid or unenforceable under
|
212
|
+
any particular circumstance, the balance of the section is intended to
|
213
|
+
apply and the section as a whole is intended to apply in other
|
214
|
+
circumstances.
|
215
|
+
|
216
|
+
It is not the purpose of this section to induce you to infringe any
|
217
|
+
patents or other property right claims or to contest validity of any
|
218
|
+
such claims; this section has the sole purpose of protecting the
|
219
|
+
integrity of the free software distribution system, which is
|
220
|
+
implemented by public license practices. Many people have made
|
221
|
+
generous contributions to the wide range of software distributed
|
222
|
+
through that system in reliance on consistent application of that
|
223
|
+
system; it is up to the author/donor to decide if he or she is willing
|
224
|
+
to distribute software through any other system and a licensee cannot
|
225
|
+
impose that choice.
|
226
|
+
|
227
|
+
This section is intended to make thoroughly clear what is believed to
|
228
|
+
be a consequence of the rest of this License.
|
229
|
+
|
230
|
+
8. If the distribution and/or use of the Program is restricted in
|
231
|
+
certain countries either by patents or by copyrighted interfaces, the
|
232
|
+
original copyright holder who places the Program under this License
|
233
|
+
may add an explicit geographical distribution limitation excluding
|
234
|
+
those countries, so that distribution is permitted only in or among
|
235
|
+
countries not thus excluded. In such case, this License incorporates
|
236
|
+
the limitation as if written in the body of this License.
|
237
|
+
|
238
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
239
|
+
of the General Public License from time to time. Such new versions will
|
240
|
+
be similar in spirit to the present version, but may differ in detail to
|
241
|
+
address new problems or concerns.
|
242
|
+
|
243
|
+
Each version is given a distinguishing version number. If the Program
|
244
|
+
specifies a version number of this License which applies to it and "any
|
245
|
+
later version", you have the option of following the terms and conditions
|
246
|
+
either of that version or of any later version published by the Free
|
247
|
+
Software Foundation. If the Program does not specify a version number of
|
248
|
+
this License, you may choose any version ever published by the Free Software
|
249
|
+
Foundation.
|
250
|
+
|
251
|
+
10. If you wish to incorporate parts of the Program into other free
|
252
|
+
programs whose distribution conditions are different, write to the author
|
253
|
+
to ask for permission. For software which is copyrighted by the Free
|
254
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
255
|
+
make exceptions for this. Our decision will be guided by the two goals
|
256
|
+
of preserving the free status of all derivatives of our free software and
|
257
|
+
of promoting the sharing and reuse of software generally.
|
258
|
+
|
259
|
+
NO WARRANTY
|
260
|
+
|
261
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
262
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
263
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
264
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
265
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
266
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
267
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
268
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
269
|
+
REPAIR OR CORRECTION.
|
270
|
+
|
271
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
272
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
273
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
274
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
275
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
276
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
277
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
278
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
279
|
+
POSSIBILITY OF SUCH DAMAGES.
|
280
|
+
|
281
|
+
END OF TERMS AND CONDITIONS
|
282
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "mechanize"
|
7
|
+
|
8
|
+
|
9
|
+
# Add dependencies to develop your gem here.
|
10
|
+
# Include everything needed to run rake, tests, features, etc.
|
11
|
+
group :development do
|
12
|
+
gem "rspec", "~> 2.8.0"
|
13
|
+
gem "rdoc", "~> 3.12"
|
14
|
+
gem "bundler", "~> 1.0.0"
|
15
|
+
gem "jeweler", "~> 1.8.3"
|
16
|
+
gem "rcov", ">= 0"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
domain_name (0.5.2)
|
6
|
+
unf (~> 0.0.3)
|
7
|
+
git (1.2.5)
|
8
|
+
jeweler (1.8.3)
|
9
|
+
bundler (~> 1.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rake
|
12
|
+
rdoc
|
13
|
+
json (1.6.5)
|
14
|
+
mechanize (2.1)
|
15
|
+
domain_name (~> 0.5, >= 0.5.1)
|
16
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
17
|
+
net-http-persistent (~> 2.3, >= 2.3.2)
|
18
|
+
nokogiri (~> 1.4)
|
19
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
20
|
+
webrobots (~> 0.0, >= 0.0.9)
|
21
|
+
net-http-digest_auth (1.2)
|
22
|
+
net-http-persistent (2.4)
|
23
|
+
nokogiri (1.5.0)
|
24
|
+
ntlm-http (0.1.1)
|
25
|
+
rake (0.9.2.2)
|
26
|
+
rcov (1.0.0)
|
27
|
+
rdoc (3.12)
|
28
|
+
json (~> 1.4)
|
29
|
+
rspec (2.8.0)
|
30
|
+
rspec-core (~> 2.8.0)
|
31
|
+
rspec-expectations (~> 2.8.0)
|
32
|
+
rspec-mocks (~> 2.8.0)
|
33
|
+
rspec-core (2.8.0)
|
34
|
+
rspec-expectations (2.8.0)
|
35
|
+
diff-lcs (~> 1.1.2)
|
36
|
+
rspec-mocks (2.8.0)
|
37
|
+
unf (0.0.4)
|
38
|
+
unf_ext
|
39
|
+
unf_ext (0.0.4)
|
40
|
+
webrobots (0.0.13)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
bundler (~> 1.0.0)
|
47
|
+
jeweler (~> 1.8.3)
|
48
|
+
mechanize
|
49
|
+
rcov
|
50
|
+
rdoc (~> 3.12)
|
51
|
+
rspec (~> 2.8.0)
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "shindan"
|
18
|
+
gem.homepage = "http://github.com/yasuhito/shindan"
|
19
|
+
gem.license = "GPL3"
|
20
|
+
gem.summary = %Q{shindan maker for Ruby}
|
21
|
+
gem.description = %Q{shindan maker (http://shindanmaker.com/) wrapper library}
|
22
|
+
gem.email = "yasuhito@gmail.com"
|
23
|
+
gem.authors = ["Yasuhito Takamiya"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "shindan #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bin/shindan
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# 引数に診断したい名前を渡すと、診断結果を標準出力に出します。
|
5
|
+
#
|
6
|
+
# % ./bin/shindan "高宮 安仁"
|
7
|
+
# 高宮 安仁が生まれてきた使命・・・『地 球 に 降 り 注 ぐ 隕 石 を 食 い 止 め 人 類 を 滅 亡 か ら 救 う 為』
|
8
|
+
#
|
9
|
+
# 診断を変えたいときには、診断メーカーの URL の最後の数字、たとえば
|
10
|
+
# http://shindanmaker.com/189037 であれば 189037 の部分を第二引数に渡してください。
|
11
|
+
#
|
12
|
+
# % ./bin/shindan "高宮 安仁" 189037
|
13
|
+
#
|
14
|
+
|
15
|
+
|
16
|
+
$LOAD_PATH.unshift File.expand_path( File.join File.dirname( __FILE__ ), "..", "lib" )
|
17
|
+
|
18
|
+
|
19
|
+
require "shindan"
|
20
|
+
|
21
|
+
|
22
|
+
DEFAULT_SHINDAN_ID = 163723
|
23
|
+
|
24
|
+
|
25
|
+
if ARGV[ 0 ].nil?
|
26
|
+
puts "Usage: #{ __FILE__ } YOUR_NAME [SHINDAN_ID]"
|
27
|
+
exit false
|
28
|
+
end
|
29
|
+
puts Shindan.new( ARGV[ 1 ] || DEFAULT_SHINDAN_ID ).get( ARGV[ 0 ] )
|
data/bin/shindan-open
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# 引数に診断したい名前を渡すと、診断結果をブラウザで開きます。
|
5
|
+
#
|
6
|
+
# % ./bin/shindan-open "高宮 安仁"
|
7
|
+
#
|
8
|
+
# 診断を変えたいときには、診断メーカーの URL の最後の数字、たとえば
|
9
|
+
# http://shindanmaker.com/189037 であれば 189037 の部分を第二引数に渡してください。
|
10
|
+
#
|
11
|
+
# % ./bin/shindan-open "高宮 安仁" 189037
|
12
|
+
#
|
13
|
+
|
14
|
+
|
15
|
+
$LOAD_PATH.unshift File.expand_path( File.join File.dirname( __FILE__ ), "..", "lib" )
|
16
|
+
|
17
|
+
|
18
|
+
require "shindan"
|
19
|
+
|
20
|
+
|
21
|
+
DEFAULT_SHINDAN_ID = 163723
|
22
|
+
|
23
|
+
|
24
|
+
if ARGV[ 0 ].nil?
|
25
|
+
puts "Usage: #{ __FILE__ } YOUR_NAME [SHINDAN_ID]"
|
26
|
+
exit false
|
27
|
+
end
|
28
|
+
Shindan.new( ARGV[ 1 ] || DEFAULT_SHINDAN_ID ).open ARGV[ 0 ]
|
data/lib/shindan.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
require "kconv"
|
4
|
+
require "mechanize"
|
5
|
+
require "tempfile"
|
6
|
+
|
7
|
+
|
8
|
+
class Shindan
|
9
|
+
URL = "http://shindanmaker.com/"
|
10
|
+
|
11
|
+
|
12
|
+
def initialize shindan_id
|
13
|
+
@shindan_id = shindan_id
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def get name
|
18
|
+
shindan( name ).search( "div.result" ).inner_text.strip
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def open name
|
23
|
+
system "x-www-browser #{ temp_html shindan( name ).body }"
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
##############################################################################
|
28
|
+
private
|
29
|
+
##############################################################################
|
30
|
+
|
31
|
+
|
32
|
+
def css
|
33
|
+
"#{ URL }/css/pc8.css"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def logo
|
38
|
+
"#{ URL }/img/logo_head.png"
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def hatena_haiku
|
43
|
+
"#{ URL }/img/hatenahaiku.png"
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def mixi_voice
|
48
|
+
"#{ URL }/img/mixivoice.png"
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def shindan name
|
53
|
+
agent = Mechanize.new
|
54
|
+
agent.get "#{ URL }/#{ @shindan_id }"
|
55
|
+
agent.page.form_with( :name => "enter" ) do | form |
|
56
|
+
form[ "u" ] = name.toutf8
|
57
|
+
form.click_button
|
58
|
+
end
|
59
|
+
agent.page
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def temp_html body
|
64
|
+
t = Tempfile.new( "shindan" )
|
65
|
+
t.puts rewrite( body )
|
66
|
+
t.close
|
67
|
+
html = t.path + ".html"
|
68
|
+
FileUtils.mv t.path, html
|
69
|
+
html
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
def rewrite body
|
74
|
+
result = body.dup
|
75
|
+
result.gsub! /\/css\/pc8\.css/, css
|
76
|
+
result.gsub! /\/img\/logo_head\.png/, logo
|
77
|
+
result.gsub! /\/img\/mixivoice\.png/, mixi_voice
|
78
|
+
result.gsub! /\/img\/hatenahaiku\.png/, hatena_haiku
|
79
|
+
end
|
80
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'shindan'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shindan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yasuhito Takamiya
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-03 00:00:00
|
18
|
+
date: 2012-02-03 00:00:00 +09:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
prerelease: false
|
22
|
+
type: :runtime
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
@@ -29,11 +29,11 @@ dependencies:
|
|
29
29
|
segments:
|
30
30
|
- 0
|
31
31
|
version: "0"
|
32
|
-
|
32
|
+
name: mechanize
|
33
33
|
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rspec
|
36
34
|
prerelease: false
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
type: :development
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
39
39
|
requirements:
|
@@ -45,11 +45,11 @@ dependencies:
|
|
45
45
|
- 8
|
46
46
|
- 0
|
47
47
|
version: 2.8.0
|
48
|
-
|
48
|
+
name: rspec
|
49
49
|
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rdoc
|
52
50
|
prerelease: false
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
type: :development
|
53
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
@@ -60,11 +60,11 @@ dependencies:
|
|
60
60
|
- 3
|
61
61
|
- 12
|
62
62
|
version: "3.12"
|
63
|
-
|
63
|
+
name: rdoc
|
64
64
|
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: bundler
|
67
65
|
prerelease: false
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
type: :development
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
@@ -76,11 +76,11 @@ dependencies:
|
|
76
76
|
- 0
|
77
77
|
- 0
|
78
78
|
version: 1.0.0
|
79
|
-
|
79
|
+
name: bundler
|
80
80
|
version_requirements: *id004
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: jeweler
|
83
81
|
prerelease: false
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
type: :development
|
84
84
|
requirement: &id005 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
@@ -92,11 +92,11 @@ dependencies:
|
|
92
92
|
- 8
|
93
93
|
- 3
|
94
94
|
version: 1.8.3
|
95
|
-
|
95
|
+
name: jeweler
|
96
96
|
version_requirements: *id005
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rcov
|
99
97
|
prerelease: false
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
type: :development
|
100
100
|
requirement: &id006 !ruby/object:Gem::Requirement
|
101
101
|
none: false
|
102
102
|
requirements:
|
@@ -106,19 +106,32 @@ dependencies:
|
|
106
106
|
segments:
|
107
107
|
- 0
|
108
108
|
version: "0"
|
109
|
-
|
109
|
+
name: rcov
|
110
110
|
version_requirements: *id006
|
111
|
+
prerelease: false
|
111
112
|
description: shindan maker (http://shindanmaker.com/) wrapper library
|
112
113
|
email: yasuhito@gmail.com
|
113
|
-
executables:
|
114
|
-
|
114
|
+
executables:
|
115
|
+
- shindan-open
|
116
|
+
- shindan
|
115
117
|
extensions: []
|
116
118
|
|
117
119
|
extra_rdoc_files:
|
118
120
|
- README.md
|
119
121
|
files:
|
120
|
-
-
|
122
|
+
- .document
|
123
|
+
- GPL3.txt
|
124
|
+
- Gemfile
|
125
|
+
- Gemfile.lock
|
121
126
|
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- VERSION
|
129
|
+
- bin/shindan
|
130
|
+
- bin/shindan-open
|
131
|
+
- lib/shindan.rb
|
132
|
+
- spec/shindan_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
has_rdoc: true
|
122
135
|
homepage: http://github.com/yasuhito/shindan
|
123
136
|
licenses:
|
124
137
|
- GPL3
|
@@ -148,10 +161,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
161
|
requirements: []
|
149
162
|
|
150
163
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.
|
164
|
+
rubygems_version: 1.6.2
|
152
165
|
signing_key:
|
153
166
|
specification_version: 3
|
154
167
|
summary: shindan maker for Ruby
|
155
168
|
test_files: []
|
156
169
|
|
157
|
-
has_rdoc:
|