nera 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/lib/nera/nera_cui.rb +38 -4
- data/lib/nera/nera_simulator.rb +12 -0
- data/lib/nera/nera_simulator_layer_controller.rb +174 -4
- data/lib/nera.rb +1 -1
- data/test/test_nera_simulator.rb +20 -0
- data/test/test_nera_simulator_layer_controller.rb +110 -0
- data/website/index.html +3 -3
- data/website/index.txt +1 -1
- data/website/temporary/temp.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/nera/nera_cui.rb
CHANGED
@@ -74,7 +74,7 @@ HEADER
|
|
74
74
|
r[:name]
|
75
75
|
end
|
76
76
|
names.unshift("go to Jobs layer")
|
77
|
-
names += ["show logs", "exit"]
|
77
|
+
names += ["show logs", "remove a simulator", "dump a simulator", "import a simulator", "exit"]
|
78
78
|
selected = 0
|
79
79
|
Dir.chdir( slc.path_to_sim_layer) {
|
80
80
|
selected = Dialog::select_one_or_return_string( names, "Select a simulator.")
|
@@ -83,12 +83,46 @@ HEADER
|
|
83
83
|
return :simulator_layer
|
84
84
|
end
|
85
85
|
}
|
86
|
-
|
86
|
+
case names[selected]
|
87
|
+
when "go to Jobs layer"
|
87
88
|
return :job_layer
|
88
|
-
|
89
|
+
when "show logs"
|
89
90
|
system "less #{slc.path_to_log_file}"
|
90
91
|
return :simulator_layer
|
91
|
-
|
92
|
+
when "remove a simulator"
|
93
|
+
sim_names = ["Cancel"] + slc.list.map do |r| r[:name] end
|
94
|
+
selected = Dialog::select_one( sim_names, "Select a simulator to be removed.")
|
95
|
+
return :simulator_layer if selected == 0
|
96
|
+
flag = slc.remove_simulator( sim_names[selected])
|
97
|
+
if flag
|
98
|
+
Dialog::message("Simulator \"#{sim_names[selected]}\" have been successfully removed from the database.")
|
99
|
+
else
|
100
|
+
Dialog::message("Failed to remove the simulator \"#{sim_names[selected]}\". There are uncompleted jobs.")
|
101
|
+
end
|
102
|
+
return :simulator_layer
|
103
|
+
when "dump a simulator"
|
104
|
+
sim_names = ["Cancel"] + slc.list.map do |r| r[:name] end
|
105
|
+
selected = Dialog::select_one( sim_names, "Select a simulator to be dumped.")
|
106
|
+
return :simulator_layer if selected == 0
|
107
|
+
flag = slc.dump_simulator( sim_names[selected])
|
108
|
+
if flag
|
109
|
+
Dialog::message("Data for the simulator \"#{sim_names[selected]}\" have been successfully dumped.")
|
110
|
+
else
|
111
|
+
Dialog::message("Failed to dump the simulator \"#{sim_names[selected]}\". There are uncompleted jobs.")
|
112
|
+
end
|
113
|
+
return :simulator_layer
|
114
|
+
when "import a simulator"
|
115
|
+
list = ["Cancel"] + slc.importable_simulators
|
116
|
+
selected = Dialog::select_one( list, "Select a simulator to be dumped.")
|
117
|
+
return :simulator_layer if selected == 0
|
118
|
+
flag = slc.import_simulator( list[selected])
|
119
|
+
if flag
|
120
|
+
Dialog::message("Simulator \"#{list[selected]}\" have been successfully imported.")
|
121
|
+
else
|
122
|
+
Dialog::message("Failed to import the simulator \"#{sim_names[selected]}\".")
|
123
|
+
end
|
124
|
+
return :simulator_layer
|
125
|
+
when "exit"
|
92
126
|
return :exit
|
93
127
|
else
|
94
128
|
@simulator_class = names[selected]
|
data/lib/nera/nera_simulator.rb
CHANGED
@@ -21,6 +21,18 @@ module NERA
|
|
21
21
|
def self.inherited_simulators
|
22
22
|
return @@inherited
|
23
23
|
end
|
24
|
+
|
25
|
+
def self.remove_simulator( sim_class)
|
26
|
+
raise ArgumentError unless sim_class.is_a?(Class)
|
27
|
+
@@inherited -= [ sim_class ]
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.add_simulator( sim_class)
|
31
|
+
raise ArgumentError unless sim_class.is_a?(Class)
|
32
|
+
@@inherited << sim_class
|
33
|
+
@@inherited.uniq!
|
34
|
+
end
|
35
|
+
|
24
36
|
end
|
25
37
|
|
26
38
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'nera_db_folders'
|
2
2
|
require 'nera_simulator_records'
|
3
3
|
require 'nera_parameter_records'
|
4
|
+
require 'nera_job_records'
|
5
|
+
require 'pathname'
|
4
6
|
|
5
7
|
module NERA
|
6
8
|
|
@@ -21,22 +23,24 @@ module NERA
|
|
21
23
|
|
22
24
|
NERA::Simulator.inherited_simulators.each do |sim|
|
23
25
|
next if list.find do |rec| rec[:name] == sim.to_s end
|
26
|
+
mapped = NERA::ParameterRecords::ATTRIBUTES_PART.map do |att| att[0] end
|
24
27
|
found = sim::Parameters.find do |p|
|
25
|
-
|
28
|
+
mapped.include?(p[0])
|
29
|
+
# p[0] == :in_trashbox? or p[0] == :created_at or p[0] == :updated_at
|
26
30
|
end
|
27
31
|
next if found
|
28
32
|
register_a_simulator( sim)
|
29
33
|
end
|
30
34
|
end
|
31
|
-
|
35
|
+
|
32
36
|
def list
|
33
37
|
@sim_records.list
|
34
38
|
end
|
35
|
-
|
39
|
+
|
36
40
|
def path_to_sim_layer
|
37
41
|
@db_folders.path_to_simulator_layer
|
38
42
|
end
|
39
|
-
|
43
|
+
|
40
44
|
def get_class_by_name( sim_name)
|
41
45
|
raise ArgumentError unless sim_name.is_a?(String)
|
42
46
|
found = NERA::Simulator.inherited_simulators.find do |sim|
|
@@ -68,6 +72,172 @@ module NERA
|
|
68
72
|
@db_folders.path_to_log_file
|
69
73
|
end
|
70
74
|
|
75
|
+
def remove_simulator( sim_name)
|
76
|
+
flag = true
|
77
|
+
sim_class = get_class_by_name( sim_name)
|
78
|
+
return nil unless sim_class
|
79
|
+
sim_id = (list.find do |rec| rec[:name] == sim_name end)[:id]
|
80
|
+
return nil unless sim_id
|
81
|
+
job_records = NERA::JobRecords.new( @db_folders.path_to_jobs_table )
|
82
|
+
job_records.transaction {
|
83
|
+
@sim_records.transaction {
|
84
|
+
# check uncompleted jobs
|
85
|
+
found = job_records.list_all.find do |rec| rec[:simulator] == sim_name end
|
86
|
+
if found
|
87
|
+
flag = nil
|
88
|
+
return
|
89
|
+
end
|
90
|
+
# destroy the record
|
91
|
+
f = @sim_records.destroy( sim_id)
|
92
|
+
raise "Couldn't destroy the record #{sim_id} in simulators table" unless f
|
93
|
+
# compression
|
94
|
+
path1 = @db_folders.path_to_parameter_layer( sim_class)
|
95
|
+
path2 = File.dirname( @db_folders.path_to_parameters_table( sim_class) )
|
96
|
+
path3 = File.join( @db_folders.path_to_simulator_layer, "Simulator_classes", "#{sim_name}.rb")
|
97
|
+
raise "Couldn't find #{path1}" unless File.directory?(path1)
|
98
|
+
raise "Couldn't find #{path2}" unless File.directory?(path2)
|
99
|
+
raise "Couldn't find #{path3}" unless File.exist?(path3)
|
100
|
+
base_path = Pathname.new( @db_folders.path_to_simulator_layer ).realpath
|
101
|
+
path1 = Pathname.new( path1).realpath.relative_path_from( base_path).to_s
|
102
|
+
path2 = Pathname.new( path2).realpath.relative_path_from( base_path).to_s
|
103
|
+
path3 = Pathname.new( path3).realpath.relative_path_from( base_path).to_s
|
104
|
+
Dir.chdir(base_path) {
|
105
|
+
tar_file = "#{sim_id}_#{sim_name}.tar"
|
106
|
+
cmd = "tar cf #{tar_file} #{path1} #{path2} #{path3}"
|
107
|
+
system cmd
|
108
|
+
raise "command \"#{cmd}\" failed." unless $? == 0
|
109
|
+
bz2_file = tar_file + '.bz2'
|
110
|
+
FileUtils.rm( bz2_file) if File.exist?( bz2_file )
|
111
|
+
cmd = "bzip2 #{tar_file}"
|
112
|
+
system cmd
|
113
|
+
raise "command \"#{cmd}\" failed." unless $? == 0
|
114
|
+
FileUtils.rm_r( path1)
|
115
|
+
FileUtils.rm_r( path2)
|
116
|
+
FileUtils.rm( path3)
|
117
|
+
}
|
118
|
+
# remove inherited classes
|
119
|
+
NERA::Simulator.remove_simulator( sim_class)
|
120
|
+
# keep a log
|
121
|
+
@db_folders.logger.info(self.class.to_s) {
|
122
|
+
"removed the simulator (#{sim_class.to_s})"
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
return flag
|
127
|
+
end
|
128
|
+
|
129
|
+
def dump_simulator( sim_name, job_records = nil)
|
130
|
+
flag = true
|
131
|
+
sim_class = get_class_by_name( sim_name)
|
132
|
+
return nil unless sim_class
|
133
|
+
sim_id = (list.find do |rec| rec[:name] == sim_name end)[:id]
|
134
|
+
return nil unless sim_id
|
135
|
+
job_records = NERA::JobRecords.new( @db_folders.path_to_jobs_table ) unless job_records.is_a?(NERA::JobRecords)
|
136
|
+
job_records.transaction {
|
137
|
+
@sim_records.transaction {
|
138
|
+
# check uncompleted jobs
|
139
|
+
found = job_records.list_all.find do |rec| rec[:simulator] == sim_name end
|
140
|
+
if found
|
141
|
+
flag = nil
|
142
|
+
return
|
143
|
+
end
|
144
|
+
# destroy the record
|
145
|
+
# f = @sim_records.destroy( sim_id)
|
146
|
+
# raise "Couldn't destroy the record #{sim_id} in simulators table" unless f
|
147
|
+
# compression
|
148
|
+
path1 = @db_folders.path_to_parameter_layer( sim_class)
|
149
|
+
path2 = File.dirname( @db_folders.path_to_parameters_table( sim_class) )
|
150
|
+
path3 = File.join( @db_folders.path_to_simulator_layer, "Simulator_classes", "#{sim_name}.rb")
|
151
|
+
raise "Couldn't find #{path1}" unless File.directory?(path1)
|
152
|
+
raise "Couldn't find #{path2}" unless File.directory?(path2)
|
153
|
+
raise "Couldn't find #{path3}" unless File.exist?(path3)
|
154
|
+
base_path = Pathname.new( @db_folders.path_to_simulator_layer ).realpath
|
155
|
+
path1 = Pathname.new( path1).realpath.relative_path_from( base_path).to_s
|
156
|
+
path2 = Pathname.new( path2).realpath.relative_path_from( base_path).to_s
|
157
|
+
path3 = Pathname.new( path3).realpath.relative_path_from( base_path).to_s
|
158
|
+
Dir.chdir(base_path) {
|
159
|
+
tar_file = "#{sim_id}_#{sim_name}.tar"
|
160
|
+
cmd = "tar cf #{tar_file} #{path1} #{path2} #{path3}"
|
161
|
+
system cmd
|
162
|
+
raise "command \"#{cmd}\" failed." unless $? == 0
|
163
|
+
bz2_file = tar_file + '.bz2'
|
164
|
+
FileUtils.rm( bz2_file) if File.exist?( bz2_file )
|
165
|
+
cmd = "bzip2 #{tar_file}"
|
166
|
+
system cmd
|
167
|
+
raise "command \"#{cmd}\" failed." unless $? == 0
|
168
|
+
# FileUtils.rm_r( path1)
|
169
|
+
# FileUtils.rm_r( path2)
|
170
|
+
# FileUtils.rm( path3)
|
171
|
+
}
|
172
|
+
# remove inherited classes
|
173
|
+
# NERA::Simulator.remove_simulator( sim_class)
|
174
|
+
# keep a log
|
175
|
+
@db_folders.logger.info(self.class.to_s) {
|
176
|
+
"dumped the simulator (#{sim_class.to_s})"
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
return flag
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
def importable_simulators
|
185
|
+
sim_names = @sim_records.list.map do |rec| rec[:name] end
|
186
|
+
|
187
|
+
Dir.chdir( @db_folders.path_to_simulator_layer ) {
|
188
|
+
candidates = Dir.glob( "[0-9]*_[A-Z]*.tar.bz2").find_all do |file|
|
189
|
+
file =~ /^([0-9]+)_([A-Z]\w*)\.tar\.bz2/ and !(sim_names.include?($2))
|
190
|
+
end
|
191
|
+
# found = candidates.find_all do |file|
|
192
|
+
# file =~ /^([0-9]+)_([A-Z]\w*)\.tar\.bz2/ and
|
193
|
+
# !(@sim_records.list.include? do |rec| rec[:name] == $2 end)
|
194
|
+
# end
|
195
|
+
return candidates
|
196
|
+
}
|
197
|
+
end
|
198
|
+
|
199
|
+
def import_simulator( sim_file)
|
200
|
+
flag = true
|
201
|
+
return nil unless sim_file =~ /^([0-9]+)_([A-Z]\w*)\.tar\.bz2/
|
202
|
+
return nil unless File.exist?( File.join(@db_folders.path_to_simulator_layer,sim_file) )
|
203
|
+
sim_name = $2
|
204
|
+
job_records = NERA::JobRecords.new( @db_folders.path_to_jobs_table )
|
205
|
+
|
206
|
+
job_records.transaction {
|
207
|
+
@sim_records.transaction {
|
208
|
+
# check name overlap
|
209
|
+
if @sim_records.list.find do |rec| rec[:name] == sim_name end
|
210
|
+
flag = nil
|
211
|
+
return
|
212
|
+
end
|
213
|
+
raise "must not happen" if File.directory?( File.join( @db_folders.path_to_simulator_layer, sim_name ) )
|
214
|
+
raise "must not happen" if File.directory?( File.join( File.dirname(@db_folders.path_to_simulators_table), sim_name) )
|
215
|
+
raise "must not happen" if File.exist?( File.join( @db_folders.path_to_simulator_layer, "Simulator_classes", "#{sim_name}.rb") )
|
216
|
+
# decompress the file
|
217
|
+
Dir.chdir(@db_folders.path_to_simulator_layer) {
|
218
|
+
# cmd = "bunzip2 #{sim_file}"
|
219
|
+
# system cmd
|
220
|
+
# raise "command \"#{cmd}\" failed." unless $? == 0
|
221
|
+
tar_file = sim_file.sub(/\.bz2$/,'')
|
222
|
+
cmd = "tar xjf #{sim_file}"
|
223
|
+
system cmd
|
224
|
+
raise "command \"#{cmd}\" failed." unless $? == 0
|
225
|
+
}
|
226
|
+
# load simulator definition
|
227
|
+
require File.join( @db_folders.path_to_simulator_layer, "Simulator_classes", "#{sim_name}.rb")
|
228
|
+
sim_class = sim_name.split(/::/).inject(Object) {|c,name| c.const_get(name) }
|
229
|
+
raise "invalid definition of simulator class #{sim_name}" unless sim_class.is_a?(Class)
|
230
|
+
NERA::Simulator.add_simulator( sim_class)
|
231
|
+
flag = @sim_records.add( sim_class)
|
232
|
+
# keep a log
|
233
|
+
@db_folders.logger.info(self.class.to_s) {
|
234
|
+
"imported the simulator (#{sim_class.to_s})"
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
return flag
|
239
|
+
end
|
240
|
+
|
71
241
|
end
|
72
242
|
|
73
243
|
end
|
data/lib/nera.rb
CHANGED
data/test/test_nera_simulator.rb
CHANGED
@@ -23,4 +23,24 @@ class TC_NERA_SIMULATOR < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
assert(a)
|
25
25
|
end
|
26
|
+
|
27
|
+
def test_remove_simulator
|
28
|
+
sim1 = NERA::Simulator.inherited_simulators
|
29
|
+
NERA::Simulator.remove_simulator( Ising)
|
30
|
+
sim2 = NERA::Simulator.inherited_simulators
|
31
|
+
assert_equal( [Heisenberg, XY], sim2)
|
32
|
+
assert_raise(ArgumentError) {
|
33
|
+
NERA::Simulator.remove_simulator( "Ising")
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_add_simulator
|
38
|
+
NERA::Simulator.remove_simulator( Ising)
|
39
|
+
NERA::Simulator.add_simulator( Ising)
|
40
|
+
sim2 = NERA::Simulator.inherited_simulators
|
41
|
+
assert_equal( [Heisenberg, XY, Ising], sim2)
|
42
|
+
assert_raise(ArgumentError) {
|
43
|
+
NERA::Simulator.add_simulator( "Ising")
|
44
|
+
}
|
45
|
+
end
|
26
46
|
end
|
@@ -8,9 +8,13 @@ class TC_NERA_SIM_LAYER_CONTROLLER < Test::Unit::TestCase
|
|
8
8
|
FileUtils.mkdir(@testdir)
|
9
9
|
FileUtils.chdir(@testdir)
|
10
10
|
@db_folder = "nera_db"
|
11
|
+
NERA::Simulator.add_simulator( Ising)
|
12
|
+
NERA::Simulator.add_simulator( Heisenberg)
|
11
13
|
NERA::DbFolders.create_db( @db_folder)
|
12
14
|
@dbf = NERA::DbFolders.new( @db_folder)
|
13
15
|
@slc = NERA::SimulatorLayerController.new( @db_folder)
|
16
|
+
FileUtils.touch(File.join(@db_folder,"Simulator_classes","Ising.rb") )
|
17
|
+
FileUtils.touch(File.join(@db_folder,"Simulator_classes","Heisenberg.rb") )
|
14
18
|
end
|
15
19
|
|
16
20
|
def teardown
|
@@ -63,6 +67,112 @@ class TC_NERA_SIM_LAYER_CONTROLLER < Test::Unit::TestCase
|
|
63
67
|
def test_path_to_log_file
|
64
68
|
path = @slc.path_to_log_file
|
65
69
|
assert_equal( @db_folder + "/Tables/logfile.txt", path)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_remove_simulator
|
73
|
+
assert( File.exist?( File.join(@db_folder,"Simulator_classes","Ising.rb") ) )
|
74
|
+
assert_nil( @slc.remove_simulator( "unknown_simulator") )
|
75
|
+
|
76
|
+
# create a job
|
77
|
+
plc = NERA::ParameterLayerController.new( @db_folder, "Ising")
|
78
|
+
pid = plc.create_a_new_parameter_set( {} )
|
79
|
+
rlc = NERA::RunLayerController.new( @db_folder, "Ising", pid)
|
80
|
+
jid = rlc.create_jobs( 1)
|
81
|
+
assert_nil( @slc.remove_simulator( "Ising") )
|
82
|
+
assert( @slc.list.find do |rec| rec[:name] == "Ising" end )
|
83
|
+
assert( rlc.cancel_jobs( jid ) )
|
84
|
+
|
85
|
+
# check raise
|
86
|
+
FileUtils.rm( File.join(@db_folder,"Simulator_classes","Ising.rb") )
|
87
|
+
assert_raise(RuntimeError) {
|
88
|
+
@slc.remove_simulator("Ising")
|
89
|
+
}
|
90
|
+
assert( @slc.list.find do |rec| rec[:name] == "Ising" end )
|
91
|
+
FileUtils.touch( File.join(@db_folder,"Simulator_classes","Ising.rb") )
|
92
|
+
|
93
|
+
# remove a simulator
|
94
|
+
assert( @slc.remove_simulator( "Ising") )
|
95
|
+
assert( !File.directory?( File.join(@db_folder,"Ising") ) )
|
96
|
+
assert( !File.directory?( File.join(@db_folder,"Tables","Ising") ) )
|
97
|
+
assert( !File.exist?( File.join(@db_folder,"Simulator_classes","Ising.rb") ) )
|
98
|
+
assert( Dir.glob("#{@db_folder}/[1-9]_Ising.tar.bz2").size > 0 )
|
99
|
+
assert_nil( @slc.list.find do |rec| rec[:name] == "Ising" end )
|
100
|
+
assert_nil( @slc.get_class_by_name("Ising") )
|
101
|
+
|
102
|
+
# dump before remove
|
103
|
+
assert( @slc.dump_simulator("Heisenberg") )
|
104
|
+
assert( @slc.remove_simulator("Heisenberg") )
|
105
|
+
end
|
66
106
|
|
107
|
+
def test_dump_simulator
|
108
|
+
assert_nil( @slc.dump_simulator( "unknown_simulator") )
|
109
|
+
|
110
|
+
# create a job
|
111
|
+
plc = NERA::ParameterLayerController.new( @db_folder, "Ising")
|
112
|
+
pid = plc.create_a_new_parameter_set( {} )
|
113
|
+
rlc = NERA::RunLayerController.new( @db_folder, "Ising", pid)
|
114
|
+
jid = rlc.create_jobs( 1)
|
115
|
+
assert_nil( @slc.dump_simulator( "Ising") )
|
116
|
+
assert_equal( 0, Dir.glob("#{@db_folder}/[1-9]_Ising.tar.bz2").size)
|
117
|
+
assert( rlc.cancel_jobs( jid ) )
|
118
|
+
|
119
|
+
# check raise
|
120
|
+
FileUtils.rm( File.join(@db_folder,"Simulator_classes","Ising.rb") )
|
121
|
+
assert_raise(RuntimeError) {
|
122
|
+
@slc.dump_simulator("Ising")
|
123
|
+
}
|
124
|
+
assert( @slc.list.find do |rec| rec[:name] == "Ising" end )
|
125
|
+
FileUtils.touch( File.join(@db_folder,"Simulator_classes","Ising.rb") )
|
126
|
+
|
127
|
+
# remove a simulator
|
128
|
+
assert( @slc.dump_simulator( "Ising") )
|
129
|
+
assert( File.directory?( File.join(@db_folder,"Ising") ) )
|
130
|
+
assert( File.directory?( File.join(@db_folder,"Tables","Ising") ) )
|
131
|
+
assert( File.exist?( File.join(@db_folder,"Simulator_classes","Ising.rb") ) )
|
132
|
+
assert( Dir.glob("#{@db_folder}/[1-9]_Ising.tar.bz2").size > 0 )
|
133
|
+
assert( @slc.list.find do |rec| rec[:name] == "Ising" end )
|
134
|
+
assert( @slc.get_class_by_name("Ising") )
|
135
|
+
# dump again
|
136
|
+
assert( @slc.dump_simulator( "Ising") )
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_importable_simulators
|
140
|
+
assert_equal( [], @slc.importable_simulators)
|
141
|
+
@slc.remove_simulator( "Ising")
|
142
|
+
list = @slc.importable_simulators
|
143
|
+
assert_equal( 1, list.size )
|
144
|
+
assert_match( /^[1-2]_Ising\.tar\.bz2$/, list[0] )
|
145
|
+
@slc.remove_simulator( "Heisenberg")
|
146
|
+
list = @slc.importable_simulators
|
147
|
+
assert_equal( 2, list.size )
|
148
|
+
assert( list.find do |l| l =~ /^[1-2]_Ising\.tar\.bz2$/ end )
|
149
|
+
assert( list.find do |l| l =~ /^[1-2]_Heisenberg\.tar\.bz2$/ end)
|
150
|
+
found = list.find do |l| l =~ /^[1-2]_Ising\.tar\.bz2$/ end
|
151
|
+
@slc.import_simulator( found)
|
152
|
+
list = @slc.importable_simulators
|
153
|
+
assert_equal( 1, list.size )
|
154
|
+
assert_match( /^[1-2]_Heisenberg\.tar\.bz2$/, list[0] )
|
155
|
+
|
156
|
+
FileUtils.touch( File.join(@db_folder,"3_Ising.tar.bz2") )
|
157
|
+
list2 = @slc.importable_simulators
|
158
|
+
assert_equal( list2, list)
|
159
|
+
FileUtils.rm( File.join(@db_folder,"3_Ising.tar.bz2") )
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_import_simulator
|
163
|
+
assert_nil( @slc.import_simulator("1_Unknown.tar.bz2") )
|
164
|
+
@slc.remove_simulator("Ising")
|
165
|
+
fname = @slc.importable_simulators[0]
|
166
|
+
assert( @slc.import_simulator(fname) )
|
167
|
+
assert( File.directory?( File.join(@db_folder,"Ising") ) )
|
168
|
+
assert( File.exist?( File.join(@db_folder,"Ising","parameters.yml") ) )
|
169
|
+
assert( File.directory?( File.join(@db_folder,"Tables","Ising") ) )
|
170
|
+
assert( File.exist?( File.join(@db_folder,"Tables","Ising","parameters.pstore") ) )
|
171
|
+
assert( File.exist?( File.join(@db_folder,"Simulator_classes","Ising.rb") ) )
|
172
|
+
assert( Dir.glob( File.join(@db_folder,"[1-9]_Ising.tar.bz2")).size > 0 )
|
173
|
+
found = @slc.list.find do |rec| rec[:name] == "Ising" end
|
174
|
+
assert_equal( 3, found[:id] )
|
175
|
+
assert_equal( Ising, @slc.get_class_by_name("Ising") )
|
67
176
|
end
|
177
|
+
|
68
178
|
end
|
data/website/index.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<div class="sidebar">
|
35
35
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nera"; return false'>
|
36
36
|
<p>Get Version</p>
|
37
|
-
<a href="http://rubyforge.org/projects/nera" class="numbers">0.
|
37
|
+
<a href="http://rubyforge.org/projects/nera" class="numbers">0.5.0</a>
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
<h2>What</h2>
|
@@ -59,14 +59,14 @@ Classifying the result data into folders, keeping a note of what we have done, c
|
|
59
59
|
<p>The trunk repository is <code>svn://rubyforge.org/var/svn/nera/trunk</code> for anonymous access.</p>
|
60
60
|
<h3>Build and test instructions</h3>
|
61
61
|
<pre>cd nera
|
62
|
-
|
62
|
+
ruby test/runner.rb
|
63
63
|
rake install_gem</pre>
|
64
64
|
<h2>License</h2>
|
65
65
|
<p>This code is free to use under the terms of the <span class="caps">GPL</span> license.</p>
|
66
66
|
<h2>Contact</h2>
|
67
67
|
<p>Comments are welcome. Send an email to <a href="mailto:murase_at_serow.t.u-tokyo.ac.jp">Yohsuke Murase</a></p>
|
68
68
|
<p class="coda">
|
69
|
-
<a href="murase@serow.t.u-tokyo.ac.jp">Yohsuke Murase</a>,
|
69
|
+
<a href="murase@serow.t.u-tokyo.ac.jp">Yohsuke Murase</a>, 28th November 2009<br>
|
70
70
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
71
71
|
</p>
|
72
72
|
</div>
|
data/website/index.txt
CHANGED
data/website/temporary/temp.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<div class="sidebar">
|
35
35
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nera"; return false'>
|
36
36
|
<p>Get Version</p>
|
37
|
-
<a href="http://rubyforge.org/projects/nera" class="numbers">0.
|
37
|
+
<a href="http://rubyforge.org/projects/nera" class="numbers">0.5.0</a>
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
<p>The database created by nera is a hierarchical database which consists of three layers.<br />
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yohsuke Murase
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-28 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|