otokonoramen500yen 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2011-04-27
2
+
3
+ * created
4
+
data/Manifest.txt ADDED
@@ -0,0 +1,12 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ lib/otokonoramen500yen.rb
6
+ script/console
7
+ script/destroy
8
+ script/generate
9
+ test/test_helper.rb
10
+ test/test_otokonoramen500yen.rb
11
+ bin/otokonoramen500yen
12
+
data/README.rdoc ADDED
@@ -0,0 +1,44 @@
1
+ = otokonoramen500yen
2
+
3
+ * http://github.com/shokai/ruby-otokonoramen500yen
4
+
5
+ == DESCRIPTION:
6
+
7
+ 男のらーめん500円の営業状態を取得する
8
+
9
+ == SYNOPSIS:
10
+
11
+ % require 'otokonoramen500yen'
12
+ % o = Otokonoramen500yen.get
13
+ % puts o.date
14
+ % puts o.body
15
+
16
+
17
+ == INSTALL:
18
+
19
+ * gem install otokonoramen500yen
20
+
21
+ == LICENSE:
22
+
23
+ (The MIT License)
24
+
25
+ Copyright (c) 2011 Sho Hashimoto
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining
28
+ a copy of this software and associated documentation files (the
29
+ 'Software'), to deal in the Software without restriction, including
30
+ without limitation the rights to use, copy, modify, merge, publish,
31
+ distribute, sublicense, and/or sell copies of the Software, and to
32
+ permit persons to whom the Software is furnished to do so, subject to
33
+ the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be
36
+ included in all copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
39
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
40
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
41
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
42
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
43
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/otokonoramen500yen'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ # Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'otokonoramen500yen' do
14
+ self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
15
+ self.rubyforge_name = self.name # TODO this is default value
16
+ self.extra_deps = [['hpricot']]
17
+
18
+ end
19
+
20
+ require 'newgem/tasks'
21
+ Dir['tasks/**/*.rake'].each { |t| load t }
22
+
23
+ # TODO - want other tests/tasks run by default? Add them to the list
24
+ # remove_task :default
25
+ # task :default => [:spec, :features]
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+ # $:.unshift File.dirname(__FILE__)+'/../lib/'
4
+ require 'rubygems'
5
+ require 'otokonoramen500yen'
6
+
7
+ o = Otokonoramen500yen.get
8
+ puts "#{o.date} 発行"
9
+ puts o.body
10
+
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'hpricot'
3
+ require 'open-uri'
4
+ require 'kconv'
5
+
6
+ module Otokonoramen500yen
7
+ VERSION = '0.0.1'
8
+
9
+ def Otokonoramen500yen.get
10
+ page = open('http://bn.merumo.ne.jp/backno/latestView.do?magId=00589575').read.toutf8
11
+ doc = Hpricot(page)
12
+ body = doc.search('//div[@class="bn_content_text"]').inner_text
13
+ date = doc.search('//div[@class="bn_head"]').inner_text
14
+ date = Time.utc(date.scan(/(\d+)年/).first.first,
15
+ date.scan(/(\d+)月/).first.first,
16
+ date.scan(/(\d+)日/).first.first,
17
+ date.scan(/(\d+)時/).first.first,
18
+ date.scan(/(\d+)分/).first.first)
19
+ Response.new(body,date)
20
+ end
21
+
22
+ class Otokonoramen500yen::Response
23
+ attr_reader :body, :date
24
+ def initialize(body,date)
25
+ @body = body
26
+ @date = date
27
+ end
28
+ end
29
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/otokonoramen500yen.rb'}"
9
+ puts "Loading otokonoramen500yen gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/otokonoramen500yen'
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestOtokonoramen500yen < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: otokonoramen500yen
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Sho Hashimoto
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-27 00:00:00 +09:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: hpricot
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 35
44
+ segments:
45
+ - 2
46
+ - 9
47
+ - 4
48
+ version: 2.9.4
49
+ type: :development
50
+ version_requirements: *id002
51
+ description: !binary |
52
+ 55S344Gu44KJ44O844KB44KTNTAw5YaG44Gu5Za25qWt54q25oWL44KS5Y+W
53
+ 5b6X44GZ44KL
54
+
55
+ email:
56
+ - hashimoto@shokai.org
57
+ executables:
58
+ - otokonoramen500yen
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - History.txt
63
+ - Manifest.txt
64
+ files:
65
+ - History.txt
66
+ - Manifest.txt
67
+ - README.rdoc
68
+ - Rakefile
69
+ - lib/otokonoramen500yen.rb
70
+ - script/console
71
+ - script/destroy
72
+ - script/generate
73
+ - test/test_helper.rb
74
+ - test/test_otokonoramen500yen.rb
75
+ - bin/otokonoramen500yen
76
+ - .gemtest
77
+ has_rdoc: true
78
+ homepage: http://github.com/shokai/ruby-otokonoramen500yen
79
+ licenses: []
80
+
81
+ post_install_message:
82
+ rdoc_options:
83
+ - --main
84
+ - README.rdoc
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ requirements: []
106
+
107
+ rubyforge_project: otokonoramen500yen
108
+ rubygems_version: 1.6.2
109
+ signing_key:
110
+ specification_version: 3
111
+ summary: !binary |
112
+ 55S344Gu44KJ44O844KB44KTNTAw5YaG44Gu5Za25qWt54q25oWL44KS5Y+W
113
+ 5b6X44GZ44KL
114
+
115
+ test_files:
116
+ - test/test_helper.rb
117
+ - test/test_otokonoramen500yen.rb