tairu 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/tairu CHANGED
@@ -24,9 +24,7 @@ OptionParser.new do |o|
24
24
  end.parse!
25
25
 
26
26
  if opts[:config]
27
- unless defined?(Tairu)
28
- require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'tairu')
29
- end
27
+ require 'tairu'
30
28
 
31
29
  Tairu::CONFIG = Tairu::Configuration.new(opts[:config])
32
30
  Tairu::CACHE = Tairu::CONFIG.cache
data/config.ru ADDED
@@ -0,0 +1,3 @@
1
+ $:.push File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
2
+ require 'tairu/server'
3
+ run Tairu::Server.new
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require 'rubygems/command.rb'
3
+ require 'rubygems/dependency_installer.rb'
4
+
5
+ begin
6
+ Gem::Command.build_args = ARGV
7
+ rescue NoMethodError
8
+ end
9
+
10
+ inst = Gem::DependencyInstaller.new
11
+
12
+ begin
13
+ if defined?(JRUBY_VERSION)
14
+ inst.install 'jdbc-sqlite3'
15
+ else
16
+ inst.install 'sqlite3'
17
+ end
18
+ rescue
19
+ exit(1)
20
+ end
21
+
22
+ p File.expand_path(__FILE__)
23
+
24
+ f = File.open(File.join(File.expand_path(File.dirname(__FILE__)), 'Rakefile'), 'w')
25
+ f.write("task :default\n")
26
+ f.close
@@ -19,8 +19,13 @@ module Tairu
19
19
  "%#{length}x" % int_value
20
20
  end
21
21
 
22
- def self.get(tileset, coord, format = 'jpg')
23
- data = File.read(File.join(File.dirname(__FILE__), '..', '..', 'tilesets', tileset, 'Layers', '_alllayers', "L#{coord[:zoom]}", "R#{encode_hex(coord[:row])}", "C#{encode_hex(coord[:col])}.#{format}"))
22
+ def self.get(layer, tileset, coord, format = 'png')
23
+ loc = File.expand_path(Tairu::CONFIG.data['cache']['layers'][layer]['location'])
24
+ path = File.join(loc, tileset, 'Layers', '_alllayers', "L#{'%02i' % coord.zoom}", "R#{encode_hex(coord.row)}", "C#{encode_hex(coord.column)}.#{format}")
25
+
26
+ return nil unless File.exists?(path)
27
+
28
+ data = File.read(path)
24
29
  mime_type = "image/#{format}"
25
30
  Tairu::Tile.new(data, mime_type)
26
31
  end
data/lib/tairu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tairu
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tairu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -80,10 +80,12 @@ email:
80
80
  - scooterwadsworth@gmail.com
81
81
  executables:
82
82
  - tairu
83
- extensions: []
83
+ extensions:
84
+ - ext/mkrf_conf.rb
84
85
  extra_rdoc_files: []
85
86
  files:
86
87
  - README.md
88
+ - config.ru
87
89
  - bin/tairu
88
90
  - lib/tairu/cache/disk.rb
89
91
  - lib/tairu/cache/memory.rb
@@ -98,6 +100,7 @@ files:
98
100
  - lib/tairu/tile.rb
99
101
  - lib/tairu/version.rb
100
102
  - lib/tairu.rb
103
+ - ext/mkrf_conf.rb
101
104
  homepage: https://github.com/scooterw/tairu
102
105
  licenses:
103
106
  - MIT