hpp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hpp.rb +10 -1
- metadata +3 -3
data/lib/hpp.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
require "thor"
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
class Hpp < Thor
|
5
|
+
include FileUtils
|
6
|
+
|
4
7
|
desc "process SRC TARGET", "process HTML files under SRC folder to TARGET folder"
|
5
8
|
def process(src='src', target='target')
|
6
9
|
raise RuntimeError.new("There is NO '#{src}' folder in current working directory") unless Dir.exists?(src)
|
7
10
|
Dir.mkdir(target) unless Dir.exists?(target)
|
8
11
|
|
9
12
|
Dir.glob(File.expand_path('*.html', src)) do |src_path|
|
10
|
-
next if src_path.include? '
|
13
|
+
next if src_path.include? '_'
|
11
14
|
File.open(src_path.sub(src, target), 'w') do |output_html|
|
12
15
|
File.open(src_path, 'r') do |source_html|
|
13
16
|
while line = source_html.gets
|
@@ -24,5 +27,11 @@ class Hpp < Thor
|
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|
30
|
+
|
31
|
+
Dir.foreach(src) do |file|
|
32
|
+
next if /^\.+/.match file
|
33
|
+
file = File.expand_path(file, src)
|
34
|
+
cp_r file, target if File.directory?(file)
|
35
|
+
end
|
27
36
|
end
|
28
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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: 2012-09-
|
12
|
+
date: 2012-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
segments:
|
53
53
|
- 0
|
54
|
-
hash: -
|
54
|
+
hash: -2175429568060687941
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|