rakeutils 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/lib/rakeutils/ocratask.rb +10 -7
- data/lib/rakeutils/tex2rtf.rb +46 -38
- data/lib/rakeutils/version.rb +1 -1
- data/lib/rakeutils/versioninc.rb +54 -61
- data/lib/rakeutils/ziptask.rb +50 -38
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71865bbd8275fdd726db97db6f5227c059d19a2b
|
4
|
+
data.tar.gz: 44b7347151ee601a87af3eb449360af7fe16347f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 081ec9d7b9cf889068923210a322f5969e117d97720ddbb522f438d6bd3321823f30645798c784c6431ca23fcf10bec739b674c71936509192be251b1200b24b
|
7
|
+
data.tar.gz: de4daedb6285f4a474ced95677b33f7bfa17a49ddd77288f3abd3ec37af1ba3237bfe71f2bd105a0367c4be79be6b9115d2d3426734bc379d40f1f70e31aecde
|
data/lib/rakeutils/ocratask.rb
CHANGED
@@ -21,17 +21,20 @@ require_relative 'clapp'
|
|
21
21
|
class OcraTask < CLApp
|
22
22
|
include FileUtils
|
23
23
|
|
24
|
-
if Ktutils::OS.windows?
|
25
|
-
APP_PATH = "N:/Ruby/bin/ruby.exe"
|
26
|
-
else
|
27
|
-
APP_PATH = `which ruby`.chomp
|
28
|
-
end
|
29
|
-
|
30
24
|
# Constructor
|
31
25
|
def initialize()
|
32
|
-
super(
|
26
|
+
super( find_app )
|
33
27
|
end # initialize
|
34
28
|
|
29
|
+
def find_app
|
30
|
+
if Ktutils::OS.windows?
|
31
|
+
# We expect that ruby is on the user's PATH.
|
32
|
+
app_home = "ruby.exe"
|
33
|
+
else
|
34
|
+
raise "cannot use OCRA on linux based systems"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
35
38
|
# Generate executable application from a ruby script.Compile setup script.
|
36
39
|
# script:: Script to be compiled
|
37
40
|
def compile(script)
|
data/lib/rakeutils/tex2rtf.rb
CHANGED
@@ -19,44 +19,52 @@ require_relative 'clapp'
|
|
19
19
|
class Tex2Rtf < CLApp
|
20
20
|
include FileUtils
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# Constructor
|
26
|
-
def initialize()
|
27
|
-
super( APP_PATH ) # Call parent constructor.
|
28
|
-
end # initialize
|
29
|
-
|
30
|
-
|
31
|
-
# Generate help files.
|
32
|
-
# srcPath:: Source file [.tex]. Path must use forward slashes.
|
33
|
-
# destPath:: Destination file. Path must use forward slashes.
|
34
|
-
def generateHelpFiles(srcPath, destPath)
|
35
|
-
srcDir = File.dirname( File.expand_path( srcPath ) )
|
36
|
-
srcFile = File.basename( srcPath )
|
37
|
-
destPath = File.expand_path( destPath )
|
38
|
-
destDir = File.dirname( destPath )
|
39
|
-
|
40
|
-
puts "srcDir: #{srcDir}"
|
41
|
-
puts "srcPath: #{srcPath}"
|
42
|
-
puts "destDir: #{destDir}"
|
43
|
-
puts "destPath: #{destPath}"
|
44
|
-
|
45
|
-
if( !File.exists?( destDir ) ) # Create the destination dir if it doesn't exits.
|
46
|
-
File.makedirs( destDir, true )
|
47
|
-
end
|
48
|
-
|
49
|
-
cmdLine = "#{srcFile} #{destPath} -checkcurleybraces -checksyntax -html"
|
50
|
-
|
51
|
-
curDir = pwd
|
52
|
-
cd( srcDir )
|
53
|
-
begin
|
54
|
-
execute( cmdLine, false )
|
55
|
-
rescue
|
56
|
-
# do nothing
|
57
|
-
end
|
58
|
-
cd( curDir )
|
59
|
-
end # generateHelpFiles
|
22
|
+
#APP_PATH = "M:/Tex2RTF/tex2rtf.exe"
|
60
23
|
|
24
|
+
# Constructor
|
25
|
+
def initialize()
|
26
|
+
super( find_app )
|
27
|
+
end # initialize
|
61
28
|
|
29
|
+
def find_app
|
30
|
+
if Ktutils::OS.windows?
|
31
|
+
app_home = ENV["TEX2RTF_HOME"]
|
32
|
+
unless app_home.nil? or app_home.empty?
|
33
|
+
app_path = File.join(app_home, "tex2rtf.exe")
|
34
|
+
end
|
35
|
+
else
|
36
|
+
raise "cannot use tex2rtf on linux based systems"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Generate help files.
|
41
|
+
# src_path:: Source file [.tex]. Path must use forward slashes.
|
42
|
+
# dest_path:: Destination file. Path must use forward slashes.
|
43
|
+
def generate_help_files(src_path, dest_path)
|
44
|
+
src_dir = File.dirname( File.expand_path( src_path ) )
|
45
|
+
src_file = File.basename( src_path )
|
46
|
+
dest_path = File.expand_path( dest_path )
|
47
|
+
dest_dir = File.dirname( dest_path )
|
48
|
+
|
49
|
+
puts "src_dir: #{src_dir}"
|
50
|
+
puts "src_path: #{src_path}"
|
51
|
+
puts "dest_dir: #{dest_dir}"
|
52
|
+
puts "dest_path: #{dest_path}"
|
53
|
+
|
54
|
+
# Create the destination dir if it doesn't exits.
|
55
|
+
if( !File.exists?( dest_dir ) )
|
56
|
+
File.makedirs( dest_dir, true )
|
57
|
+
end
|
58
|
+
|
59
|
+
cmd_line = "#{src_file} #{dest_path} -checkcurleybraces -checksyntax -html"
|
60
|
+
|
61
|
+
cur_dir = pwd
|
62
|
+
cd( src_dir )
|
63
|
+
begin
|
64
|
+
execute( cmd_line, false )
|
65
|
+
rescue
|
66
|
+
# do nothing
|
67
|
+
end
|
68
|
+
cd( cur_dir )
|
69
|
+
end # generate_help_files
|
62
70
|
end # class Tex2Rtf
|
data/lib/rakeutils/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module RakeUtils
|
2
|
-
VERSION = "0.1.
|
2
|
+
VERSION = "0.1.1" unless constants.include?("VERSION")
|
3
3
|
APPNAME = "RakeUtils" unless constants.include?("APPNAME")
|
4
4
|
COPYRIGHT = "Copyright (c) 2014, kTech Systems LLC. All rights reserved" unless constants.include?("COPYRIGHT")
|
5
5
|
end
|
data/lib/rakeutils/versioninc.rb
CHANGED
@@ -13,73 +13,66 @@
|
|
13
13
|
class VersionIncrementer
|
14
14
|
include FileUtils
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
# If optional filename is supplied, load the version from the file.
|
17
|
+
def initialize(filename=nil)
|
18
|
+
@version = [0,0,0]
|
19
|
+
read(filename) unless filename.nil?
|
20
|
+
end # initialize
|
21
21
|
|
22
|
+
def version()
|
23
|
+
@version.join(".")
|
24
|
+
end
|
22
25
|
|
23
|
-
|
24
|
-
|
26
|
+
def inc_major( filename )
|
27
|
+
read( filename )
|
28
|
+
@version[0] = @version[0] + 1
|
29
|
+
write( filename )
|
30
|
+
end # inc_major
|
31
|
+
|
32
|
+
def inc_minor( filename )
|
33
|
+
read( filename )
|
34
|
+
@version[1] = @version[1] + 1
|
35
|
+
write( filename )
|
36
|
+
end # inc_minor
|
37
|
+
|
38
|
+
def inc_build( filename )
|
39
|
+
read( filename )
|
40
|
+
@version[2] = @version[2] + 1
|
41
|
+
write( filename )
|
42
|
+
end # inc_build
|
43
|
+
|
44
|
+
def write_setup_ini(filename)
|
45
|
+
version = @version.join(".")
|
46
|
+
open(filename, 'w') do |f|
|
47
|
+
f << "[Info]\n"
|
48
|
+
f << "VerInfo=#{version}\n"
|
25
49
|
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
read( filename )
|
30
|
-
@version[0] = @version[0] + 1
|
31
|
-
write( filename )
|
32
|
-
end # incMajor
|
33
|
-
|
34
|
-
def incMinor( filename )
|
35
|
-
read( filename )
|
36
|
-
@version[1] = @version[1] + 1
|
37
|
-
write( filename )
|
38
|
-
end # incMinor
|
39
|
-
|
40
|
-
def incBuild( filename )
|
41
|
-
read( filename )
|
42
|
-
@version[2] = @version[2] + 1
|
43
|
-
write( filename )
|
44
|
-
end # incBuild
|
45
|
-
|
50
|
+
end # write_setup_ini
|
51
|
+
|
52
|
+
private
|
46
53
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
f << "VerInfo=#{version}\n"
|
52
|
-
end
|
53
|
-
|
54
|
-
end # writeSetupIni
|
55
|
-
|
56
|
-
|
57
|
-
private
|
58
|
-
def write(filename)
|
59
|
-
version = @version.join(".")
|
60
|
-
open(filename, 'w') { |f| f << version }
|
61
|
-
|
62
|
-
end #write
|
54
|
+
def write(filename)
|
55
|
+
version = @version.join(".")
|
56
|
+
open(filename, 'w') { |f| f << version }
|
57
|
+
end #write
|
63
58
|
|
59
|
+
def read(filename)
|
60
|
+
filepath = filename
|
64
61
|
|
65
|
-
|
66
|
-
|
62
|
+
version = ""
|
63
|
+
open(filepath) { |f| version = f.gets(nil) }
|
64
|
+
version.strip!
|
65
|
+
version.chomp!
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
aVersion = version.split( "." )
|
74
|
-
if( aVersion.length != 3 )
|
75
|
-
puts "ERROR: Version string must be 3 components. Bad string: #{version}"
|
76
|
-
return
|
77
|
-
end
|
78
|
-
|
79
|
-
aVersion.each_index do |i|
|
80
|
-
@version[i] = aVersion[i].to_i
|
81
|
-
end
|
67
|
+
a_version = version.split( "." )
|
68
|
+
if( a_version.length != 3 )
|
69
|
+
puts "ERROR: Version string must be 3 components. Bad string: #{version}"
|
70
|
+
return
|
82
71
|
end
|
83
|
-
|
84
|
-
|
72
|
+
|
73
|
+
a_version.each_index do |i|
|
74
|
+
@version[i] = a_version[i].to_i
|
75
|
+
end
|
76
|
+
end
|
85
77
|
end # class VersionIncrementer
|
78
|
+
|
data/lib/rakeutils/ziptask.rb
CHANGED
@@ -20,44 +20,56 @@ require_relative 'clapp'
|
|
20
20
|
class ZipTask < CLApp
|
21
21
|
include FileUtils
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
# Constructor
|
27
|
-
def initialize()
|
28
|
-
super( APP_PATH ) # Call parent constructor.
|
29
|
-
end # initialize
|
30
|
-
|
31
|
-
|
32
|
-
# Compress all files within a directory.
|
33
|
-
# srcPath:: Source directory. Path must use forward slashes.
|
34
|
-
# archivePath:: Destination file. Path must use forward slashes.
|
35
|
-
def compress(srcPath, archivePath)
|
36
|
-
srcDir = File.dirname( File.expand_path( srcPath ) )
|
37
|
-
srcFile = File.basename( srcPath )
|
38
|
-
archivePath = File.expand_path( archivePath )
|
39
|
-
destDir = File.dirname( archivePath )
|
40
|
-
|
41
|
-
puts "srcDir: #{srcDir}"
|
42
|
-
puts "srcPath: #{srcPath}"
|
43
|
-
puts "destDir: #{destDir}"
|
44
|
-
puts "archivePath: #{archivePath}"
|
45
|
-
|
46
|
-
if( !File.exists?( destDir ) ) # Create the destination dir if it doesn't exits.
|
47
|
-
File.makedirs( destDir, true )
|
48
|
-
end
|
49
|
-
|
50
|
-
cmdLine = "-tzip u #{archivePath} #{srcPath}"
|
51
|
-
|
52
|
-
curDir = pwd
|
53
|
-
cd( srcDir )
|
54
|
-
begin
|
55
|
-
execute( cmdLine, false )
|
56
|
-
rescue
|
57
|
-
# do nothing
|
58
|
-
end
|
59
|
-
cd( curDir )
|
60
|
-
end # compress
|
23
|
+
# Constructor
|
24
|
+
def initialize()
|
25
|
+
super( find_app )
|
61
26
|
|
27
|
+
app_path = find_app
|
28
|
+
if app_path.nil? or app_path.empty?
|
29
|
+
if Ktutils::OS.windows?
|
30
|
+
raise "7Zip is not installed"
|
31
|
+
else
|
32
|
+
raise "7z not found"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end # initialize
|
62
36
|
|
37
|
+
def find_app
|
38
|
+
if Ktutils::OS.windows?
|
39
|
+
app_home = "7za.exe"
|
40
|
+
else
|
41
|
+
app_path = `which 7z`.chomp
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Compress all files within a directory.
|
46
|
+
# src_path:: Source directory. Path must use forward slashes.
|
47
|
+
# archive_path:: Destination file. Path must use forward slashes.
|
48
|
+
def compress(src_path, archive_path)
|
49
|
+
src_dir = File.dirname( File.expand_path( src_path ) )
|
50
|
+
src_file = File.basename( src_path )
|
51
|
+
archive_path = File.expand_path( archive_path )
|
52
|
+
dest_dir = File.dirname( archive_path )
|
53
|
+
|
54
|
+
puts "src_dir: #{src_dir}"
|
55
|
+
puts "src_path: #{src_path}"
|
56
|
+
puts "dest_dir: #{dest_dir}"
|
57
|
+
puts "archive_path: #{archive_path}"
|
58
|
+
|
59
|
+
# Create the destination dir if it doesn't exist.
|
60
|
+
if( !File.exists?( dest_dir ) )
|
61
|
+
File.makedirs( dest_dir, true )
|
62
|
+
end
|
63
|
+
|
64
|
+
cmd_line = "-tzip u #{archive_path} #{src_path}"
|
65
|
+
|
66
|
+
cur_dir = pwd
|
67
|
+
cd( src_dir )
|
68
|
+
begin
|
69
|
+
execute( cmd_line, false )
|
70
|
+
rescue
|
71
|
+
# do nothing
|
72
|
+
end
|
73
|
+
cd( cur_dir )
|
74
|
+
end # compress
|
63
75
|
end # class ZipTask
|