ruanwz-sogoumap2pdf 0.2.1
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.
- data/History.txt +31 -0
- data/License.txt +20 -0
- data/Manifest.txt +34 -0
- data/PostInstall.txt +4 -0
- data/README.txt +78 -0
- data/Rakefile +4 -0
- data/TODO +3 -0
- data/bin/sogoumap2disk +60 -0
- data/bin/sogoumap2pdf +60 -0
- data/bin/sogoumap2pdf_from_disk +59 -0
- data/bin/sogoumap2pdf_from_disk_front_page +59 -0
- data/config/hoe.rb +74 -0
- data/config/requirements.rb +15 -0
- data/lib/sogoumap2pdf.rb +12 -0
- data/lib/sogoumap2pdf/image_to_pdf.rb +313 -0
- data/lib/sogoumap2pdf/sogou_map_image.rb +127 -0
- data/lib/sogoumap2pdf/version.rb +9 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/spec/sogoumap2pdf_spec.rb +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- data/website/index.txt +87 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.html.erb +52 -0
- metadata +86 -0
data/History.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
== 0.0.1 2008-08-19
|
2
|
+
|
3
|
+
* 1 major enhancement:
|
4
|
+
* Initial release
|
5
|
+
== 0.0.2 2008-08-19
|
6
|
+
|
7
|
+
* 1 major enhancement:
|
8
|
+
* Import example
|
9
|
+
|
10
|
+
== 0.0.2 2008-08-19
|
11
|
+
* 1 major enhancement:
|
12
|
+
* Change command syntax
|
13
|
+
|
14
|
+
== 0.0.8 2008-08-19
|
15
|
+
* 1 bug fixed:
|
16
|
+
* Page size error
|
17
|
+
|
18
|
+
== 0.0.9 2008-08-19
|
19
|
+
* 1 minor enhancement:
|
20
|
+
* add command sogoumap2disk
|
21
|
+
|
22
|
+
== 0.0.11 2008-09-09
|
23
|
+
* 1 minor enhancement:
|
24
|
+
* add command sogoumap2pdf_from_disk
|
25
|
+
|
26
|
+
== 0.1.0 2008-09-10
|
27
|
+
* 1 bug fixed:
|
28
|
+
fix crop! error
|
29
|
+
== 0.2.0 2008-09-11
|
30
|
+
* 1 bug fixed:
|
31
|
+
fix front page error
|
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 FIXME full name
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
PostInstall.txt
|
5
|
+
README.txt
|
6
|
+
Rakefile
|
7
|
+
TODO
|
8
|
+
bin/sogoumap2pdf
|
9
|
+
bin/sogoumap2disk
|
10
|
+
bin/sogoumap2pdf_from_disk
|
11
|
+
bin/sogoumap2pdf_from_disk_front_page
|
12
|
+
config/hoe.rb
|
13
|
+
config/requirements.rb
|
14
|
+
lib/sogoumap2pdf.rb
|
15
|
+
lib/sogoumap2pdf/version.rb
|
16
|
+
lib/sogoumap2pdf/image_to_pdf.rb
|
17
|
+
lib/sogoumap2pdf/sogou_map_image.rb
|
18
|
+
script/console
|
19
|
+
script/destroy
|
20
|
+
script/generate
|
21
|
+
script/txt2html
|
22
|
+
setup.rb
|
23
|
+
spec/sogoumap2pdf_spec.rb
|
24
|
+
spec/spec.opts
|
25
|
+
spec/spec_helper.rb
|
26
|
+
tasks/deployment.rake
|
27
|
+
tasks/environment.rake
|
28
|
+
tasks/rspec.rake
|
29
|
+
tasks/website.rake
|
30
|
+
website/index.html
|
31
|
+
website/index.txt
|
32
|
+
website/javascripts/rounded_corners_lite.inc.js
|
33
|
+
website/stylesheets/screen.css
|
34
|
+
website/template.html.erb
|
data/PostInstall.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
= sogoumap2pdf
|
2
|
+
|
3
|
+
* sogoumap2pdf.rubyforge.org
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
* Download map and convert to pdf
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* Download map and convert to pdf
|
12
|
+
|
13
|
+
|
14
|
+
== SYNOPSIS:
|
15
|
+
Find out the link of the center picture using Firebug plugin in Firefox, then type:
|
16
|
+
sogoumap2pdf link map_widthxmap_height rowxcolumn save_file_name mode
|
17
|
+
for example:
|
18
|
+
sogoumap2pdf http://hbpic1.go2map.com/seamless/0/180/711/252/52/50449_10516.JPG 1024x768 5x5 gz.pdf sp
|
19
|
+
mode description:
|
20
|
+
sp: both satellite and path
|
21
|
+
s: only satellite
|
22
|
+
m: only map
|
23
|
+
|
24
|
+
Links for some cities:
|
25
|
+
1 Beijing:http://hbpic3.go2map.com/seamless/0/180/792/518/192/103647_38598.JPG
|
26
|
+
2 Shanghai:http://hbpic3.go2map.com/seamless/0/180/792/540/145/108175_29128.JPG
|
27
|
+
3 Tianjing:http://hbpic3.go2map.com/seamless/0/180/792/521/188/104367_37713.JPG
|
28
|
+
4 Chongqin:http://hbpic2.go2map.com/seamless/0/180/792/474/137/94897_27407.JPG
|
29
|
+
5 Chendu:http://hbpic4.go2map.com/seamless/0/180/792/463/142/92685_28539.JPG
|
30
|
+
6 Dalian:http://hbpic2.go2map.com/seamless/0/180/792/541/187/108301_37462.JPG
|
31
|
+
7 Fuzhou:http://hbpic0.go2map.com/seamless/0/180/792/531/119/106244_23925.JPG
|
32
|
+
8 Guangzhou:http://hbpic0.go2map.com/seamless/0/180/792/504/105/100915_21050.JPG
|
33
|
+
9 Hangzhou:http://hbpic1.go2map.com/seamless/0/180/792/535/140/107001_28156.JPG
|
34
|
+
10 Jinan:http://hbpic4.go2map.com/seamless/0/180/792/520/174/104176_34934.JPG
|
35
|
+
11 Kunming:http://hbpic0.go2map.com/seamless/0/180/792/457/114/91472_22905.JPG
|
36
|
+
12 Nanjing:http://hbpic1.go2map.com/seamless/0/180/792/528/149/105778_29981.JPG
|
37
|
+
13 Qingdao:http://hbpic0.go2map.com/seamless/0/180/792/536/171/107220_34345.JPG
|
38
|
+
14 Sanya:http://hbpic4.go2map.com/seamless/0/180/792/487/82/97523_16429.JPG
|
39
|
+
15 Shenzhen:http://hbpic4.go2map.com/seamless/0/180/792/507/102/101555_20499.JPG
|
40
|
+
16 Shenyan:http://hbpic0.go2map.com/seamless/0/180/792/549/204/109907_40820.JPG
|
41
|
+
17 Wuhan:http://hbpic3.go2map.com/seamless/0/180/792/508/142/101779_28448.JPG
|
42
|
+
18 Xian:http://hbpic4.go2map.com/seamless/0/180/792/485/161/97019_32314.JPG
|
43
|
+
19 Hongkong:http://hbpic3.go2map.com/seamless/0/180/792/508/101/101692_20253.JPG
|
44
|
+
20 Zhengzhou:http://hbpic4.go2map.com/seamless/0/180/792/506/164/101221_32844.JPG
|
45
|
+
21 Qinghuangdao:http://hbpic3.go2map.com/seamless/0/180/792/532/193/106514_38638.JPG
|
46
|
+
== REQUIREMENTS:
|
47
|
+
|
48
|
+
* pdf-writer
|
49
|
+
* rmagick(On ubuntu, imagemagick and libmagick9-dev are needed to be installed first)
|
50
|
+
|
51
|
+
== INSTALL:
|
52
|
+
|
53
|
+
* sudo gem install sogoumap2pdf
|
54
|
+
|
55
|
+
== LICENSE:
|
56
|
+
|
57
|
+
(The MIT License)
|
58
|
+
|
59
|
+
Copyright (c) 2008 FIXME full name
|
60
|
+
|
61
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
62
|
+
a copy of this software and associated documentation files (the
|
63
|
+
'Software'), to deal in the Software without restriction, including
|
64
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
65
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
66
|
+
permit persons to whom the Software is furnished to do so, subject to
|
67
|
+
the following conditions:
|
68
|
+
|
69
|
+
The above copyright notice and this permission notice shall be
|
70
|
+
included in all copies or substantial portions of the Software.
|
71
|
+
|
72
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
73
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
74
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
75
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
76
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
77
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
78
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/TODO
ADDED
data/bin/sogoumap2disk
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2008-8-19.
|
4
|
+
# Copyright (c) 2008. All rights reserved.
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
rescue LoadError
|
9
|
+
# no rubygems to load, so we fail silently
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'optparse'
|
13
|
+
require 'sogoumap2pdf'
|
14
|
+
include Sogoumap2pdf
|
15
|
+
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
|
16
|
+
|
17
|
+
OPTIONS = {
|
18
|
+
:path => '~'
|
19
|
+
}
|
20
|
+
MANDATORY_OPTIONS = %w( )
|
21
|
+
|
22
|
+
parser = OptionParser.new do |opts|
|
23
|
+
opts.banner = <<BANNER
|
24
|
+
This application is wonderful because...
|
25
|
+
|
26
|
+
Usage: #{File.basename($0)} [options]
|
27
|
+
|
28
|
+
Options are:
|
29
|
+
BANNER
|
30
|
+
opts.separator ""
|
31
|
+
opts.on("-p", "--path=PATH", String,
|
32
|
+
"The root path for selecting files",
|
33
|
+
"Default: ~") { |OPTIONS[:path]| }
|
34
|
+
opts.on("-h", "--help",
|
35
|
+
"Show this help message.") { puts opts; exit }
|
36
|
+
opts.parse!(ARGV)
|
37
|
+
|
38
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
|
39
|
+
puts opts; exit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
path = OPTIONS[:path]
|
44
|
+
|
45
|
+
# do stuff
|
46
|
+
#
|
47
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0 0 30 30 guangzhou.pdf sp
|
48
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0x0 30x30 guangzhou.pdf sp
|
49
|
+
link=ARGV[0]
|
50
|
+
option=ARGV[4]
|
51
|
+
x,y=ARGV[1].split("x")
|
52
|
+
r,c=ARGV[2].split("x")
|
53
|
+
g=SogouMapImage.new(link, option)
|
54
|
+
gmpdf=ImageToPdf.new(".JPG",x,y)
|
55
|
+
xres, yres = gmpdf.perfect_fit(x.to_i,y.to_i,r.to_i,c.to_i)
|
56
|
+
g.fill_map(xres,yres)
|
57
|
+
g.fill_map2
|
58
|
+
#gmpdf.front_page(g)
|
59
|
+
#gmpdf.create_pages(g)
|
60
|
+
#gmpdf.save(ARGV[3])
|
data/bin/sogoumap2pdf
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2008-8-19.
|
4
|
+
# Copyright (c) 2008. All rights reserved.
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
rescue LoadError
|
9
|
+
# no rubygems to load, so we fail silently
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'optparse'
|
13
|
+
require 'sogoumap2pdf'
|
14
|
+
include Sogoumap2pdf
|
15
|
+
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
|
16
|
+
|
17
|
+
OPTIONS = {
|
18
|
+
:path => '~'
|
19
|
+
}
|
20
|
+
MANDATORY_OPTIONS = %w( )
|
21
|
+
|
22
|
+
parser = OptionParser.new do |opts|
|
23
|
+
opts.banner = <<BANNER
|
24
|
+
This application is wonderful because...
|
25
|
+
|
26
|
+
Usage: #{File.basename($0)} [options]
|
27
|
+
|
28
|
+
Options are:
|
29
|
+
BANNER
|
30
|
+
opts.separator ""
|
31
|
+
opts.on("-p", "--path=PATH", String,
|
32
|
+
"The root path for selecting files",
|
33
|
+
"Default: ~") { |OPTIONS[:path]| }
|
34
|
+
opts.on("-h", "--help",
|
35
|
+
"Show this help message.") { puts opts; exit }
|
36
|
+
opts.parse!(ARGV)
|
37
|
+
|
38
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
|
39
|
+
puts opts; exit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
path = OPTIONS[:path]
|
44
|
+
|
45
|
+
# do stuff
|
46
|
+
#
|
47
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0 0 30 30 guangzhou.pdf sp
|
48
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0x0 30x30 guangzhou.pdf sp
|
49
|
+
link=ARGV[0]
|
50
|
+
option=ARGV[4]
|
51
|
+
x,y=ARGV[1].split("x")
|
52
|
+
r,c=ARGV[2].split("x")
|
53
|
+
g=SogouMapImage.new(link, option)
|
54
|
+
gmpdf=ImageToPdf.new(".JPG",x,y)
|
55
|
+
xres, yres = gmpdf.perfect_fit(x.to_i,y.to_i,r.to_i,c.to_i)
|
56
|
+
g.fill_map(xres,yres)
|
57
|
+
g.fill_map2
|
58
|
+
gmpdf.front_page(g)
|
59
|
+
gmpdf.create_pages(g)
|
60
|
+
gmpdf.save(ARGV[3])
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2008-8-19.
|
4
|
+
# Copyright (c) 2008. All rights reserved.
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
rescue LoadError
|
9
|
+
# no rubygems to load, so we fail silently
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'optparse'
|
13
|
+
require 'sogoumap2pdf'
|
14
|
+
include Sogoumap2pdf
|
15
|
+
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
|
16
|
+
|
17
|
+
OPTIONS = {
|
18
|
+
:path => '~'
|
19
|
+
}
|
20
|
+
MANDATORY_OPTIONS = %w( )
|
21
|
+
|
22
|
+
parser = OptionParser.new do |opts|
|
23
|
+
opts.banner = <<BANNER
|
24
|
+
This application is wonderful because...
|
25
|
+
|
26
|
+
Usage: #{File.basename($0)} [options]
|
27
|
+
|
28
|
+
Options are:
|
29
|
+
BANNER
|
30
|
+
opts.separator ""
|
31
|
+
opts.on("-p", "--path=PATH", String,
|
32
|
+
"The root path for selecting files",
|
33
|
+
"Default: ~") { |OPTIONS[:path]| }
|
34
|
+
opts.on("-h", "--help",
|
35
|
+
"Show this help message.") { puts opts; exit }
|
36
|
+
opts.parse!(ARGV)
|
37
|
+
|
38
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
|
39
|
+
puts opts; exit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
path = OPTIONS[:path]
|
44
|
+
|
45
|
+
# do stuff
|
46
|
+
#
|
47
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0 0 30 30 guangzhou.pdf sp
|
48
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0x0 30x30 guangzhou.pdf sp
|
49
|
+
link=ARGV[0]
|
50
|
+
option=ARGV[4]
|
51
|
+
x,y=ARGV[1].split("x")
|
52
|
+
r,c=ARGV[2].split("x")
|
53
|
+
g=SogouMapImage.new(link, option)
|
54
|
+
gmpdf=ImageToPdf.new(".JPG",x,y)
|
55
|
+
xres, yres = gmpdf.perfect_fit(x.to_i,y.to_i,r.to_i,c.to_i)
|
56
|
+
g.fill_map(xres,yres)
|
57
|
+
gmpdf.front_page(g)
|
58
|
+
gmpdf.create_pages(g)
|
59
|
+
gmpdf.save(ARGV[3])
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Created on 2008-8-19.
|
4
|
+
# Copyright (c) 2008. All rights reserved.
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
rescue LoadError
|
9
|
+
# no rubygems to load, so we fail silently
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'optparse'
|
13
|
+
require 'sogoumap2pdf'
|
14
|
+
include Sogoumap2pdf
|
15
|
+
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
|
16
|
+
|
17
|
+
OPTIONS = {
|
18
|
+
:path => '~'
|
19
|
+
}
|
20
|
+
MANDATORY_OPTIONS = %w( )
|
21
|
+
|
22
|
+
parser = OptionParser.new do |opts|
|
23
|
+
opts.banner = <<BANNER
|
24
|
+
This application is wonderful because...
|
25
|
+
|
26
|
+
Usage: #{File.basename($0)} [options]
|
27
|
+
|
28
|
+
Options are:
|
29
|
+
BANNER
|
30
|
+
opts.separator ""
|
31
|
+
opts.on("-p", "--path=PATH", String,
|
32
|
+
"The root path for selecting files",
|
33
|
+
"Default: ~") { |OPTIONS[:path]| }
|
34
|
+
opts.on("-h", "--help",
|
35
|
+
"Show this help message.") { puts opts; exit }
|
36
|
+
opts.parse!(ARGV)
|
37
|
+
|
38
|
+
if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
|
39
|
+
puts opts; exit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
path = OPTIONS[:path]
|
44
|
+
|
45
|
+
# do stuff
|
46
|
+
#
|
47
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0 0 30 30 guangzhou.pdf sp
|
48
|
+
# guangzhou: ruby map2pdf.rb http://hbpic3.go2map.com/seamless/0/180/792/504/105/100899_21033.JPG 0x0 30x30 guangzhou.pdf sp
|
49
|
+
link=ARGV[0]
|
50
|
+
option=ARGV[4]
|
51
|
+
x,y=ARGV[1].split("x")
|
52
|
+
r,c=ARGV[2].split("x")
|
53
|
+
g=SogouMapImage.new(link, option)
|
54
|
+
gmpdf=ImageToPdf.new(".JPG",x,y)
|
55
|
+
xres, yres = gmpdf.perfect_fit(x.to_i,y.to_i,r.to_i,c.to_i)
|
56
|
+
g.fill_map(xres,yres)
|
57
|
+
gmpdf.front_page_only(g)
|
58
|
+
#gmpdf.create_pages(g)
|
59
|
+
gmpdf.save(ARGV[3])
|
data/config/hoe.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'sogoumap2pdf/version'
|
2
|
+
|
3
|
+
AUTHOR = 'David Ruan' # can also be an array of Authors
|
4
|
+
EMAIL = "ruanwz@gmail.com"
|
5
|
+
DESCRIPTION = "download the map and convert to pdf"
|
6
|
+
GEM_NAME = 'sogoumap2pdf' # what ppl will type to install your gem
|
7
|
+
RUBYFORGE_PROJECT = 'sogoumap2pdf' # The unix name for your project
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
+
EXTRA_DEPENDENCIES = [
|
11
|
+
['pdf-writer', '>= 1.1.8'],
|
12
|
+
['rmagick', '>= 2.5.2']
|
13
|
+
] # An array of rubygem dependencies [name, version]
|
14
|
+
|
15
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
16
|
+
@config = nil
|
17
|
+
RUBYFORGE_USERNAME = "ruanwz"
|
18
|
+
def rubyforge_username
|
19
|
+
unless @config
|
20
|
+
begin
|
21
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
22
|
+
rescue
|
23
|
+
puts <<-EOS
|
24
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
25
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
26
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
27
|
+
EOS
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
REV = nil
|
36
|
+
# UNCOMMENT IF REQUIRED:
|
37
|
+
# REV = YAML.load(`svn info`)['Revision']
|
38
|
+
VERS = Sogoumap2pdf::VERSION::STRING + (REV ? ".#{REV}" : "")
|
39
|
+
RDOC_OPTS = ['--quiet', '--title', 'sogoumap2pdf documentation',
|
40
|
+
"--opname", "index.html",
|
41
|
+
"--line-numbers",
|
42
|
+
"--main", "README",
|
43
|
+
"--inline-source"]
|
44
|
+
|
45
|
+
class Hoe
|
46
|
+
def extra_deps
|
47
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
48
|
+
@extra_deps
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Generate all the Rake tasks
|
53
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
54
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
55
|
+
p.developer(AUTHOR, EMAIL)
|
56
|
+
p.description = DESCRIPTION
|
57
|
+
p.summary = DESCRIPTION
|
58
|
+
p.url = HOMEPATH
|
59
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
60
|
+
p.test_globs = ["test/**/test_*.rb"]
|
61
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
62
|
+
|
63
|
+
# == Optional
|
64
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
65
|
+
p.extra_deps = EXTRA_DEPENDENCIES
|
66
|
+
|
67
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
68
|
+
end
|
69
|
+
|
70
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
71
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
72
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
73
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
74
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|