nio 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/tasks/spec.rake ADDED
@@ -0,0 +1,54 @@
1
+
2
+ if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
3
+ require 'spec/rake/verify_rcov'
4
+
5
+ namespace :spec do
6
+
7
+ desc 'Run all specs with basic output'
8
+ Spec::Rake::SpecTask.new(:run) do |t|
9
+ t.ruby_opts = PROJ.ruby_opts
10
+ t.spec_opts = PROJ.spec.opts
11
+ t.spec_files = PROJ.spec.files
12
+ t.libs += PROJ.libs
13
+ end
14
+
15
+ desc 'Run all specs with text output'
16
+ Spec::Rake::SpecTask.new(:specdoc) do |t|
17
+ t.ruby_opts = PROJ.ruby_opts
18
+ t.spec_opts = PROJ.spec.opts + ['--format', 'specdoc']
19
+ t.spec_files = PROJ.spec.files
20
+ t.libs += PROJ.libs
21
+ end
22
+
23
+ if HAVE_RCOV
24
+ desc 'Run all specs with RCov'
25
+ Spec::Rake::SpecTask.new(:rcov) do |t|
26
+ t.ruby_opts = PROJ.ruby_opts
27
+ t.spec_opts = PROJ.spec.opts
28
+ t.spec_files = PROJ.spec.files
29
+ t.libs += PROJ.libs
30
+ t.rcov = true
31
+ t.rcov_dir = PROJ.rcov.dir
32
+ t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
33
+ end
34
+
35
+ RCov::VerifyTask.new(:verify) do |t|
36
+ t.threshold = PROJ.rcov.threshold
37
+ t.index_html = File.join(PROJ.rcov.dir, 'index.html')
38
+ t.require_exact_threshold = PROJ.rcov.threshold_exact
39
+ end
40
+
41
+ task :verify => :rcov
42
+ remove_desc_for_task %w(spec:clobber_rcov)
43
+ end
44
+
45
+ end # namespace :spec
46
+
47
+ desc 'Alias to spec:run'
48
+ task :spec => 'spec:run'
49
+
50
+ task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
51
+
52
+ end # if HAVE_SPEC_RAKE_SPECTASK
53
+
54
+ # EOF
data/tasks/svn.rake ADDED
@@ -0,0 +1,47 @@
1
+
2
+ if HAVE_SVN
3
+
4
+ unless PROJ.svn.root
5
+ info = %x/svn info ./
6
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
7
+ PROJ.svn.root = (m.nil? ? '' : m[1])
8
+ end
9
+ PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
10
+
11
+ namespace :svn do
12
+
13
+ # A prerequisites task that all other tasks depend upon
14
+ task :prereqs
15
+
16
+ desc 'Show tags from the SVN repository'
17
+ task :show_tags => 'svn:prereqs' do |t|
18
+ tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
19
+ tags.gsub!(%r/\/$/, '')
20
+ tags = tags.split("\n").sort {|a,b| b <=> a}
21
+ puts tags
22
+ end
23
+
24
+ desc 'Create a new tag in the SVN repository'
25
+ task :create_tag => 'svn:prereqs' do |t|
26
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
27
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
28
+
29
+ svn = PROJ.svn
30
+ trunk = File.join(svn.root, svn.trunk)
31
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
32
+ tag = File.join(svn.root, svn.tags, tag)
33
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
34
+
35
+ puts "Creating SVN tag '#{tag}'"
36
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
37
+ abort "Tag creation failed"
38
+ end
39
+ end
40
+
41
+ end # namespace :svn
42
+
43
+ task 'gem:release' => 'svn:create_tag'
44
+
45
+ end # if PROJ.svn.path
46
+
47
+ # EOF
data/tasks/test.rake ADDED
@@ -0,0 +1,40 @@
1
+
2
+ if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
3
+ require 'rake/testtask'
4
+
5
+ namespace :test do
6
+
7
+ Rake::TestTask.new(:run) do |t|
8
+ t.libs = PROJ.libs
9
+ t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
10
+ else PROJ.test.files end
11
+ t.ruby_opts += PROJ.ruby_opts
12
+ t.ruby_opts += PROJ.test.opts
13
+ end
14
+
15
+ if HAVE_RCOV
16
+ desc 'Run rcov on the unit tests'
17
+ task :rcov => :clobber_rcov do
18
+ opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
19
+ opts = opts.join(' ')
20
+ files = if test(?f, PROJ.test.file) then [PROJ.test.file]
21
+ else PROJ.test.files end
22
+ files = files.join(' ')
23
+ sh "#{RCOV} #{files} #{opts}"
24
+ end
25
+
26
+ task :clobber_rcov do
27
+ rm_r 'coverage' rescue nil
28
+ end
29
+ end
30
+
31
+ end # namespace :test
32
+
33
+ desc 'Alias to test:run'
34
+ task :test => 'test:run'
35
+
36
+ task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
+
38
+ end
39
+
40
+ # EOF
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Goizueta
@@ -9,22 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-22 00:00:00 +01:00
12
+ date: 2008-12-24 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: hoe
16
+ name: bones
17
17
  type: :development
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.8.0
23
+ version: 2.1.1
24
24
  version:
25
25
  description: Numeric input/output
26
- email:
27
- - javier@goizueta.info
26
+ email: javier@goizueta.info
28
27
  executables: []
29
28
 
30
29
  extensions: []
@@ -32,7 +31,6 @@ extensions: []
32
31
  extra_rdoc_files:
33
32
  - History.txt
34
33
  - License.txt
35
- - Manifest.txt
36
34
  - README.txt
37
35
  - SOURCE.txt
38
36
  files:
@@ -40,41 +38,51 @@ files:
40
38
  - License.txt
41
39
  - Manifest.txt
42
40
  - README.txt
43
- - SOURCE.txt
44
41
  - Rakefile
45
- - config/hoe.rb
46
- - config/requirements.rb
42
+ - SOURCE.txt
47
43
  - lib/nio.rb
48
- - lib/nio/version.rb
49
- - lib/nio/repdec.rb
50
44
  - lib/nio/flttol.rb
51
- - lib/nio/tools.rb
52
- - lib/nio/rtnlzr.rb
53
45
  - lib/nio/fmt.rb
46
+ - lib/nio/repdec.rb
47
+ - lib/nio/rtnlzr.rb
54
48
  - lib/nio/sugar.rb
55
- - script/destroy
56
- - script/destroy.cmd
57
- - script/generate
58
- - script/generate.cmd
59
- - script/txt2html
60
- - script/txt2html.cmd
49
+ - lib/nio/tools.rb
50
+ - lib/nio/version.rb
61
51
  - setup.rb
52
+ - tasks/ann.rake
53
+ - tasks/bones.rake
54
+ - tasks/gem.rake
55
+ - tasks/git.rake
56
+ - tasks/manifest.rake
57
+ - tasks/notes.rake
62
58
  - tasks/nuweb.rake
63
- - tasks/deployment.rake
64
- - tasks/environment.rake
65
- - tasks/website.rake
59
+ - tasks/post_load.rake
60
+ - tasks/rdoc.rake
61
+ - tasks/rubyforge.rake
62
+ - tasks/setup.rb
63
+ - tasks/spec.rake
64
+ - tasks/svn.rake
65
+ - tasks/test.rake
66
66
  - test/data.yaml
67
+ - test/test_fmt.rb
67
68
  - test/test_helper.rb
68
- - test/test_tools.rb
69
69
  - test/test_repdec.rb
70
70
  - test/test_rtnlzr.rb
71
- - test/test_fmt.rb
71
+ - test/test_tools.rb
72
72
  has_rdoc: true
73
73
  homepage: http://nio.rubyforge.org
74
74
  post_install_message:
75
75
  rdoc_options:
76
76
  - --main
77
77
  - README.txt
78
+ - --title
79
+ - Nio Documentation
80
+ - --opname
81
+ - index.html
82
+ - --line-numbers
83
+ - --inline-source
84
+ - --main
85
+ - README.txt
78
86
  require_paths:
79
87
  - lib
80
88
  required_ruby_version: !ruby/object:Gem::Requirement
data/config/hoe.rb DELETED
@@ -1,75 +0,0 @@
1
- require File.join(File.dirname(__FILE__),'../source/lib/nio/version')
2
-
3
- AUTHOR = 'Javier Goizueta' # can also be an array of Authors
4
- EMAIL = "javier@goizueta.info"
5
- DESCRIPTION = "Numeric input/output"
6
- GEM_NAME = 'nio' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'nio' # The unix name for your project
8
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
-
11
- =begin
12
- @config_file = "C:/Documents and Settings/jgoizueta/.rubyforge/user-config.yml"
13
- @config = nil
14
- RUBYFORGE_USERNAME = "jgoizueta"
15
- def rubyforge_username
16
- unless @config
17
- begin
18
- @config = YAML.load(File.read(File.expand_path(@config_file)))
19
- rescue
20
- puts <<-EOS
21
- ERROR: No rubyforge config file found: #{@config_file}
22
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
23
- - See http://newgem.rubyforge.org/rubyforge.html for more details
24
- EOS
25
- exit
26
- end
27
- end
28
- RUBYFORGE_USERNAME.replace @config["username"]
29
- end
30
-
31
-
32
- REV = nil
33
- # UNCOMMENT IF REQUIRED:
34
- # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
35
- RDOC_OPTS = ['--quiet', '--title', 'Nio documentation',
36
- "--opname", "index.html",
37
- "--line-numbers",
38
- "--main", "README",
39
- "--inline-source"]
40
-
41
- class Hoe
42
- def extra_deps
43
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
- @extra_deps
45
- end
46
- end
47
- =end
48
-
49
- # Generate all the Rake tasks
50
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
51
- $hoe = Hoe.new(GEM_NAME, Nio::VERSION::STRING) do |p|
52
- p.developer AUTHOR, EMAIL
53
- p.description = DESCRIPTION
54
- p.summary = DESCRIPTION
55
- p.url = HOMEPATH
56
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
57
- p.test_globs = ["test/**/test_*.rb"]
58
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
59
-
60
-
61
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
62
- #p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
63
- p.remote_rdoc_dir = '' # we start using the rdoc as the project home-page, later we'll setup separate page
64
- p.rsync_args = '-av --delete --ignore-errors'
65
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
66
-
67
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
68
-
69
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
70
-
71
- #p.spec_extras = { :autorequire=>'nio' }
72
-
73
- end
74
-
75
- require 'newgem/tasks' # load /tasks/*.rake
@@ -1,17 +0,0 @@
1
- require 'fileutils'
2
- include FileUtils
3
-
4
- require 'rubygems'
5
- %w[rubygems rake newgem rubigen].each do |req_gem|
6
- begin
7
- require req_gem
8
- rescue LoadError
9
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
11
- exit
12
- end
13
- end
14
-
15
- $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
-
17
- #require 'nio'
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/destroy.cmd DELETED
@@ -1 +0,0 @@
1
- @ruby script/destroy %*
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.join(File.dirname(__FILE__), '..')
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
data/script/generate.cmd DELETED
@@ -1 +0,0 @@
1
- @ruby script/generate %*
data/script/txt2html DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- begin
5
- require 'newgem'
6
- rescue LoadError
7
- puts "\n\nGenerating the website requires the newgem RubyGem"
8
- puts "Install: gem install newgem\n\n"
9
- exit(1)
10
- end
11
- require 'redcloth'
12
- require 'syntax/convertors/html'
13
- require 'erb'
14
- require File.dirname(__FILE__) + '/../lib/nio/version.rb'
15
-
16
- version = Nio::VERSION::STRING
17
- download = 'http://rubyforge.org/projects/nio'
18
-
19
- class Fixnum
20
- def ordinal
21
- # teens
22
- return 'th' if (10..19).include?(self % 100)
23
- # others
24
- case self % 10
25
- when 1: return 'st'
26
- when 2: return 'nd'
27
- when 3: return 'rd'
28
- else return 'th'
29
- end
30
- end
31
- end
32
-
33
- class Time
34
- def pretty
35
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
36
- end
37
- end
38
-
39
- def convert_syntax(syntax, source)
40
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
41
- end
42
-
43
- if ARGV.length >= 1
44
- src, template = ARGV
45
- template ||= File.join(File.dirname(__FILE__), '/../website/template.rhtml')
46
-
47
- else
48
- puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
49
- exit!
50
- end
51
-
52
- template = ERB.new(File.open(template).read)
53
-
54
- title = nil
55
- body = nil
56
- File.open(src) do |fsrc|
57
- title_text = fsrc.readline
58
- body_text = fsrc.read
59
- syntax_items = []
60
- body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
61
- ident = syntax_items.length
62
- element, syntax, source = $1, $2, $3
63
- syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
64
- "syntax-temp-#{ident}"
65
- }
66
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
67
- body = RedCloth.new(body_text).to_html
68
- body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
69
- end
70
- stat = File.stat(src)
71
- created = stat.ctime
72
- modified = stat.mtime
73
-
74
- $stdout << template.result(binding)