Compare commits
7 commits
e1eeb03e56
...
7221a3e9d8
Author | SHA1 | Date | |
---|---|---|---|
7221a3e9d8 | |||
c14a4e64a5 | |||
|
dcf100d42e | ||
|
56969ca5b3 | ||
|
a429b71282 | ||
|
31da8a7201 | ||
|
882e410c6f |
5 changed files with 122 additions and 14 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.gem
|
59
Makefile
Normal file
59
Makefile
Normal file
|
@ -0,0 +1,59 @@
|
|||
DESTDIR=
|
||||
|
||||
NAME=xtm-utils
|
||||
GEMNAME=xtm-utils
|
||||
RUBYVERSION=1.8
|
||||
|
||||
BINDIR=$(DESTDIR)/usr/bin
|
||||
MANDIR=$(DESTDIR)/usr/share/man
|
||||
LIBDIR=$(DESTDIR)/usr/lib/ruby/$(RUBYVERSION)
|
||||
DOCDIR=$(DESTDIR)/usr/share/doc/$(NAME)
|
||||
|
||||
RDOC=rdoc$(RUBYVERSION)
|
||||
#RDOC=rdoc1.9
|
||||
all: doc test
|
||||
|
||||
clean:
|
||||
rm -fr doc *.gem
|
||||
|
||||
build:
|
||||
|
||||
.PHONY: doc doc-reader
|
||||
doc-reader: doc
|
||||
xdg-open file://`pwd`/doc/api/index.html
|
||||
|
||||
doc:
|
||||
rm -fr doc/api
|
||||
$(RDOC) \
|
||||
--promiscuous \
|
||||
--inline-source \
|
||||
--line-numbers \
|
||||
-o doc/api lib/
|
||||
# --diagram
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(MAKE) -C test
|
||||
|
||||
install: doc test
|
||||
# install libraries
|
||||
#
|
||||
find lib -name '*.rb' |while read FILE ; do \
|
||||
FILEPATH=`echo $$FILE |sed -e "s~^lib~$(LIBDIR)~"` ; \
|
||||
install -D -o root -g root -m 644 $$FILE $$FILEPATH ; \
|
||||
done
|
||||
# install binaries
|
||||
find bin -name '*.rb' |while read FILE ; do \
|
||||
FILEPATH=`echo $$FILE |sed -e "s~^bin~$(BINDIR)~"` ; \
|
||||
install -D -o root -g root -m 755 $$FILE $$FILEPATH ; \
|
||||
done
|
||||
# install documentation
|
||||
rm -fr $(DOCDIR)
|
||||
mkdir -p $(DOCDIR)
|
||||
cp -a doc $(DOCDIR)
|
||||
|
||||
gem:
|
||||
gem build $(GEMNAME).gemspec
|
||||
|
||||
gem_install:
|
||||
gem install $(GEMNAME)*.gem
|
36
xtm-utils.gemspec
Normal file
36
xtm-utils.gemspec
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/ruby -d
|
||||
|
||||
require 'rake'
|
||||
|
||||
spec = Gem::Specification.new do |s|
|
||||
s.author = 'Glenn Y. Rolland'
|
||||
s.email = 'glenux@glenux.net'
|
||||
s.homepage = 'http://glenux.github.com/xtm-utils/'
|
||||
|
||||
s.signing_key = ENV['GEM_PRIVATE_KEY']
|
||||
s.cert_chain = ENV['GEM_CERTIFICATE_CHAIN']
|
||||
|
||||
s.name = 'xtm-utils'
|
||||
s.version = '0.1'
|
||||
s.summary = 'A set of tools for joining or splitting files using the XTM format.'
|
||||
s.description = ' xtm-utils is a set of tools for joining or splitting files using the XTM format .' \
|
||||
'It is an open-source replacement for the the closed-source binary provided by the XtremSplit website.'
|
||||
|
||||
s.required_ruby_version = '>= 1.8.5'
|
||||
|
||||
s.require_paths = ['xtmfile']
|
||||
s.files = FileList[
|
||||
"xtmfile/*.rb",
|
||||
"bin/*",
|
||||
].to_a + [
|
||||
"Makefile",
|
||||
"xtm-utils.gemspec",
|
||||
"COPYING",
|
||||
"README.rdoc"
|
||||
]
|
||||
s.files.reject! { |fn| fn.include? "coverage" }
|
||||
|
||||
puts "== GEM CONTENT =="
|
||||
puts s.files
|
||||
puts "== /GEM CONTENT =="
|
||||
end
|
|
@ -3,6 +3,7 @@ require 'rubygems'
|
|||
gem 'bindata', '~> 1.2.1'
|
||||
require 'bindata'
|
||||
|
||||
# FIXME: set default values for header fields
|
||||
module XtmFile
|
||||
|
||||
#
|
||||
|
|
|
@ -1,19 +1,30 @@
|
|||
|
||||
require 'xtmfile/header'
|
||||
|
||||
module XtmFile
|
||||
class Splitter
|
||||
attr_reader :parts, :parts_size
|
||||
def initialize input_filename
|
||||
@input_filename = input_filename
|
||||
@parts = 0
|
||||
@parts_size = 0
|
||||
end
|
||||
class Splitter
|
||||
attr_reader :parts_size
|
||||
def initialize input_filename
|
||||
@input_filename = input_filename
|
||||
|
||||
def parts= count
|
||||
end
|
||||
# create and initialize header
|
||||
@header = Header.new
|
||||
@header.filename_str = @input_filename
|
||||
end
|
||||
|
||||
def parts_size= size
|
||||
end
|
||||
def parts= count
|
||||
@header.filecount = count
|
||||
@parts_size = @header.filesize / count
|
||||
end
|
||||
|
||||
def start
|
||||
end
|
||||
end
|
||||
def parts_size= size
|
||||
count = @header.filesize / size
|
||||
remain = @header.filesize % size
|
||||
count += 1 if remain > 0
|
||||
@header.filecount = count
|
||||
end
|
||||
|
||||
def start
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue