|
From: <luk...@us...> - 2006-09-05 04:45:42
|
Revision: 72
http://svn.sourceforge.net/asunit/?rev=72&view=rev
Author: lukebayes
Date: 2006-09-04 21:45:37 -0700 (Mon, 04 Sep 2006)
Log Message:
-----------
working on project creation tool
Modified Paths:
--------------
trunk/ruby/src/project.rb
trunk/ruby/src/project_test.rb
trunk/ruby/src/settings.rb
Modified: trunk/ruby/src/project.rb
===================================================================
--- trunk/ruby/src/project.rb 2006-09-05 04:19:18 UTC (rev 71)
+++ trunk/ruby/src/project.rb 2006-09-05 04:45:37 UTC (rev 72)
@@ -17,37 +17,44 @@
# -bin [binary dir name]
class Project
- attr_reader :name, :settings
-
+ attr_reader :name, :settings
+
def initialize(name, dir=nil)
@name = name;
- @settings = AsUnit::Settings.new
if(!dir.nil?)
- @dir = dir
+ puts 'changing working directory to : ' + dir
+ Dir.chdir dir
end
- content = create_dirs
- create_project_file('.asunit_' + name.downcase, content)
+
+ dirs = AsUnit::Settings.new.directories
+ content = create_dirs(dirs)
+ create_project_file('.asunit', content)
end
- def create_dirs
- create_dir(@settings.src)
- create_dir(@settings.test)
- create_dir(@settings.lib)
-
- contents = ['src=\'' + File.expand_path(@settings.src) + '\'']
- contents.push('test=\'' + File.expand_path(@settings.test) + '\'')
- contents.push('lib=\'' + File.expand_path(@settings.lib) + '\'')
+ def create_dirs(dirs)
+ contents = Array.new
+ dirs.each do |dir|
+ create_dir(dir)
+ contents.push("#{dir}=\'#{File.expand_path(dir)}\'")
+ end
+ contents
end
def create_project_file(name, contents)
open(name, 'w') do |f|
+ f.puts 'project=\'' + @name + '\''
contents.each { |i|
f.puts i
}
+ f.puts 'classpath=' + get_classpath
f.flush
end
end
+ def get_classpath
+ return '\'\''
+ end
+
def dir
if(@dir.nil?)
@dir = Dir.pwd
@@ -60,7 +67,7 @@
if(!File.exists? name)
Dir.mkdir name
end
- return File.new name
+ return File.new(name)
end
end
Modified: trunk/ruby/src/project_test.rb
===================================================================
--- trunk/ruby/src/project_test.rb 2006-09-05 04:19:18 UTC (rev 71)
+++ trunk/ruby/src/project_test.rb 2006-09-05 04:45:37 UTC (rev 72)
@@ -18,4 +18,8 @@
def test_name
assert_equal(@instance.name, @default_name)
end
+
+# def test_different_dir
+# other = AsUnit::Project.new(@default_name, Dir.getwd + '/src')
+# end
end
Modified: trunk/ruby/src/settings.rb
===================================================================
--- trunk/ruby/src/settings.rb 2006-09-05 04:19:18 UTC (rev 71)
+++ trunk/ruby/src/settings.rb 2006-09-05 04:45:37 UTC (rev 72)
@@ -1,12 +1,13 @@
module AsUnit
class Settings
- attr_accessor :src, :test, :lib
+ attr_accessor :src, :test, :template, :directories
def initialize()
+ @directories = ['src', 'test', 'templates']
@src = 'src'
@test = 'test'
- @lib = 'lib'
+ @template = 'template'
end
end
end
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|