fortran 1.0.0 → 1.0.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.
- data/History.txt +5 -1
- data/README.txt +9 -4
- data/Rakefile +12 -9
- data/lib/fortran.rb +9 -4
- data/test/lakos/test_analyze_dependencies.rb +35 -0
- data/test/test_fortran.rb +21 -21
- metadata +12 -8
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
fortran
|
2
2
|
|
3
|
+
* http://nasarb.rubyforge.org/fortran
|
3
4
|
* http://rubyforge.org/projects/nasarb
|
4
|
-
*
|
5
|
-
* mailto:Bil.Kleb@NASA.gov
|
5
|
+
* mailto:Bil.Kleb@nasa.gov
|
6
6
|
|
7
7
|
== DESCRIPTION:
|
8
8
|
|
9
|
-
|
9
|
+
Fortran 90/95/2003 utilities.
|
10
|
+
|
11
|
+
Currently, only provides Fortran 90/95/2003 dependencies.
|
10
12
|
|
11
13
|
== SYNOPSIS:
|
12
14
|
|
13
|
-
|
15
|
+
require 'rubygems'
|
16
|
+
require 'fortran'
|
17
|
+
|
18
|
+
Fortran::Dependencies.new( 'main.f90' ).dependencies
|
14
19
|
|
15
20
|
== REQUIREMENTS:
|
16
21
|
|
data/Rakefile
CHANGED
@@ -3,15 +3,18 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
5
|
|
6
|
-
|
7
|
-
require 'fortran'
|
6
|
+
require './lib/fortran'
|
8
7
|
|
9
|
-
Hoe.new('fortran', Fortran::VERSION) do |p|
|
8
|
+
Hoe.new( 'fortran', Fortran::VERSION ) do |p|
|
10
9
|
p.rubyforge_name = 'nasarb'
|
11
|
-
p.author
|
12
|
-
p.email
|
13
|
-
p.
|
14
|
-
p.
|
15
|
-
p.
|
16
|
-
p.changes
|
10
|
+
p.author = %w( 'Bil Kleb', 'Mike Park', 'Bill Wood' )
|
11
|
+
p.email = 'Bil.Kleb@NASA.gov'
|
12
|
+
p.url = p.paragraphs_of( 'README.txt', 1 ).to_s.gsub(/^\* /, '').split(/\n/)
|
13
|
+
p.summary = p.paragraphs_of( 'README.txt', 3 ).to_s
|
14
|
+
p.description = p.paragraphs_of( 'README.txt', 3..4 ).join("\n\n")
|
15
|
+
p.changes = p.paragraphs_of( 'History.txt', 0..1 ).join("\n\n")
|
16
|
+
p.remote_rdoc_dir = 'fortran' # release webpages to http://nasarb.rubyforge.org/fortran
|
17
|
+
p.rsync_args << ' --exclude=statsvn/'
|
17
18
|
end
|
19
|
+
|
20
|
+
# vim: syntax=Ruby
|
data/lib/fortran.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
module Fortran
|
2
2
|
|
3
|
-
|
3
|
+
##
|
4
|
+
# This version of Fortran library
|
5
|
+
|
6
|
+
VERSION = '1.0.1'
|
4
7
|
|
5
8
|
##
|
6
|
-
# Find Fortran
|
9
|
+
# Find Fortran dependencies
|
7
10
|
|
8
11
|
class Dependencies
|
9
12
|
|
@@ -52,6 +55,7 @@ module Fortran
|
|
52
55
|
source.flatten!.uniq!
|
53
56
|
source.delete_if{ |file| File.lstat(file).symlink? } if @config[:ignore_symlinks]
|
54
57
|
source.delete_if{ |file| file.match @config[:ignore_files] }
|
58
|
+
source.map!{ |file| file.sub(/^\.\//,'') }# strip leading ./
|
55
59
|
end
|
56
60
|
|
57
61
|
def build_hash_of_modules_in_files
|
@@ -120,8 +124,9 @@ module Fortran
|
|
120
124
|
sources
|
121
125
|
end
|
122
126
|
|
123
|
-
end
|
124
|
-
|
127
|
+
end # class
|
128
|
+
|
129
|
+
end # module
|
125
130
|
|
126
131
|
#--
|
127
132
|
# Copyright 2007 United States Government as represented by
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'lakos/analyze_dependencies'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
class TestAnalyzeDependencies < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
FileUtils.rm_rf 'AD_fixtures'
|
9
|
+
Dir.mkdir 'AD_fixtures'
|
10
|
+
Dir.chdir 'AD_fixtures'
|
11
|
+
File.open('m.f90','w'){|f| f.puts "program m\nuse a\nuse b\nuse d\nuse f" }
|
12
|
+
File.open('a.f90','w'){|f| f.puts "module a" }
|
13
|
+
File.open('b.f90','w'){|f| f.puts "module b\nuse c\nuse d\nuse e" }
|
14
|
+
File.open('c.f90','w'){|f| f.puts "module c" }
|
15
|
+
File.open('d.f90','w'){|f| f.puts "module d" }
|
16
|
+
File.open('e.f90','w'){|f| f.puts "module e" }
|
17
|
+
File.open('f.f90','w'){|f| f.puts "module f\nuse c\nuse e" }
|
18
|
+
@da = DependencyAnalyzer.new( 'm.f90', ['.'] )
|
19
|
+
Dir.chdir '..'
|
20
|
+
File.open('main.dot','w'){ |f| f.puts @da.graph(@da.dd_deps) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_statistics
|
24
|
+
assert_equal( 3, @da.levels.size )
|
25
|
+
assert_equal( 7, @da.components )
|
26
|
+
assert_equal( 18, @da.ccd )
|
27
|
+
assert_in_delta( 18/7.to_f, @da.acd, Float::EPSILON )
|
28
|
+
assert_in_delta( 18/17.to_f, @da.nccd, Float::EPSILON )
|
29
|
+
end
|
30
|
+
|
31
|
+
def teardown
|
32
|
+
FileUtils.rm_rf 'AD_fixtures'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/test/test_fortran.rb
CHANGED
@@ -54,18 +54,18 @@ class TestFortran < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_locating_all_fortran_files_in_search_path
|
57
|
-
files = %w[ ../lib/solution.f90
|
58
|
-
|
57
|
+
files = %w[ ../lib/solution.f90 area.f90 externalUse.f90
|
58
|
+
grid.f90 main.F90 shapes.f90 ]
|
59
59
|
@dep.find_fortran_files.each do |file|
|
60
60
|
assert files.include?(file)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
def test_build_hash_with_source_files
|
65
|
-
f90 = %w[
|
65
|
+
f90 = %w[grid.f90 ../lib/solution.f90 shapes.f90 area.f90]
|
66
66
|
hash = @dep.build_dictionary_of_modules( f90 )
|
67
|
-
assert_equal %w[
|
68
|
-
../lib/solution.f90
|
67
|
+
assert_equal %w[ shapes.f90 shapes.f90 area.f90
|
68
|
+
../lib/solution.f90 grid.f90 ].sort,
|
69
69
|
hash.values.sort
|
70
70
|
assert_equal %w[ rectangle_fun3d circle area solution grid ].sort,
|
71
71
|
hash.keys.sort
|
@@ -80,7 +80,7 @@ class TestFortran < Test::Unit::TestCase
|
|
80
80
|
assert_equal %w[grid solution circle], modules
|
81
81
|
|
82
82
|
new_source_files = modules.collect{ |mod| directoryHash[mod] }
|
83
|
-
assert_equal %w[
|
83
|
+
assert_equal %w[ grid.f90 ../lib/solution.f90 shapes.f90],
|
84
84
|
new_source_files
|
85
85
|
|
86
86
|
new_modules = new_source_files.collect do |file|
|
@@ -130,22 +130,22 @@ shapes.o: shapes.f90 \\
|
|
130
130
|
@dep.source_file_dependencies('main.F90')
|
131
131
|
assert_equal( 5, @dep.file_dependencies.size )
|
132
132
|
expected = {
|
133
|
-
"
|
134
|
-
"
|
135
|
-
"../lib/solution.f90" => ["
|
136
|
-
"
|
137
|
-
"main.F90" => ["
|
133
|
+
"area.f90" => [],
|
134
|
+
"grid.f90" => ["area.f90"],
|
135
|
+
"../lib/solution.f90" => ["area.f90"],
|
136
|
+
"shapes.f90" => ["area.f90"],
|
137
|
+
"main.F90" => ["grid.f90", "../lib/solution.f90", "shapes.f90"]
|
138
138
|
}
|
139
139
|
assert_equal expected, @dep.file_dependencies
|
140
140
|
end
|
141
141
|
|
142
142
|
def test_finds_required_source_files
|
143
|
-
expected = %w[
|
144
|
-
|
145
|
-
found = @dep.required_source_files('
|
143
|
+
expected = %w[ area.f90 shapes.f90 ../lib/solution.f90
|
144
|
+
grid.f90 main.F90 ]
|
145
|
+
found = @dep.required_source_files('main.F90')
|
146
146
|
assert_equal expected.size, found.size
|
147
|
-
assert_equal '
|
148
|
-
assert_equal '
|
147
|
+
assert_equal 'main.F90', found.last
|
148
|
+
assert_equal 'area.f90', found.first
|
149
149
|
end
|
150
150
|
|
151
151
|
def test_finds_required_source_files_unordered
|
@@ -159,14 +159,14 @@ shapes.o: shapes.f90 \\
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def test_can_find_required_source_files_twice
|
162
|
-
files = %w[
|
163
|
-
../lib/solution.f90
|
164
|
-
@dep.required_source_files('
|
165
|
-
assert_equal files.sort, @dep.required_source_files('
|
162
|
+
files = %w[ main.F90 shapes.f90 area.f90
|
163
|
+
../lib/solution.f90 grid.f90 ]
|
164
|
+
@dep.required_source_files('main.F90')
|
165
|
+
assert_equal files.sort, @dep.required_source_files('main.F90').sort
|
166
166
|
end
|
167
167
|
|
168
168
|
def test_recognizes_external_modules
|
169
|
-
file = '
|
169
|
+
file = 'externalUse.f90'
|
170
170
|
assert_equal [file], @dep.required_source_files(file).sort
|
171
171
|
end
|
172
172
|
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: fortran
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-08-
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2007-08-20 00:00:00 -04:00
|
8
8
|
summary: Fortran 90/95/2003 utilities.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: Bil.Kleb@NASA.gov
|
12
|
-
homepage: http://rubyforge.org/
|
12
|
+
homepage: http://nasarb.rubyforge.org/fortran
|
13
13
|
rubyforge_project: nasarb
|
14
|
-
description:
|
14
|
+
description: Fortran 90/95/2003 utilities. Currently, only provides Fortran 90/95/2003 dependencies.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -27,9 +27,12 @@ signing_key:
|
|
27
27
|
cert_chain:
|
28
28
|
post_install_message:
|
29
29
|
authors:
|
30
|
-
- Bil
|
31
|
-
-
|
32
|
-
-
|
30
|
+
- "'Bil"
|
31
|
+
- Kleb',
|
32
|
+
- "'Mike"
|
33
|
+
- Park',
|
34
|
+
- "'Bill"
|
35
|
+
- Wood'
|
33
36
|
files:
|
34
37
|
- History.txt
|
35
38
|
- License.txt
|
@@ -39,6 +42,7 @@ files:
|
|
39
42
|
- lib/fortran.rb
|
40
43
|
- test/test_fortran.rb
|
41
44
|
test_files:
|
45
|
+
- test/lakos/test_analyze_dependencies.rb
|
42
46
|
- test/test_fortran.rb
|
43
47
|
rdoc_options:
|
44
48
|
- --main
|
@@ -62,5 +66,5 @@ dependencies:
|
|
62
66
|
requirements:
|
63
67
|
- - ">="
|
64
68
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1.
|
69
|
+
version: 1.3.0
|
66
70
|
version:
|