weatherhacks 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -3
- data/License.txt +1 -1
- data/Manifest.txt +0 -18
- data/README.txt +18 -7
- data/Rakefile +22 -3
- data/bin/lwws +0 -0
- data/lib/weatherhacks.rb +17 -1
- data/lib/weatherhacks/lwws.rb +27 -14
- data/spec/lwws_spec.rb +115 -122
- metadata +41 -57
- data/config/hoe.rb +0 -71
- data/config/requirements.rb +0 -17
- data/lib/weatherhacks/version.rb +0 -9
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -11
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/rspec.rake +0 -21
- data/tasks/weatherhacks.rake +0 -20
- data/tasks/website.rake +0 -17
- data/website/index.html +0 -121
- data/website/index.txt +0 -57
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.rhtml +0 -48
metadata
CHANGED
@@ -1,33 +1,26 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.2
|
3
|
-
specification_version: 1
|
4
2
|
name: weatherhacks
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-12-12 00:00:00 +09:00
|
8
|
-
summary: description of gem
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: keita.yamaguchi@gmail.com
|
12
|
-
homepage: http://weatherhacks.rubyforge.org
|
13
|
-
rubyforge_project: weatherhacks
|
14
|
-
description: description of gem
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.2.0
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Keita Yamaguchi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-04-11 00:00:00 +09:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: keita.yamaguchi@gmail.com
|
18
|
+
executables:
|
19
|
+
- lwws
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
31
24
|
files:
|
32
25
|
- History.txt
|
33
26
|
- License.txt
|
@@ -35,46 +28,37 @@ files:
|
|
35
28
|
- README.txt
|
36
29
|
- Rakefile
|
37
30
|
- bin/lwws
|
38
|
-
- config/hoe.rb
|
39
|
-
- config/requirements.rb
|
40
31
|
- lib/weatherhacks.rb
|
41
32
|
- lib/weatherhacks/forecastmap.rb
|
42
33
|
- lib/weatherhacks/lwws.rb
|
43
|
-
- lib/weatherhacks/version.rb
|
44
34
|
- misc/forecastmap.xsl
|
45
|
-
- script/destroy
|
46
|
-
- script/generate
|
47
|
-
- script/txt2html
|
48
35
|
- setup.rb
|
49
36
|
- spec/lwws_spec.rb
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
- tasks/rspec.rake
|
55
|
-
- tasks/weatherhacks.rake
|
56
|
-
- tasks/website.rake
|
57
|
-
- website/index.html
|
58
|
-
- website/index.txt
|
59
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
60
|
-
- website/stylesheets/screen.css
|
61
|
-
- website/template.rhtml
|
62
|
-
test_files: []
|
63
|
-
|
64
|
-
rdoc_options:
|
65
|
-
- --main
|
66
|
-
- README.txt
|
67
|
-
extra_rdoc_files:
|
68
|
-
- History.txt
|
69
|
-
- License.txt
|
70
|
-
- Manifest.txt
|
71
|
-
- README.txt
|
72
|
-
- website/index.txt
|
73
|
-
executables:
|
74
|
-
- lwws
|
75
|
-
extensions: []
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/keita/ruby-weatherhacks/tree/master
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
76
41
|
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
77
56
|
requirements: []
|
78
57
|
|
79
|
-
|
58
|
+
rubyforge_project: weatherhacks
|
59
|
+
rubygems_version: 1.1.1
|
60
|
+
signing_key:
|
61
|
+
specification_version: 2
|
62
|
+
summary: ruby-weatherhacks is a wrapper library for livedoor WeatherHacks API.
|
63
|
+
test_files: []
|
80
64
|
|
data/config/hoe.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'weatherhacks/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Keita Yamaguchi' # can also be an array of Authors
|
4
|
-
EMAIL = "keita.yamaguchi@gmail.com"
|
5
|
-
DESCRIPTION = "description of gem"
|
6
|
-
GEM_NAME = 'weatherhacks' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'weatherhacks' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
|
11
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
12
|
-
@config = nil
|
13
|
-
RUBYFORGE_USERNAME = "unknown"
|
14
|
-
def rubyforge_username
|
15
|
-
unless @config
|
16
|
-
begin
|
17
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
18
|
-
rescue
|
19
|
-
puts <<-EOS
|
20
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
21
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
22
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
23
|
-
EOS
|
24
|
-
exit
|
25
|
-
end
|
26
|
-
end
|
27
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
REV = nil
|
32
|
-
# UNCOMMENT IF REQUIRED:
|
33
|
-
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
34
|
-
VERS = WeatherHacks::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
-
RDOC_OPTS = ['--quiet', '--title', 'weatherhacks documentation',
|
36
|
-
"--opname", "index.html",
|
37
|
-
"--line-numbers",
|
38
|
-
"--main", "README",
|
39
|
-
"--inline-source"]
|
40
|
-
|
41
|
-
class Hoe
|
42
|
-
def extra_deps
|
43
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
-
@extra_deps
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Generate all the Rake tasks
|
49
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
-
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
-
p.author = AUTHOR
|
52
|
-
p.description = DESCRIPTION
|
53
|
-
p.email = EMAIL
|
54
|
-
p.summary = DESCRIPTION
|
55
|
-
p.url = HOMEPATH
|
56
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
57
|
-
p.test_globs = ["test/**/test_*.rb"]
|
58
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
59
|
-
|
60
|
-
# == Optional
|
61
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
62
|
-
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
|
-
|
64
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
69
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
70
|
-
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
71
|
-
hoe.rsync_args = '-av --delete --ignore-errors'
|
data/config/requirements.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
16
|
-
|
17
|
-
require 'weatherhacks'
|
data/lib/weatherhacks/version.rb
DELETED
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = 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
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = 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)
|
data/script/txt2html
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
begin
|
5
|
-
require 'newgem'
|
6
|
-
rescue LoadError
|
7
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
8
|
-
puts "Install: gem install newgem\n\n"
|
9
|
-
exit(1)
|
10
|
-
end
|
11
|
-
require 'redcloth'
|
12
|
-
require 'syntax/convertors/html'
|
13
|
-
require 'erb'
|
14
|
-
require File.dirname(__FILE__) + '/../lib/weatherhacks/version.rb'
|
15
|
-
|
16
|
-
version = WeatherHacks::VERSION::STRING
|
17
|
-
download = 'http://rubyforge.org/projects/weatherhacks'
|
18
|
-
|
19
|
-
class Fixnum
|
20
|
-
def ordinal
|
21
|
-
# teens
|
22
|
-
return 'th' if (10..19).include?(self % 100)
|
23
|
-
# others
|
24
|
-
case self % 10
|
25
|
-
when 1: return 'st'
|
26
|
-
when 2: return 'nd'
|
27
|
-
when 3: return 'rd'
|
28
|
-
else return 'th'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Time
|
34
|
-
def pretty
|
35
|
-
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def convert_syntax(syntax, source)
|
40
|
-
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
41
|
-
end
|
42
|
-
|
43
|
-
if ARGV.length >= 1
|
44
|
-
src, template = ARGV
|
45
|
-
template ||= File.join(File.dirname(__FILE__), '/../website/template.rhtml')
|
46
|
-
|
47
|
-
else
|
48
|
-
puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
|
49
|
-
exit!
|
50
|
-
end
|
51
|
-
|
52
|
-
template = ERB.new(File.open(template).read)
|
53
|
-
|
54
|
-
title = nil
|
55
|
-
body = nil
|
56
|
-
File.open(src) do |fsrc|
|
57
|
-
title_text = fsrc.readline
|
58
|
-
body_text = fsrc.read
|
59
|
-
syntax_items = []
|
60
|
-
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
|
61
|
-
ident = syntax_items.length
|
62
|
-
element, syntax, source = $1, $2, $3
|
63
|
-
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
64
|
-
"syntax-temp-#{ident}"
|
65
|
-
}
|
66
|
-
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
67
|
-
body = RedCloth.new(body_text).to_html
|
68
|
-
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
69
|
-
end
|
70
|
-
stat = File.stat(src)
|
71
|
-
created = stat.ctime
|
72
|
-
modified = stat.mtime
|
73
|
-
|
74
|
-
$stdout << template.result(binding)
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
-fs --colour
|
data/spec/spec_helper.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec'
|
2
|
-
ROOT = File.join(File.dirname(__FILE__), "..")
|
3
|
-
$LOAD_PATH << File.join(ROOT, "lib")
|
4
|
-
require "weatherhacks"
|
5
|
-
|
6
|
-
$today =
|
7
|
-
REXML::Document.new(File.read(File.join(ROOT, "tmp", "lwws_today.xml")))
|
8
|
-
$tomorrow =
|
9
|
-
REXML::Document.new(File.read(File.join(ROOT, "tmp", "lwws_tomorrow.xml")))
|
10
|
-
$dayaftertomorrow =
|
11
|
-
REXML::Document.new(File.read(File.join(ROOT, "tmp", "lwws_dayaftertomorrow.xml")))
|
data/tasks/deployment.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|
data/tasks/environment.rake
DELETED
data/tasks/rspec.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems'
|
5
|
-
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
|
-
rescue LoadError
|
10
|
-
puts <<-EOS
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run the specs under spec/models"
|
18
|
-
Spec::Rake::SpecTask.new do |t|
|
19
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
-
t.spec_files = FileList['spec/*_spec.rb']
|
21
|
-
end
|
data/tasks/weatherhacks.rake
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
namespace :weatherhacks do
|
2
|
-
desc 'Download forecastmap.xml'
|
3
|
-
task :download_forecastmap do
|
4
|
-
url = "http://weather.livedoor.com/forecast/rss/forecastmap.xml"
|
5
|
-
sh %{wget -O tmp/forecastmap.xml #{url}}
|
6
|
-
end
|
7
|
-
|
8
|
-
desc 'Generate forecastmap.rb'
|
9
|
-
task :forecastmap do
|
10
|
-
sh %{xsltproc -o lib/weatherhacks/forecastmap.rb misc/forecastmap.xsl tmp/forecastmap.xml}
|
11
|
-
end
|
12
|
-
|
13
|
-
desc 'Download test data'
|
14
|
-
task :download_test_lwws_data do
|
15
|
-
url = "http://weather.livedoor.com/forecast/webservice/rest/v1?city=113&day="
|
16
|
-
sh %{curl -o tmp/lwws_today.xml "#{url + "today"}"}
|
17
|
-
sh %{curl -o tmp/lwws_tomorrow.xml "#{url + "tomorrow"}"}
|
18
|
-
sh %{curl -o tmp/lwws_dayaftertomorrow.xml "#{url + "dayaftertomorrow"}"}
|
19
|
-
end
|
20
|
-
end
|
data/tasks/website.rake
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
desc 'Generate website files'
|
2
|
-
task :website_generate => :ruby_env do
|
3
|
-
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
-
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
desc 'Upload website files to rubyforge'
|
9
|
-
task :website_upload do
|
10
|
-
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
-
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
-
local_dir = 'website'
|
13
|
-
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate and upload website files'
|
17
|
-
task :website => [:website_generate, :website_upload, :publish_docs]
|