Class: Subtrac::Project
- Inherits:
-
Object
- Object
- Subtrac::Project
- Defined in:
- lib/subtrac/project.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#svn_dir ⇒ Object
, :temp_dir.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#trac_dir ⇒ Object
, :temp_dir.
Instance Method Summary collapse
- #clear_temp ⇒ Object
-
#initialize(project_name, client_name, template) ⇒ Project
constructor
A new instance of Project.
Constructor Details
#initialize(project_name, client_name, template) ⇒ Project
Returns a new instance of Project.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/subtrac/project.rb', line 6 def initialize(project_name,client_name,template) @display_name = project_name.gsub(/^[a-z]|\s+[a-z]/) { |a| a.upcase } @path = project_name.downcase @client = Client.new(client_name) @template = File.join(File.dirname(__FILE__), "project", template) #@template = template unless File.exists?(@template) # attempt download of remote template template_location = "file://#{Config.svn_dir}/templates/#{template}/trunk" @template = File.join(Config.temp_dir,template) `svn export #{template_location} #{@template} --quiet --username #{Config.data[:admin_user]} --password #{Config.data[:admin_pass]}` # replace the tokens in the project glob_path, exp_search, exp_replace = "#{@template}/**","", @display_name puts "Lets see what the filter has returned: #{Dir.glob(glob_path)}" Dir.glob(glob_path).each do |file| unless File.directory?(file) # only mess with files buffer = tokenize(File.new(file,'r').read) puts buffer File.open(file,'w') {|fw| fw.write(buffer)} end end # TODO: We'll need to run through and do some renaming if necessary end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/subtrac/project.rb', line 4 def client @client end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
4 5 6 |
# File 'lib/subtrac/project.rb', line 4 def display_name @display_name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/subtrac/project.rb', line 4 def path @path end |
#svn_dir ⇒ Object
, :temp_dir
5 6 7 |
# File 'lib/subtrac/project.rb', line 5 def svn_dir @svn_dir end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
4 5 6 |
# File 'lib/subtrac/project.rb', line 4 def template @template end |
#trac_dir ⇒ Object
, :temp_dir
5 6 7 |
# File 'lib/subtrac/project.rb', line 5 def trac_dir @trac_dir end |
Instance Method Details
#clear_temp ⇒ Object
31 32 33 34 |
# File 'lib/subtrac/project.rb', line 31 def clear_temp # delete the temporary directory #FileUtils.rm_r(@temp_dir, :force => true) end |