runarray 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2009, University of Colorado at Boulder. ('COPYRIGHT HOLDER') All rights reserved.
2
+
3
+ Software by John T. Prince under the direction of Natalie Ahn.
4
+
5
+ By using this software the USER indicates that he or she has read, understood and will comply with the following:
6
+
7
+ COPYRIGHT HOLDER hereby grants USER permission to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this software and its documentation for any purpose and without fee, provided that a full copy of this notice is included with the software and its documentation.
8
+
9
+ Title to copyright this software and its associated documentation shall at all times remain with COPYRIGHT HOLDER. No right is granted to use in advertising, publicity or otherwise any trademark, service mark, or the name of COPYRIGHT HOLDER.
10
+
11
+ This software and any associated documentation are provided "as is," and COPYRIGHT HOLDER MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING THOSE OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THAT USE OF THE SOFTWARE, MODIFICATIONS, OR ASSOCIATED DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER INTELLECTUAL PROPERTY RIGHTS OF A THIRD PARTY. COPYRIGHT HOLDER, The University of Colorado System, its Regents, officers, and employees shall not be liable under any circumstances for any direct, indirect, special, incidental, or consequential damages with respect to any claim by USER or any third party on account of or arising from the use, or inability to use, this software or its associated documentation, even if COPYRIGHT HOLDER has been advised of the possibility of those damages.
data/README ADDED
@@ -0,0 +1,36 @@
1
+ = {Runarray}[http://rubyforge.org/projects/mspire]
2
+
3
+ Runarray - Attempting to provide a fast, pure ruby implementation of major
4
+ NArray functionality.
5
+
6
+ Pronounced like Scooby-Doo saying 'Run away!'.
7
+
8
+ Very much pre-alpha right now although some good functionality has been
9
+ implemented.
10
+
11
+ == Example
12
+
13
+
14
+ If you require the auto file then NArray is used if it is available. If not, the Runarray module is included and one can seamlessly use NArray objects.
15
+
16
+ require 'runarray/auto'
17
+
18
+ na = NArray.float(4) # -> an NArray object if narray is available
19
+ # -> else an Runarray::NArray object
20
+
21
+
22
+ === Using Pure Ruby
23
+
24
+ require 'runarray/narray'
25
+ include Runarray
26
+ na = NArray.float(4) # -> [ 0.0, 0.0, 0.0, 0.0 ]
27
+
28
+ == Installation
29
+
30
+ gem install runarray
31
+
32
+ == See Also
33
+
34
+ http://narray.rubyforge.org/
35
+ http://narray.rubyforge.org/SPEC.en
36
+
data/Rakefile ADDED
@@ -0,0 +1,149 @@
1
+ require 'rake'
2
+ require 'rubygems'
3
+ require 'rake/rdoctask'
4
+ require 'rake/gempackagetask'
5
+ require 'rake/testtask'
6
+ require 'rake/clean'
7
+ require 'fileutils'
8
+
9
+ ###############################################
10
+ # GLOBAL
11
+ ###############################################
12
+
13
+ FL = FileList
14
+ NAME = "runarray"
15
+ FU = FileUtils
16
+
17
+ readme = "README"
18
+
19
+ rdoc_dir = 'rdoc'
20
+ rdoc_extra_includes = [readme, "LICENSE"]
21
+ rdoc_options = ['--main', readme, '--title', NAME, '--line-numbers', '--inline-source']
22
+
23
+ lib_files = FL["lib/**/*.rb"]
24
+ dist_files = lib_files + FL[readme, "LICENSE", "Rakefile", "{specs}/**/*"]
25
+ changelog = 'CHANGELOG'
26
+
27
+ ###############################################
28
+ # ENVIRONMENT
29
+ ###############################################
30
+ ENV["OS"] == "Windows_NT" ? WIN32 = true : WIN32 = false
31
+ $gemcmd = "gem"
32
+ if WIN32
33
+ unless ENV["TERM"] == "cygwin"
34
+ $gemcmd << ".cmd"
35
+ end
36
+ end
37
+
38
+
39
+ ###############################################
40
+ # DOC
41
+ ###############################################
42
+ Rake::RDocTask.new do |rd|
43
+ rd.rdoc_dir = rdoc_dir
44
+ rd.main = readme
45
+ rd.rdoc_files.include( rdoc_extra_includes )
46
+ rd.rdoc_files.include( lib_files.uniq )
47
+ rd.options.push( *rdoc_options )
48
+ end
49
+
50
+ desc "create and upload docs to server"
51
+ task :upload_docs => [:rdoc] do
52
+ sh "scp -r #{rdoc_dir}/* jtprince@rubyforge.org:/var/www/gforge-projects/axml/"
53
+ end
54
+
55
+
56
+
57
+ ###############################################
58
+ # TESTS
59
+ ###############################################
60
+
61
+ desc 'Default: Run specs.'
62
+ task :default => :spec
63
+
64
+ desc 'Run specs.'
65
+ Rake::TestTask.new(:spec) do |t|
66
+ t.verbose = true
67
+ t.warning = true
68
+ ENV['RUBYOPT'] = 'rubygems'
69
+ ENV['TEST'] = ENV['SPEC'] if ENV['SPEC']
70
+ t.libs = ['lib']
71
+ t.test_files = Dir.glob( File.join('spec', ENV['pattern'] || '**/*_spec.rb') )
72
+ t.options = "-v"
73
+ end
74
+
75
+ ###############################################
76
+ # PACKAGE / INSTALL / UNINSTALL
77
+ ###############################################
78
+
79
+ # looks for a header, collects the paragraph after the space
80
+ def get_section(header, file)
81
+ get_space = false
82
+ found_space = false
83
+ string = ''
84
+ IO.foreach(file) do |line|
85
+ if found_space
86
+ if line =~ /[^\s]/
87
+ string << line
88
+ else
89
+ break
90
+ end
91
+ elsif get_space
92
+ if line !~ /[^\s]/
93
+ found_space = true
94
+ get_space = false
95
+ end
96
+ elsif line =~ /^#{header}/
97
+ get_space = true
98
+ end
99
+ end
100
+ string.gsub!("\n", ' ')
101
+ end
102
+
103
+ tm = Time.now
104
+ gemspec = Gem::Specification.new do |t|
105
+ description = "pure ruby implementation of narray"
106
+ summary = "pure ruby implementation of narray"
107
+ t.platform = Gem::Platform::RUBY
108
+ t.name = NAME
109
+ t.version = IO.readlines(changelog).grep(/##.*version/).pop.split(/\s+/).last.chomp
110
+ t.homepage = 'http://rubyforge.org/projects/mspire'
111
+ t.rubyforge_project = 'mspire'
112
+ t.summary = summary
113
+ t.date = "#{tm.year}-#{tm.month}-#{tm.day}"
114
+ t.email = "jtprince@gmail.com"
115
+ t.description = description
116
+ t.has_rdoc = true
117
+ t.authors = ["John Prince"]
118
+ t.files = dist_files
119
+ t.rdoc_options = rdoc_options
120
+ t.extra_rdoc_files = rdoc_extra_includes
121
+ t.executables = FL["bin/*"].map {|file| File.basename(file) }
122
+ t.test_files = FL["spec/**/*_spec.rb"]
123
+ end
124
+
125
+ desc "Create packages."
126
+ Rake::GemPackageTask.new(gemspec) do |pkg|
127
+ #pkg.need_zip = true
128
+ #pkg.need_tar = true
129
+ end
130
+
131
+ task :remove_pkg do
132
+ FileUtils.rm_rf "pkg"
133
+ end
134
+
135
+ task :install => [:reinstall]
136
+
137
+ desc "uninstalls the package, packages a fresh one, and installs"
138
+ task :reinstall => [:remove_pkg, :clean, :package] do
139
+ reply = `#{$gemcmd} list -l #{NAME}`
140
+ if reply.include?(NAME + " (")
141
+ %x( #{$gemcmd} uninstall -a -x #{NAME} )
142
+ end
143
+ FileUtils.cd("pkg") do
144
+ cmd = "#{$gemcmd} install #{NAME}*.gem"
145
+ puts "EXECUTING: #{cmd}"
146
+ system cmd
147
+ end
148
+ end
149
+
@@ -0,0 +1,8 @@
1
+
2
+ begin
3
+ require 'narray'
4
+ rescue LoadError
5
+ require 'runarray/narray'
6
+ include Runarray
7
+ end
8
+