bahuvrihi-molecules 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +29 -28
- data/lib/molecules/empirical_formula.rb +2 -2
- data/test/molecules/empirical_formula_class_test.rb +1 -1
- data/test/molecules/empirical_formula_test.rb +1 -1
- data/test/molecules/libraries/polypeptide_test.rb +1 -1
- data/test/molecules/libraries/residue_test.rb +1 -1
- data/test/molecules/utils_test.rb +10 -10
- data/test/molecules_test.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -13,6 +13,7 @@ Rake::TestTask.new(:test) do |t|
|
|
13
13
|
t.libs << 'lib'
|
14
14
|
t.pattern = File.join('test', ENV['subset'] || '', ENV['pattern'] || '**/*_test.rb')
|
15
15
|
t.verbose = true
|
16
|
+
t.warning = true
|
16
17
|
end
|
17
18
|
|
18
19
|
#
|
@@ -25,35 +26,35 @@ def gemspec
|
|
25
26
|
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
|
26
27
|
spec
|
27
28
|
end
|
28
|
-
|
29
|
-
Rake::GemPackageTask.new(gemspec) do |pkg|
|
30
|
-
pkg.need_tar = true
|
31
|
-
end
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
30
|
+
Rake::GemPackageTask.new(gemspec) do |pkg|
|
31
|
+
pkg.need_tar = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :print_manifest do
|
35
|
+
# collect files from the gemspec, labeling
|
36
|
+
# with true or false corresponding to the
|
37
|
+
# file existing or not
|
38
|
+
files = gemspec.files.inject({}) do |files, file|
|
39
|
+
files[File.expand_path(file)] = [File.exists?(file), file]
|
40
|
+
files
|
41
|
+
end
|
42
|
+
|
43
|
+
# gather non-rdoc/pkg files for the project
|
44
|
+
# and add to the files list if they are not
|
45
|
+
# included already (marking by the absence
|
46
|
+
# of a label)
|
47
|
+
Dir.glob("**/*").each do |file|
|
48
|
+
next if file =~ /^(rdoc|pkg)/ || File.directory?(file)
|
49
|
+
|
50
|
+
path = File.expand_path(file)
|
51
|
+
files[path] = ["", file] unless files.has_key?(path)
|
52
|
+
end
|
53
|
+
|
54
|
+
# sort and output the results
|
55
|
+
files.values.sort_by {|exists, file| file }.each do |entry|
|
56
|
+
puts "%-5s : %s" % entry
|
57
|
+
end
|
57
58
|
end
|
58
59
|
|
59
60
|
desc 'Generate documentation.'
|
@@ -39,7 +39,7 @@ module Molecules
|
|
39
39
|
factor = nil
|
40
40
|
composition = Hash.new(0)
|
41
41
|
scanner = StringScanner.new(formula.reverse)
|
42
|
-
while scanner.
|
42
|
+
while scanner.rest_size > 0
|
43
43
|
case
|
44
44
|
when scanner.scan_full(/\)(\d+-?)\(/, true, false)
|
45
45
|
# found a factor
|
@@ -133,7 +133,7 @@ module Molecules
|
|
133
133
|
|
134
134
|
# Parse elements and factors out of the formula from right to left
|
135
135
|
scanner = StringScanner.new(formula.reverse)
|
136
|
-
while scanner.
|
136
|
+
while scanner.rest_size > 0
|
137
137
|
|
138
138
|
case
|
139
139
|
when scanner.scan_full(/(\d+)/, true, false)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '../molecules_test_helper.rb')
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '../molecules_test_helper.rb'))
|
2
2
|
require 'molecules/utils'
|
3
3
|
|
4
4
|
class UtilsTest < Test::Unit::TestCase
|
@@ -74,15 +74,15 @@ class UtilsTest < Test::Unit::TestCase
|
|
74
74
|
a = [1,2,4]
|
75
75
|
assert_equal a.object_id, multiply(a, 2).object_id
|
76
76
|
assert_equal a.object_id, multiply(a, 0).object_id
|
77
|
-
end
|
78
|
-
|
79
|
-
#
|
80
|
-
# count test
|
81
|
-
#
|
82
|
-
|
83
|
-
def test_count_documenation
|
84
|
-
assert_equal [3, 2, 2] , count("abcabca", ["a", "b", "c"])
|
85
|
-
assert_equal [3, 4], count("abcabca", ["a", "bc"])
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# count test
|
81
|
+
#
|
82
|
+
|
83
|
+
def test_count_documenation
|
84
|
+
assert_equal [3, 2, 2] , count("abcabca", ["a", "b", "c"])
|
85
|
+
assert_equal [3, 4], count("abcabca", ["a", "bc"])
|
86
86
|
end
|
87
87
|
|
88
88
|
#
|
data/test/molecules_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bahuvrihi-molecules
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-08-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|