summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorara.t.howard <ara.t.howard@gmail.com>2011-08-16 22:43:07 -0600
committerara.t.howard <ara.t.howard@gmail.com>2011-08-16 22:43:07 -0600
commit38596faf51d2425d803b59335563626798d2edac (patch)
treec3f070a16d36348903ad69581849927c37a70f96
parentf23f79f2b265d6a2d76251fb866110bd98439827 (diff)
downloadsystemu-38596faf51d2425d803b59335563626798d2edac.tar.gz
use Marshal. not YAML. release 2.3.0
-rw-r--r--README8
-rw-r--r--Rakefile58
-rw-r--r--lib/systemu.rb7
-rw-r--r--systemu.gemspec23
4 files changed, 60 insertions, 36 deletions
diff --git a/README b/README
index 82a2089..006bf9e 100644
--- a/README
+++ b/README
@@ -53,7 +53,7 @@ SAMPLES
~ > ruby samples/a.rb
- [#<Process::Status: pid=44129,exited(0)>, "Tue Apr 12 21:43:07 -0600 2011\n", "Tue Apr 12 21:43:07 -0600 2011\n"]
+ [#<Process::Status: pid=17907,exited(0)>, "Tue Aug 16 22:40:42 -0600 2011\n", "Tue Aug 16 22:40:42 -0600 2011\n"]
<========< samples/b.rb >========>
@@ -75,7 +75,7 @@ SAMPLES
~ > ruby samples/b.rb
- [#<Process::Status: pid=44134,exited(0)>, "Tue Apr 12 21:43:07 -0600 2011\n", "Tue Apr 12 21:43:07 -0600 2011\n"]
+ [#<Process::Status: pid=17912,exited(0)>, "Tue Aug 16 22:40:42 -0600 2011\n", "Tue Aug 16 22:40:42 -0600 2011\n"]
<========< samples/c.rb >========>
@@ -163,7 +163,7 @@ SAMPLES
~ > ruby samples/f.rb
- #<Process::Status: pid=44154,signaled(SIGKILL=9)>
- "1302666187\n1302666188\n1302666189\n"
+ #<Process::Status: pid=17932,signaled(SIGKILL=9)>
+ "1313556042\n1313556043\n1313556044\n"
diff --git a/Rakefile b/Rakefile
index 44e9122..ae00991 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,8 +1,11 @@
This.rubyforge_project = 'codeforpeople'
This.author = "Ara T. Howard"
This.email = "ara.t.howard@gmail.com"
-This.homepage = "http://github.com/ahoward/#{ This.lib }"
+This.homepage = "https://github.com/ahoward/#{ This.lib }"
+task :license do
+ open('LICENSE', 'w'){|fd| fd.puts "same as ruby's"}
+end
task :default do
puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
@@ -26,11 +29,10 @@ def run_tests!(which = nil)
div = ('=' * 119)
line = ('-' * 119)
- helper = "-r ./test/helper.rb" if test(?e, "./test/helper.rb")
test_rbs.each_with_index do |test_rb, index|
testno = index + 1
- command = "#{ This.ruby } -I ./lib -I ./test/lib #{ helper } #{ test_rb }"
+ command = "#{ This.ruby } -I ./lib -I ./test/lib #{ test_rb }"
puts
say(div, :color => :cyan, :bold => true)
@@ -59,9 +61,9 @@ end
task :gemspec do
- ignore_extensions = 'git', 'svn', 'tmp', /sw./, 'bak', 'gem'
- ignore_directories = %w[ pkg ]
- ignore_files = %w[ test/log ]
+ ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
+ ignore_directories = ['pkg']
+ ignore_files = ['test/log', 'a.rb']
shiteless =
lambda do |list|
@@ -87,7 +89,7 @@ task :gemspec do
version = This.version
files = shiteless[Dir::glob("**/**")]
executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
- has_rdoc = true #File.exist?('doc')
+ #has_rdoc = true #File.exist?('doc')
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
@@ -117,15 +119,15 @@ task :gemspec do
spec.summary = #{ lib.inspect }
spec.description = #{ description.inspect }
- spec.files = #{ files.inspect }
+ spec.files =\n#{ files.sort.pretty_inspect }
spec.executables = #{ executables.inspect }
spec.require_path = "lib"
- spec.has_rdoc = #{ has_rdoc.inspect }
spec.test_files = #{ test_files.inspect }
- # spec.add_dependency 'lib', '>= version'
+ ### spec.add_dependency 'lib', '>= version'
+ #### spec.add_dependency 'map'
spec.extensions.push(*#{ extensions.inspect })
@@ -139,8 +141,9 @@ task :gemspec do
end
Fu.mkdir_p(This.pkgdir)
- This.gemspec = File.join(This.dir, "#{ This.lib }.gemspec") #File.join(This.pkgdir, "gemspec.rb")
- open("#{ This.gemspec }", "w"){|fd| fd.puts(template)}
+ gemspec = "#{ lib }.gemspec"
+ open(gemspec, "w"){|fd| fd.puts(template)}
+ This.gemspec = gemspec
end
task :gem => [:clean, :gemspec] do
@@ -150,8 +153,8 @@ task :gem => [:clean, :gemspec] do
`#{ cmd }`
after = Dir['*.gem']
gem = ((after - before).first || after.first) or abort('no gem!')
- Fu.mv gem, This.pkgdir
- This.gem = File.basename(gem)
+ Fu.mv(gem, This.pkgdir)
+ This.gem = File.join(This.pkgdir, File.basename(gem))
end
task :readme do
@@ -207,12 +210,18 @@ task :release => [:clean, :gemspec, :gem] do
gems = Dir[File.join(This.pkgdir, '*.gem')].flatten
raise "which one? : #{ gems.inspect }" if gems.size > 1
raise "no gems?" if gems.size < 1
- cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.pkgdir }/#{ This.gem }"
+
+ cmd = "gem push #{ This.gem }"
puts cmd
- system cmd
- cmd = "gem push #{ This.pkgdir }/#{ This.gem }"
+ puts
+ system(cmd)
+ abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
+
+ cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
puts cmd
- system cmd
+ puts
+ system(cmd)
+ abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
end
@@ -228,6 +237,7 @@ BEGIN {
require 'erb'
require 'fileutils'
require 'rbconfig'
+ require 'pp'
# fu shortcut
#
@@ -286,11 +296,11 @@ BEGIN {
def unindent(s)
indent = nil
s.each_line do |line|
- next if line =~ %r/^\s*$/
- indent = line[%r/^\s*/] and break
- end
- indent ? s.gsub(%r/^#{ indent }/, "") : s
+ next if line =~ %r/^\s*$/
+ indent = line[%r/^\s*/] and break
end
+ indent ? s.gsub(%r/^#{ indent }/, "") : s
+ end
extend self
end
@@ -298,11 +308,11 @@ BEGIN {
#
class Template
def initialize(&block)
- @block = block.binding
+ @block = block
@template = block.call.to_s
end
def expand(b=nil)
- ERB.new(Util.unindent(@template)).result(b||@block)
+ ERB.new(Util.unindent(@template)).result((b||@block).binding)
end
alias_method 'to_s', 'expand'
end
diff --git a/lib/systemu.rb b/lib/systemu.rb
index 56ea580..f0dbb8c 100644
--- a/lib/systemu.rb
+++ b/lib/systemu.rb
@@ -4,7 +4,6 @@ require 'socket'
require 'fileutils'
require 'rbconfig'
require 'thread'
-require 'yaml'
class Object
def systemu(*a, &b) SystemUniversal.new(*a, &b).systemu end
@@ -14,7 +13,7 @@ class SystemUniversal
#
# constants
#
- SystemUniversal::VERSION = '2.2.0' unless SystemUniversal.send(:const_defined?, :VERSION)
+ SystemUniversal::VERSION = '2.3.0' unless SystemUniversal.send(:const_defined?, :VERSION)
def SystemUniversal.version() SystemUniversal::VERSION end
def version() SystemUniversal::VERSION end
#
@@ -155,7 +154,7 @@ class SystemUniversal
c['stdout'] = stdout
c['stderr'] = stderr
c['program'] = program
- open(config, 'w'){|f| YAML.dump c, f}
+ open(config, 'w'){|f| Marshal.dump(c, f)}
open(program, 'w'){|f| f.write child_program(config)}
@@ -176,7 +175,7 @@ class SystemUniversal
begin
require 'yaml'
- config = YAML.load(IO.read('#{ config }'))
+ config = Marshal.load(IO.read('#{ config }'))
argv = config['argv']
env = config['env']
diff --git a/systemu.gemspec b/systemu.gemspec
index 74e0c45..057ae50 100644
--- a/systemu.gemspec
+++ b/systemu.gemspec
@@ -8,20 +8,35 @@ Gem::Specification::new do |spec|
spec.summary = "systemu"
spec.description = "description: systemu kicks the ass"
- spec.files = ["lib", "lib/systemu.rb", "LICENSE", "Rakefile", "README", "README.erb", "samples", "samples/a.rb", "samples/b.rb", "samples/c.rb", "samples/d.rb", "samples/e.rb", "samples/f.rb"]
+ spec.files =
+["LICENSE",
+ "README",
+ "README.erb",
+ "Rakefile",
+ "lib",
+ "lib/systemu.rb",
+ "samples",
+ "samples/a.rb",
+ "samples/b.rb",
+ "samples/c.rb",
+ "samples/d.rb",
+ "samples/e.rb",
+ "samples/f.rb",
+ "systemu.gemspec"]
+
spec.executables = []
spec.require_path = "lib"
- spec.has_rdoc = true
spec.test_files = nil
-# spec.add_dependency 'lib', '>= version'
+### spec.add_dependency 'lib', '>= version'
+#### spec.add_dependency 'map'
spec.extensions.push(*[])
spec.rubyforge_project = "codeforpeople"
spec.author = "Ara T. Howard"
spec.email = "ara.t.howard@gmail.com"
- spec.homepage = "http://github.com/ahoward/systemu"
+ spec.homepage = "https://github.com/ahoward/systemu"
end