mizuho 0.9.19 → 0.9.20
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.asc +7 -7
- data/README.markdown +21 -4
- data/Rakefile +173 -24
- data/debian.template/control.template +6 -5
- data/debian.template/mizuho.install.template +2 -0
- data/debian.template/ruby-interpreter +14 -0
- data/debian.template/rules.template +26 -0
- data/lib/mizuho.rb +1 -1
- data/lib/mizuho/fuzzystringmatch.rb +1 -0
- data/lib/mizuho/generator.rb +1 -0
- data/lib/mizuho/id_map.rb +2 -1
- data/lib/mizuho/packaging.rb +3 -1
- data/lib/mizuho/utils.rb +1 -0
- data/mizuho.gemspec +17 -0
- data/rpm/get_distro_id.py +4 -0
- data/rpm/rubygem-mizuho.spec.template +123 -0
- data/templates/topbar.html +2 -2
- data/test/id_map_spec.rb +9 -0
- metadata +8 -4
- metadata.gz.asc +7 -7
- data/debian.template/rules +0 -10
data.tar.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABAgAGBQJSqu2oAAoJECrHRaUKISqMn08H/39H2vkKwZBwTILuA5mgshAZ
|
6
|
+
VjSB4IhQcy+4pyXhRXuArO6363nJgWSWqAVuCFP2/x8rOf91ydnTF5PRRB0ONs1Q
|
7
|
+
D5BodSCZ6fya1aSexO4/kWTCJntO+SJ+x9fHdlyPJO6bhxm5N9lxxdvblwf+3T2A
|
8
|
+
PZE83Uqqimb/4OP6HqpNvDjpyWffUl6qjQbTRR6ppFexSmDroYWIU8F75a0Z2TF3
|
9
|
+
6exS62o4ivDHboHz8ZfzZ05ZaWlEBWMYWWNvlCEfNjW2r2vYlavXjkjV8Gw4C/vl
|
10
|
+
bmsxzlRJQ5XMUPYHi0+8o4jci6AXm359cfbeBwEjAIzBAUU88E7VXbxaSoB3EmA=
|
11
|
+
=3qVe
|
12
12
|
-----END PGP SIGNATURE-----
|
data/README.markdown
CHANGED
@@ -42,7 +42,7 @@ You can verify the authenticity of the gem by following [The Complete Guide to V
|
|
42
42
|
|
43
43
|
Use our [PPA](https://launchpad.net/~phusion.nl/+archive/misc):
|
44
44
|
|
45
|
-
sudo add-apt-repository ppa:
|
45
|
+
sudo add-apt-repository ppa:phusion.nl/misc
|
46
46
|
sudo apt-get update
|
47
47
|
sudo apt-get install mizuho
|
48
48
|
|
@@ -50,12 +50,29 @@ Use our [PPA](https://launchpad.net/~phusion.nl/+archive/misc):
|
|
50
50
|
|
51
51
|
Our Ubuntu Lucid packages are compatible with Debian 6.
|
52
52
|
|
53
|
-
sudo sh -c 'echo deb http://ppa.launchpad.net/phusion.nl/misc/ubuntu lucid main > /etc/apt/sources.list.d/
|
54
|
-
sudo sh -c 'echo deb-src http://ppa.launchpad.net/phusion.nl/misc/ubuntu lucid main >> /etc/apt/sources.list.d/
|
55
|
-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys
|
53
|
+
sudo sh -c 'echo deb http://ppa.launchpad.net/phusion.nl/misc/ubuntu lucid main > /etc/apt/sources.list.d/phusion-misc.list'
|
54
|
+
sudo sh -c 'echo deb-src http://ppa.launchpad.net/phusion.nl/misc/ubuntu lucid main >> /etc/apt/sources.list.d/phusion-misc.list'
|
55
|
+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2AC745A50A212A8C
|
56
56
|
sudo apt-get update
|
57
57
|
sudo apt-get install mizuho
|
58
58
|
|
59
|
+
## Installation on RHEL, CentOS and Amazon Linux
|
60
|
+
|
61
|
+
1. Enable EPEL: [RHEL](https://fedoraproject.org/wiki/EPEL), [CentOS](http://www.centosblog.com/enable-epel-repo-on-centos-5-and-centos-6/), [Amazon Linux](http://aws.amazon.com/amazon-linux-ami/faqs/#epel).
|
62
|
+
2. Enable our YUM repository:
|
63
|
+
|
64
|
+
# RHEL 6, CentOS 6
|
65
|
+
curl -L https://oss-binaries.phusionpassenger.com/yumgems/phusion-misc/el.repo | \
|
66
|
+
sudo tee /etc/yum.repos.d/phusion-misc.repo
|
67
|
+
|
68
|
+
# Amazon Linux
|
69
|
+
curl -L https://oss-binaries.phusionpassenger.com/yumgems/phusion-misc/amazon.repo | \
|
70
|
+
sudo tee /etc/yum.repos.d/phusion-misc.repo
|
71
|
+
|
72
|
+
3. Install our package:
|
73
|
+
|
74
|
+
sudo yum install rubygem-mizuho
|
75
|
+
|
59
76
|
## Usage
|
60
77
|
|
61
78
|
First, read [the Asciidoc manual](http://www.methods.co.nz/asciidoc/userguide.html)
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ MAINTAINER_EMAIL = "hongli@phusion.nl"
|
|
9
9
|
|
10
10
|
desc "Run unit tests"
|
11
11
|
task :test do
|
12
|
-
ruby "-S
|
12
|
+
ruby "-Ilib -S rspec -f s -c test/*_spec.rb"
|
13
13
|
end
|
14
14
|
|
15
15
|
desc "Build, sign & upload gem"
|
@@ -51,13 +51,15 @@ end
|
|
51
51
|
|
52
52
|
PKG_DIR = string_option('PKG_DIR', "pkg")
|
53
53
|
DEBIAN_NAME = PACKAGE_NAME
|
54
|
-
|
54
|
+
DEBIAN_PACKAGE_REVISION = 1
|
55
|
+
ALL_DISTRIBUTIONS = string_option('DEBIAN_DISTROS', 'saucy precise lucid').split(/[ ,]/)
|
55
56
|
ORIG_TARBALL_FILES = lambda do
|
56
57
|
require 'mizuho/packaging'
|
57
58
|
Dir[*MIZUHO_FILES] - Dir[*MIZUHO_DEBIAN_EXCLUDE_FILES]
|
58
59
|
end
|
59
60
|
|
60
|
-
# Implements a simple preprocessor language
|
61
|
+
# Implements a simple preprocessor language which combines elements in the C
|
62
|
+
# preprocessor with ERB:
|
61
63
|
#
|
62
64
|
# Today
|
63
65
|
# #if @today == :fine
|
@@ -68,6 +70,7 @@ end
|
|
68
70
|
# is a sad day.
|
69
71
|
# #endif
|
70
72
|
# Let's go walking.
|
73
|
+
# Today is <%= Time.now %>.
|
71
74
|
#
|
72
75
|
# When run with...
|
73
76
|
#
|
@@ -78,6 +81,7 @@ end
|
|
78
81
|
# Today
|
79
82
|
# is a fine day.
|
80
83
|
# Let's go walking.
|
84
|
+
# Today is 2013-08-11 22:37:06 +0200.
|
81
85
|
#
|
82
86
|
# Highlights:
|
83
87
|
#
|
@@ -85,8 +89,10 @@ end
|
|
85
89
|
# * Expressions are Ruby expressions, evaluated within the binding of a
|
86
90
|
# Preprocessor::Evaluator object.
|
87
91
|
# * Text inside #if/#elif/#else are automatically unindented.
|
92
|
+
# * ERB compatible.
|
88
93
|
class Preprocessor
|
89
94
|
def initialize
|
95
|
+
require 'erb' if !defined?(ERB)
|
90
96
|
@indentation_size = 4
|
91
97
|
@debug = boolean_option('DEBUG')
|
92
98
|
end
|
@@ -100,10 +106,11 @@ class Preprocessor
|
|
100
106
|
end
|
101
107
|
the_binding = create_binding(variables)
|
102
108
|
context = []
|
109
|
+
@filename = filename
|
103
110
|
@lineno = 1
|
104
111
|
@indentation = 0
|
105
112
|
|
106
|
-
each_line(filename) do |line|
|
113
|
+
each_line(filename, the_binding) do |line|
|
107
114
|
debug("context=#{context.inspect}, line=#{line.inspect}")
|
108
115
|
|
109
116
|
name, args_string, cmd_indentation = recognize_command(line)
|
@@ -174,6 +181,8 @@ class Preprocessor
|
|
174
181
|
else
|
175
182
|
terminate "#endif is not allowed outside #if block"
|
176
183
|
end
|
184
|
+
when "DEBHELPER"
|
185
|
+
output.puts(line)
|
177
186
|
when "", nil
|
178
187
|
# Either a comment or not a preprocessor command.
|
179
188
|
case context.last
|
@@ -208,7 +217,18 @@ private
|
|
208
217
|
"precise" => "12.04",
|
209
218
|
"quantal" => "12.10",
|
210
219
|
"raring" => "13.04",
|
211
|
-
"saucy" => "13.10"
|
220
|
+
"saucy" => "13.10",
|
221
|
+
"trusty" => "14.04"
|
222
|
+
}
|
223
|
+
DEBIAN_DISTRIBUTIONS = {
|
224
|
+
"squeeze" => "20110206",
|
225
|
+
"wheezy" => "20130504"
|
226
|
+
}
|
227
|
+
REDHAT_ENTERPRISE_DISTRIBUTIONS = {
|
228
|
+
"el6" => "el6.0"
|
229
|
+
}
|
230
|
+
AMAZON_DISTRIBUTIONS = {
|
231
|
+
"amazon" => "amazon"
|
212
232
|
}
|
213
233
|
|
214
234
|
# Provides the DSL that's accessible within.
|
@@ -216,6 +236,12 @@ private
|
|
216
236
|
def _infer_distro_table(name)
|
217
237
|
if UBUNTU_DISTRIBUTIONS.has_key?(name)
|
218
238
|
return UBUNTU_DISTRIBUTIONS
|
239
|
+
elsif DEBIAN_DISTRIBUTIONS.has_key?(name)
|
240
|
+
return DEBIAN_DISTRIBUTIONS
|
241
|
+
elsif REDHAT_ENTERPRISE_DISTRIBUTIONS.has_key?(name)
|
242
|
+
return REDHAT_ENTERPRISE_DISTRIBUTIONS
|
243
|
+
elsif AMAZON_DISTRIBUTIONS.has_key?(name)
|
244
|
+
return AMAZON_DISTRIBUTIONS
|
219
245
|
end
|
220
246
|
end
|
221
247
|
|
@@ -234,6 +260,7 @@ private
|
|
234
260
|
table2 = _infer_distro_table(name)
|
235
261
|
raise "Distribution name #{@distribution.inspect} not recognized" if !table1
|
236
262
|
raise "Distribution name #{name.inspect} not recognized" if !table2
|
263
|
+
return false if table1 != table2
|
237
264
|
v1 = table1[@distribution]
|
238
265
|
v2 = table2[name]
|
239
266
|
|
@@ -257,16 +284,14 @@ private
|
|
257
284
|
end
|
258
285
|
end
|
259
286
|
|
260
|
-
def each_line(filename)
|
261
|
-
File.open(filename, 'r') do |f|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
yield line
|
269
|
-
end
|
287
|
+
def each_line(filename, the_binding)
|
288
|
+
data = File.open(filename, 'r') do |f|
|
289
|
+
erb = ERB.new(f.read, nil, "-")
|
290
|
+
erb.filename = filename
|
291
|
+
erb.result(the_binding)
|
292
|
+
end
|
293
|
+
data.each_line do |line|
|
294
|
+
yield line.chomp
|
270
295
|
end
|
271
296
|
end
|
272
297
|
|
@@ -274,7 +299,15 @@ private
|
|
274
299
|
if line =~ /^([\s\t]*)#(.+)/
|
275
300
|
indentation_str = $1
|
276
301
|
command = $2
|
302
|
+
|
303
|
+
# Declare tabs as equivalent to 4 spaces. This is necessary for
|
304
|
+
# Makefiles in which the use of tabs is required.
|
305
|
+
indentation_str.gsub!("\t", " ")
|
306
|
+
|
277
307
|
name = command.scan(/^\w+/).first
|
308
|
+
# Ignore shebangs and comments.
|
309
|
+
return if name.nil?
|
310
|
+
|
278
311
|
args_string = command.sub(/^#{Regexp.escape(name)}[\s\t]*/, '')
|
279
312
|
return [name, args_string, indentation_str.to_s.size]
|
280
313
|
else
|
@@ -308,9 +341,24 @@ private
|
|
308
341
|
|
309
342
|
def unindent(line)
|
310
343
|
line =~ /^([\s\t]*)/
|
311
|
-
|
344
|
+
# Declare tabs as equivalent to 4 spaces. This is necessary for
|
345
|
+
# Makefiles in which the use of tabs is required.
|
346
|
+
found = $1.to_s.gsub("\t", " ").size
|
347
|
+
|
312
348
|
if found >= @indentation
|
313
|
-
|
349
|
+
# Tab-friendly way to remove indentation.
|
350
|
+
remaining = @indentation
|
351
|
+
line = line.dup
|
352
|
+
while remaining > 0
|
353
|
+
if line[0..0] == " "
|
354
|
+
remaining -= 1
|
355
|
+
else
|
356
|
+
# This is a tab.
|
357
|
+
remaining -= 4
|
358
|
+
end
|
359
|
+
line.slice!(0, 1)
|
360
|
+
end
|
361
|
+
return line
|
314
362
|
else
|
315
363
|
terminate "wrong indentation: found #{found} characters, should be at least #{@indentation}"
|
316
364
|
end
|
@@ -321,7 +369,7 @@ private
|
|
321
369
|
end
|
322
370
|
|
323
371
|
def terminate(message)
|
324
|
-
abort "*** ERROR: line #{@lineno}: #{message}"
|
372
|
+
abort "*** ERROR: #{@filename} line #{@lineno}: #{message}"
|
325
373
|
end
|
326
374
|
end
|
327
375
|
|
@@ -364,7 +412,7 @@ def create_debian_package_dir(distribution)
|
|
364
412
|
sh "mv #{root}/debian.template #{root}/debian"
|
365
413
|
changelog = File.read("#{root}/debian/changelog")
|
366
414
|
changelog =
|
367
|
-
"#{DEBIAN_NAME} (#{PACKAGE_VERSION}
|
415
|
+
"#{DEBIAN_NAME} (#{PACKAGE_VERSION}-#{DEBIAN_PACKAGE_REVISION}~#{distribution}1) #{distribution}; urgency=low\n" +
|
368
416
|
"\n" +
|
369
417
|
" * Package built.\n" +
|
370
418
|
"\n" +
|
@@ -376,13 +424,14 @@ def create_debian_package_dir(distribution)
|
|
376
424
|
end
|
377
425
|
|
378
426
|
task 'debian:orig_tarball' do
|
379
|
-
if File.exist?("#{PKG_DIR}/#{DEBIAN_NAME}.orig.tar.gz")
|
427
|
+
if File.exist?("#{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz")
|
380
428
|
puts "Debian orig tarball #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz already exists."
|
381
429
|
else
|
382
430
|
sh "rm -rf #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}"
|
383
431
|
sh "mkdir -p #{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}"
|
384
432
|
recursive_copy_files(ORIG_TARBALL_FILES.call, "#{PKG_DIR}/#{DEBIAN_NAME}_#{PACKAGE_VERSION}")
|
385
|
-
sh "cd #{PKG_DIR} &&
|
433
|
+
sh "cd #{PKG_DIR} && find #{DEBIAN_NAME}_#{PACKAGE_VERSION} -print0 | xargs -0 touch -d '2013-10-27 00:00:00 UTC'"
|
434
|
+
sh "cd #{PKG_DIR} && tar -c #{DEBIAN_NAME}_#{PACKAGE_VERSION} | gzip --no-name --best > #{DEBIAN_NAME}_#{PACKAGE_VERSION}.orig.tar.gz"
|
386
435
|
end
|
387
436
|
end
|
388
437
|
|
@@ -408,14 +457,24 @@ task 'debian:dev' do
|
|
408
457
|
end
|
409
458
|
end
|
410
459
|
|
411
|
-
desc "Build Debian source packages
|
412
|
-
task 'debian:
|
460
|
+
desc "Build Debian source packages"
|
461
|
+
task 'debian:source_packages' => 'debian:orig_tarball' do
|
462
|
+
ALL_DISTRIBUTIONS.each do |distribution|
|
463
|
+
create_debian_package_dir(distribution)
|
464
|
+
end
|
465
|
+
ALL_DISTRIBUTIONS.each do |distribution|
|
466
|
+
sh "cd #{PKG_DIR}/#{distribution} && debuild -S -us -uc"
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
desc "Build Debian source packages to be uploaded to Launchpad"
|
471
|
+
task 'debian:launchpad' => 'debian:orig_tarball' do
|
413
472
|
ALL_DISTRIBUTIONS.each do |distribution|
|
414
473
|
create_debian_package_dir(distribution)
|
415
474
|
sh "cd #{PKG_DIR}/#{distribution} && dpkg-checkbuilddeps"
|
416
475
|
end
|
417
476
|
ALL_DISTRIBUTIONS.each do |distribution|
|
418
|
-
sh "cd #{PKG_DIR}/#{distribution} && debuild -S -k#{PACKAGE_SIGNING_KEY}"
|
477
|
+
sh "cd #{PKG_DIR}/#{distribution} && debuild -S -sa -k#{PACKAGE_SIGNING_KEY}"
|
419
478
|
end
|
420
479
|
end
|
421
480
|
|
@@ -429,3 +488,93 @@ task 'debian:clean' do
|
|
429
488
|
end
|
430
489
|
sh "rm -rf #{PKG_DIR}/*.debian.tar.gz"
|
431
490
|
end
|
491
|
+
|
492
|
+
|
493
|
+
##### RPM packaging support #####
|
494
|
+
|
495
|
+
RPM_NAME = "rubygem-mizuho"
|
496
|
+
RPMBUILD_ROOT = File.expand_path("~/rpmbuild")
|
497
|
+
MOCK_OFFLINE = boolean_option('MOCK_OFFLINE', false)
|
498
|
+
ALL_RPM_DISTROS = {
|
499
|
+
"el6" => { :mock_chroot_name => "epel-6", :distro_name => "Enterprise Linux 6" },
|
500
|
+
"amazon" => { :mock_chroot_name => "epel-6", :distro_name => "Amazon Linux" }
|
501
|
+
}
|
502
|
+
|
503
|
+
desc "Build gem for use in RPM building"
|
504
|
+
task 'rpm:gem' do
|
505
|
+
rpm_source_dir = "#{RPMBUILD_ROOT}/SOURCES"
|
506
|
+
sh "gem build #{PACKAGE_NAME}.gemspec"
|
507
|
+
sh "cp #{PACKAGE_NAME}-#{PACKAGE_VERSION}.gem #{rpm_source_dir}/"
|
508
|
+
end
|
509
|
+
|
510
|
+
desc "Build RPM for local machine"
|
511
|
+
task 'rpm:local' => 'rpm:gem' do
|
512
|
+
distro_id = `./rpm/get_distro_id.py`.strip
|
513
|
+
rpm_spec_dir = "#{RPMBUILD_ROOT}/SPECS"
|
514
|
+
spec_target_dir = "#{rpm_spec_dir}/#{distro_id}"
|
515
|
+
spec_target_file = "#{spec_target_dir}/#{RPM_NAME}.spec"
|
516
|
+
|
517
|
+
sh "mkdir -p #{spec_target_dir}"
|
518
|
+
puts "Generating #{spec_target_file}"
|
519
|
+
Preprocessor.new.start("rpm/#{RPM_NAME}.spec.template",
|
520
|
+
spec_target_file,
|
521
|
+
:distribution => distro_id)
|
522
|
+
|
523
|
+
sh "rpmbuild -ba #{spec_target_file}"
|
524
|
+
end
|
525
|
+
|
526
|
+
def create_rpm_build_task(distro_id, mock_chroot_name, distro_name)
|
527
|
+
desc "Build RPM for #{distro_name}"
|
528
|
+
task "rpm:#{distro_id}" => 'rpm:gem' do
|
529
|
+
rpm_spec_dir = "#{RPMBUILD_ROOT}/SPECS"
|
530
|
+
spec_target_dir = "#{rpm_spec_dir}/#{distro_id}"
|
531
|
+
spec_target_file = "#{spec_target_dir}/#{RPM_NAME}.spec"
|
532
|
+
maybe_offline = MOCK_OFFLINE ? "--offline" : nil
|
533
|
+
|
534
|
+
sh "mkdir -p #{spec_target_dir}"
|
535
|
+
puts "Generating #{spec_target_file}"
|
536
|
+
Preprocessor.new.start("rpm/#{RPM_NAME}.spec.template",
|
537
|
+
spec_target_file,
|
538
|
+
:distribution => distro_id)
|
539
|
+
|
540
|
+
sh "rpmbuild -bs #{spec_target_file}"
|
541
|
+
sh "mock --verbose #{maybe_offline} " +
|
542
|
+
"-r #{mock_chroot_name}-x86_64 " +
|
543
|
+
"--resultdir '#{PKG_DIR}/#{distro_id}' " +
|
544
|
+
"rebuild #{RPMBUILD_ROOT}/SRPMS/#{RPM_NAME}-#{PACKAGE_VERSION}-1#{distro_id}.src.rpm"
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
ALL_RPM_DISTROS.each_pair do |distro_id, info|
|
549
|
+
create_rpm_build_task(distro_id, info[:mock_chroot_name], info[:distro_name])
|
550
|
+
end
|
551
|
+
|
552
|
+
desc "Build RPMs for all distributions"
|
553
|
+
task "rpm:all" => ALL_RPM_DISTROS.keys.map { |x| "rpm:#{x}" }
|
554
|
+
|
555
|
+
desc "Publish RPMs for all distributions"
|
556
|
+
task "rpm:publish" do
|
557
|
+
server = "juvia-helper.phusion.nl"
|
558
|
+
remote_dir = "/srv/oss_binaries_passenger/yumgems/phusion-misc"
|
559
|
+
rsync = "rsync -z -r --delete --progress"
|
560
|
+
|
561
|
+
ALL_RPM_DISTROS.each_key do |distro_id|
|
562
|
+
if !File.exist?("#{PKG_DIR}/#{distro_id}")
|
563
|
+
abort "No packages built for #{distro_id}. Please run 'rake rpm:all' first."
|
564
|
+
end
|
565
|
+
end
|
566
|
+
ALL_RPM_DISTROS.each_key do |distro_id|
|
567
|
+
sh "rpm --resign --define '%_signature gpg' --define '%_gpg_name #{PACKAGE_SIGNING_KEY}' #{PKG_DIR}/#{distro_id}/*.rpm"
|
568
|
+
end
|
569
|
+
sh "#{rsync} #{server}:#{remote_dir}/latest/ #{PKG_DIR}/yumgems/"
|
570
|
+
ALL_RPM_DISTROS.each_key do |distro_id|
|
571
|
+
distro_dir = "#{PKG_DIR}/#{distro_id}"
|
572
|
+
repo_dir = "#{PKG_DIR}/yumgems/#{distro_id}"
|
573
|
+
sh "mkdir -p #{repo_dir}"
|
574
|
+
sh "cp #{distro_dir}/#{RPM_NAME}*.rpm #{repo_dir}/"
|
575
|
+
sh "createrepo #{repo_dir}"
|
576
|
+
end
|
577
|
+
sh "ssh #{server} 'rm -rf #{remote_dir}/new && cp -dpR #{remote_dir}/latest #{remote_dir}/new'"
|
578
|
+
sh "#{rsync} #{PKG_DIR}/yumgems/ #{server}:#{remote_dir}/new/"
|
579
|
+
sh "ssh #{server} 'rm -rf #{remote_dir}/previous && mv #{remote_dir}/latest #{remote_dir}/previous && mv #{remote_dir}/new #{remote_dir}/latest'"
|
580
|
+
end
|
@@ -2,21 +2,22 @@ Source: mizuho
|
|
2
2
|
Section: text
|
3
3
|
Priority: extra
|
4
4
|
Maintainer: Hongli Lai <hongli@phusion.nl>
|
5
|
-
Build-Depends: debhelper (>= 7.0.50~),
|
5
|
+
Build-Depends: debhelper (>= 7.0.50~), sed (>= 1.0.0)
|
6
6
|
Standards-Version: 3.9.3
|
7
7
|
Homepage: https://github.com/FooBarWidget/mizuho
|
8
8
|
Vcs-Git: git://github.com/FooBarWidget/mizuho.git
|
9
9
|
Vcs-Browser: https://github.com/FooBarWidget/mizuho
|
10
|
-
XS-Ruby-Versions: all
|
11
10
|
|
12
11
|
Package: mizuho
|
13
12
|
Architecture: all
|
14
|
-
XB-Ruby-Versions: ${ruby:Versions}
|
15
13
|
#if is_distribution?('>= precise')
|
16
|
-
Depends: ${shlibs:Depends}, ${misc:Depends},
|
14
|
+
Depends: ${shlibs:Depends}, ${misc:Depends}, ruby2.0 | ruby1.9.1 | ruby1.8 | ruby-interpreter, ruby-nokogiri (>= 1.4.0), source-highlight, asciidoc (>= 8.6.0)
|
17
15
|
#else
|
18
|
-
Depends: ${shlibs:Depends}, ${misc:Depends}, ruby
|
16
|
+
Depends: ${shlibs:Depends}, ${misc:Depends}, ruby, libnokogiri-ruby (>= 1.4.0), python, source-highlight
|
19
17
|
#endif
|
18
|
+
Breaks: ruby-mizuho
|
19
|
+
Replaces: ruby-mizuho
|
20
|
+
Provides: ruby-mizuho
|
20
21
|
Description: Documentation formatting tool
|
21
22
|
Converts Asciidoc input files into nicely
|
22
23
|
outputted HTML, possibly one file per chapter.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
if test -e /usr/bin/ruby; then
|
3
|
+
exec /usr/bin/ruby "$@"
|
4
|
+
elif test -e /usr/bin/ruby2.0; then
|
5
|
+
exec /usr/bin/ruby2.0 "$@"
|
6
|
+
elif test -e /usr/bin/ruby1.9.3; then
|
7
|
+
exec /usr/bin/ruby1.9.3 "$@"
|
8
|
+
elif test -e /usr/bin/ruby1.9.1; then
|
9
|
+
exec /usr/bin/ruby1.9.1 "$@"
|
10
|
+
elif test -e /usr/bin/ruby1.8; then
|
11
|
+
exec /usr/bin/ruby1.8 "$@"
|
12
|
+
else
|
13
|
+
exec ruby "$@"
|
14
|
+
fi
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/make -f
|
2
|
+
export DH_VERBOSE=1
|
3
|
+
|
4
|
+
%:
|
5
|
+
dh $@
|
6
|
+
|
7
|
+
override_dh_auto_configure:
|
8
|
+
# Do nothing
|
9
|
+
|
10
|
+
override_dh_auto_build:
|
11
|
+
# Do nothing
|
12
|
+
|
13
|
+
override_dh_install:
|
14
|
+
dh_install
|
15
|
+
sed -i 's/NATIVELY_PACKAGED = .*/NATIVELY_PACKAGED = true/' debian/mizuho/usr/lib/ruby/vendor_ruby/mizuho.rb
|
16
|
+
#if is_distribution?(">= precise")
|
17
|
+
cp debian/ruby-interpreter debian/mizuho/usr/share/mizuho/
|
18
|
+
sed -i 's/\/usr\/bin\/env ruby/\/usr\/share\/mizuho\/ruby-interpreter/' debian/mizuho/usr/bin/mizuho
|
19
|
+
sed -i 's/\/usr\/bin\/env ruby/\/usr\/share\/mizuho\/ruby-interpreter/' debian/mizuho/usr/bin/mizuho-asciidoc
|
20
|
+
#else
|
21
|
+
sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho
|
22
|
+
sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho-asciidoc
|
23
|
+
#endif
|
24
|
+
|
25
|
+
override_dh_auto_clean:
|
26
|
+
# Do nothing
|
data/lib/mizuho.rb
CHANGED
data/lib/mizuho/generator.rb
CHANGED
data/lib/mizuho/id_map.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# Copyright (c) 2011-2013 Hongli Lai
|
2
3
|
#
|
3
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -244,7 +245,7 @@ private
|
|
244
245
|
# digits from left to right.
|
245
246
|
digit_match_index = 0
|
246
247
|
while matches.size > 1
|
247
|
-
orig_digit = orig_chapter_digits[digit_match_index]
|
248
|
+
orig_digit = orig_chapter_digits[digit_match_index] || 1
|
248
249
|
|
249
250
|
# Find closest digit in all matches.
|
250
251
|
tmp = matches.min do |a, b|
|
data/lib/mizuho/packaging.rb
CHANGED
@@ -19,10 +19,11 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
MIZUHO_FILES = [
|
22
|
-
"README.markdown", "LICENSE.txt", "Rakefile",
|
22
|
+
"README.markdown", "LICENSE.txt", "Rakefile", "mizuho.gemspec",
|
23
23
|
"bin/*",
|
24
24
|
"lib/**/*",
|
25
25
|
"debian.template/**/*",
|
26
|
+
"rpm/**/*",
|
26
27
|
"test/*",
|
27
28
|
"templates/*",
|
28
29
|
"asciidoc/**/*",
|
@@ -32,5 +33,6 @@ MIZUHO_FILES = [
|
|
32
33
|
MIZUHO_DEBIAN_EXCLUDE_FILES = [
|
33
34
|
"Rakefile",
|
34
35
|
"debian.template/**/*",
|
36
|
+
"rpm/**/*",
|
35
37
|
"source-highlight/**/*",
|
36
38
|
]
|
data/lib/mizuho/utils.rb
CHANGED
data/mizuho.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('lib/mizuho')
|
2
|
+
require File.expand_path('lib/mizuho/packaging')
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "mizuho"
|
6
|
+
s.version = Mizuho::VERSION_STRING
|
7
|
+
s.summary = "Mizuho documentation formatting tool"
|
8
|
+
s.email = "software-signing@phusion.nl"
|
9
|
+
s.homepage = "https://github.com/FooBarWidget/mizuho"
|
10
|
+
s.description = "A documentation formatting tool. Mizuho converts Asciidoc input files into nicely outputted HTML, possibly one file per chapter. Multiple templates are supported, so you can write your own."
|
11
|
+
s.executables = ["mizuho", "mizuho-asciidoc"]
|
12
|
+
s.license = "MIT"
|
13
|
+
s.authors = ["Hongli Lai"]
|
14
|
+
s.add_dependency("nokogiri", ">= 1.4.0")
|
15
|
+
s.add_dependency("sqlite3")
|
16
|
+
s.files = Dir[*MIZUHO_FILES]
|
17
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
%global gem_name mizuho
|
2
|
+
%global gem_version <%= PACKAGE_VERSION %>
|
3
|
+
|
4
|
+
%if 0%{?fc18}
|
5
|
+
%global rubyabi 1.9.1
|
6
|
+
%endif
|
7
|
+
|
8
|
+
%if 0%{?el6}
|
9
|
+
%global rubyabi 1.8
|
10
|
+
%endif
|
11
|
+
|
12
|
+
Name: rubygem-%{gem_name}
|
13
|
+
Version: %{gem_version}
|
14
|
+
Release: 1<%= @distribution %>
|
15
|
+
Summary: Documentation formatting tool
|
16
|
+
License: MIT
|
17
|
+
Group: Applications/Text
|
18
|
+
URL: https://github.com/FooBarWidget/mizuho
|
19
|
+
Source0: https://rubygems.org/gems/%{gem_name}-%{gem_version}.gem
|
20
|
+
|
21
|
+
%if 0%{?fedora} >= 19
|
22
|
+
Requires: ruby(release)
|
23
|
+
%else
|
24
|
+
Requires: ruby(abi) = %{rubyabi}
|
25
|
+
%endif
|
26
|
+
Requires: ruby(rubygems)
|
27
|
+
Requires: rubygem-nokogiri
|
28
|
+
Requires: rubygem-sqlite3-ruby
|
29
|
+
Requires: python
|
30
|
+
Requires: source-highlight
|
31
|
+
|
32
|
+
%if 0%{?fedora} >= 19
|
33
|
+
BuildRequires: ruby(release)
|
34
|
+
%else
|
35
|
+
BuildRequires: ruby(abi) = %{rubyabi}
|
36
|
+
%endif
|
37
|
+
%if 0%{?el6}
|
38
|
+
BuildRequires: ruby(rubygems)
|
39
|
+
%else
|
40
|
+
BuildRequires: rubygems-devel
|
41
|
+
%endif
|
42
|
+
BuildRequires: rubygem-nokogiri
|
43
|
+
BuildRequires: rubygem-sqlite3-ruby
|
44
|
+
|
45
|
+
BuildArch: noarch
|
46
|
+
Provides: rubygem(%{gem_name}) = %{gem_version}-%{release}
|
47
|
+
|
48
|
+
# macros for RHEL6 compatibility:
|
49
|
+
%{!?gem_dir: %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)}
|
50
|
+
%{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{gem_version}}
|
51
|
+
%{!?gem_libdir: %global gem_libdir %{gem_instdir}/lib}
|
52
|
+
%{!?gem_cache: %global gem_cache %{gem_dir}/cache/%{gem_name}-%{gem_version}.gem}
|
53
|
+
%{!?gem_spec: %global gem_spec %{gem_dir}/specifications/%{gem_name}-%{gem_version}.gemspec}
|
54
|
+
%{!?gem_docdir: %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{gem_version}}
|
55
|
+
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]')}
|
56
|
+
|
57
|
+
|
58
|
+
%description
|
59
|
+
Converts Asciidoc input files into nicely outputted HTML, possibly one file per chapter.
|
60
|
+
|
61
|
+
%prep
|
62
|
+
%setup -q -c -T
|
63
|
+
|
64
|
+
%build
|
65
|
+
%if 0%{?el6}
|
66
|
+
mkdir -p .%{gem_dir}
|
67
|
+
gem install \
|
68
|
+
--local \
|
69
|
+
--install-dir .%{gem_dir} \
|
70
|
+
--bindir .%{_bindir} \
|
71
|
+
--no-rdoc --no-ri \
|
72
|
+
--force \
|
73
|
+
--backtrace \
|
74
|
+
%{SOURCE0}
|
75
|
+
%else
|
76
|
+
%gem_install -n %{SOURCE0} --no-rdoc --no-ri
|
77
|
+
%endif
|
78
|
+
|
79
|
+
%install
|
80
|
+
rm -rf %{buildroot}
|
81
|
+
mkdir -p %{buildroot}%{gem_dir}
|
82
|
+
cp -a .%{_prefix}/* %{buildroot}%{_prefix}/
|
83
|
+
#if is_distribution?(">= amazon")
|
84
|
+
# On Amazon Linux, 'ruby' is a symlink that can point to multiple alternatives.
|
85
|
+
# Lock down to the default Ruby, 1.8.
|
86
|
+
sed -i 's|/usr/bin/ruby$|/usr/bin/ruby1.8|' %{buildroot}%{_bindir}/mizuho
|
87
|
+
sed -i 's|/usr/bin/ruby$|/usr/bin/ruby1.8|' %{buildroot}%{_bindir}/mizuho-asciidoc
|
88
|
+
#endif
|
89
|
+
# RHEL 5 provides the sqlite3-ruby gem but not the sqlite3 gem, so
|
90
|
+
# we modify the spec to depend on sqlite3-ruby instead.
|
91
|
+
sed -i 's/sqlite3/sqlite3-ruby/' %{buildroot}%{gem_spec}
|
92
|
+
|
93
|
+
%check
|
94
|
+
pushd %{buildroot}%{gem_instdir}
|
95
|
+
ruby -Ilib ./bin/mizuho --help > /dev/null
|
96
|
+
popd
|
97
|
+
|
98
|
+
%clean
|
99
|
+
rm -rf %{buildroot}
|
100
|
+
|
101
|
+
%files
|
102
|
+
%defattr(-,root,root,-)
|
103
|
+
%{_bindir}/mizuho
|
104
|
+
%{_bindir}/mizuho-asciidoc
|
105
|
+
%dir %{gem_instdir}
|
106
|
+
%doc %{gem_instdir}/LICENSE.txt
|
107
|
+
%doc %{gem_instdir}/README.markdown
|
108
|
+
%{gem_instdir}/mizuho.gemspec
|
109
|
+
%{gem_instdir}/bin
|
110
|
+
%{gem_instdir}/asciidoc
|
111
|
+
%{gem_instdir}/test
|
112
|
+
%{gem_instdir}/templates
|
113
|
+
%{gem_libdir}
|
114
|
+
%exclude %{gem_instdir}/Rakefile
|
115
|
+
%exclude %{gem_instdir}/debian.template
|
116
|
+
%exclude %{gem_instdir}/rpm
|
117
|
+
%exclude %{gem_instdir}/source-highlight
|
118
|
+
%exclude %{gem_cache}
|
119
|
+
%{gem_spec}
|
120
|
+
|
121
|
+
%changelog
|
122
|
+
* Wed Dec 11 2013 Hongli Lai <hongli@phusion.nl> - 0.9.19-1<%= @distribution %>
|
123
|
+
- Initial packaging
|
data/templates/topbar.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="topbar" style="display: none">
|
2
2
|
<div class="title">
|
3
|
-
|
4
|
-
<a href="javascript:void(Mizuho.smoothlyScrollToToc())">{TITLE}</a>
|
3
|
+
<!-- Don't put a space between the img and a. That will break the hover layout. -->
|
4
|
+
<img src="{INLINE_IMAGE:arrow-up.png}" width="11" height="10" alt=""><a href="javascript:void(Mizuho.smoothlyScrollToToc())">{TITLE}</a>
|
5
5
|
</div>
|
6
6
|
<a href="javascript:void(0)" id="current_section"></a>
|
7
7
|
</div>
|
data/test/id_map_spec.rb
CHANGED
@@ -90,6 +90,15 @@ describe IdMap do
|
|
90
90
|
@entry2.should_not be_fuzzy
|
91
91
|
@entry3.should_not be_fuzzy
|
92
92
|
end
|
93
|
+
|
94
|
+
specify "bug fix" do
|
95
|
+
@id_map = IdMap.new
|
96
|
+
@entry1 = @id_map.add("2.9.3. Environment variables and sudo", nil, false, false)
|
97
|
+
@entry2 = @id_map.add("2.9.8. Environment variables and sudo", nil, false, false)
|
98
|
+
@id_map.generate_associations(["14.5. Environment variables and sudo"])
|
99
|
+
@id1 = @id_map.associations["14.5. Environment variables and sudo"]
|
100
|
+
@id1.should == @entry1.id
|
101
|
+
end
|
93
102
|
end
|
94
103
|
|
95
104
|
describe "if one or more similar titles exist in the map" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mizuho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- README.markdown
|
57
57
|
- LICENSE.txt
|
58
58
|
- Rakefile
|
59
|
+
- mizuho.gemspec
|
59
60
|
- bin/mizuho
|
60
61
|
- bin/mizuho-asciidoc
|
61
62
|
- lib/mizuho/fuzzystringmatch.rb
|
@@ -70,8 +71,11 @@ files:
|
|
70
71
|
- debian.template/control.template
|
71
72
|
- debian.template/copyright
|
72
73
|
- debian.template/mizuho.install.template
|
73
|
-
- debian.template/
|
74
|
+
- debian.template/ruby-interpreter
|
75
|
+
- debian.template/rules.template
|
74
76
|
- debian.template/source/format
|
77
|
+
- rpm/get_distro_id.py
|
78
|
+
- rpm/rubygem-mizuho.spec.template
|
75
79
|
- test/generator_spec.rb
|
76
80
|
- test/id_map_spec.rb
|
77
81
|
- test/parser_spec.rb
|
@@ -417,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
417
421
|
version: '0'
|
418
422
|
requirements: []
|
419
423
|
rubyforge_project:
|
420
|
-
rubygems_version: 1.8.
|
424
|
+
rubygems_version: 1.8.23
|
421
425
|
signing_key:
|
422
426
|
specification_version: 3
|
423
427
|
summary: Mizuho documentation formatting tool
|
metadata.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABAgAGBQJSqu2oAAoJECrHRaUKISqM6cwH/3X4yv8+B/ABzJ1/jviSqlYL
|
6
|
+
DkpVvFUb8i5UDFwhDZKqwxc6Dw92ZLq5FPrm5rpcKmw8XklIqYPqsPIm61Wyz7Hm
|
7
|
+
+f3X362IWXGGnr1wHS4buuK9erGLgWICUTbBQeom3Ch1kI3/AJcc2RuZa0ijRMGh
|
8
|
+
EqxjqYH1SRTthaTcagRjCLqMoZOQni8/5BfmV6q3k/XcM9M/Jnz/uN+do2qiGoc0
|
9
|
+
Kg3E1qbw83gcI7ARxo4PiPFhXhU+XNEH7jcZSb51FHG+xFazSnUkH8b9EZ+50VV/
|
10
|
+
HK7aaaQBp4ysoRoGJD4aoCd4Jcf8nKdCH6XhxVUB4LHubRD67BIXEDqagnASpDA=
|
11
|
+
=COPA
|
12
12
|
-----END PGP SIGNATURE-----
|
data/debian.template/rules
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/make -f
|
2
|
-
export DH_VERBOSE=1
|
3
|
-
|
4
|
-
%:
|
5
|
-
dh $@ --buildsystem=ruby
|
6
|
-
|
7
|
-
override_dh_install:
|
8
|
-
dh_install
|
9
|
-
sed -i 's/NATIVELY_PACKAGED = .*/NATIVELY_PACKAGED = true/' debian/mizuho/usr/lib/ruby/vendor_ruby/mizuho.rb
|
10
|
-
sed -i 's/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/' debian/mizuho/usr/bin/mizuho
|