Class: RailsSVNPrep
- Inherits:
-
Object
- Object
- RailsSVNPrep
- Defined in:
- lib/rorsvnprep.rb
Overview
This class provides all the heavy lifting methods used by the command-line utility. This class could also be implemented as part of another package to provide further automated utilities.
Constant Summary collapse
- @@version =
[ 0, 1, 1 ]
Class Method Summary collapse
-
.version ⇒ Object
A convenience method to return our version number.
Instance Method Summary collapse
-
#create_project ⇒ Object
This method creates a new project and moves us into the new directory.
- #finalize ⇒ Object
- #generate_cvsignore ⇒ Object
-
#initialize(projname = nil, svnuri = nil, svnpass = nil, logfile = nil, verbose = false) ⇒ RailsSVNPrep
constructor
The new method expects up to four arguments.
- #run ⇒ Object
- #subversion_checkout ⇒ Object
- #subversion_import ⇒ Object
- #subversion_propset ⇒ Object
- #trim_project ⇒ Object
Constructor Details
#initialize(projname = nil, svnuri = nil, svnpass = nil, logfile = nil, verbose = false) ⇒ RailsSVNPrep
The new method expects up to four arguments. Only if the projname argument is missing will the method raise an error for anything other than failed validation.
22 23 24 25 26 27 28 |
# File 'lib/rorsvnprep.rb', line 22 def initialize(projname = nil, svnuri = nil, svnpass = nil, logfile = nil, verbose = false) @project = projname @svn = svnuri @password = svnpass @log = logfile @verbose = verbose end |
Class Method Details
.version ⇒ Object
A convenience method to return our version number
92 93 94 |
# File 'lib/rorsvnprep.rb', line 92 def RailsSVNPrep.version @@version end |
Instance Method Details
#create_project ⇒ Object
This method creates a new project and moves us into the new directory. The method makes direct call to the rails command and dumps the output to /dev/null.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rorsvnprep.rb', line 55 def create_project #if Dir::glob(@project) # puts "A folder named #{@project} already exists: exiting." if @verbose # @logfile.puts "A folder named #{@project} already exists: exiting." if @logfile # raise StandardError #end if system "rails #{@project} >> /dev/null" puts "Rails Project Folder Successfully Created." if @verbose @logfile.puts "Rails Project Folder Successfully Created." if @logfile Dir::chdir @project else puts "Error creating the Rails project folder: exiting." if @verbose @logfile.puts "Error creating the Rails project folder: exiting." if @logfile raise StandardError end end |
#finalize ⇒ Object
88 89 |
# File 'lib/rorsvnprep.rb', line 88 def finalize end |
#generate_cvsignore ⇒ Object
76 77 |
# File 'lib/rorsvnprep.rb', line 76 def generate_cvsignore end |
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rorsvnprep.rb', line 30 def run puts "Rails SVN Prep: Starting." if @verbose @logfile.puts "Rails SVN Prep: Starting." if @logfile create_project trim_project generate_cvsignore unless @svn subversion_import if @svn subversion_checkout if @svn subversion_propset if @svn finalize puts "Rails SVN Prep: Complete." if @verbose @logfile.puts "Rails SVN Prep: Complete." if @logfile end |
#subversion_checkout ⇒ Object
82 83 |
# File 'lib/rorsvnprep.rb', line 82 def subversion_checkout end |
#subversion_import ⇒ Object
79 80 |
# File 'lib/rorsvnprep.rb', line 79 def subversion_import end |
#subversion_propset ⇒ Object
85 86 |
# File 'lib/rorsvnprep.rb', line 85 def subversion_propset end |
#trim_project ⇒ Object
73 74 |
# File 'lib/rorsvnprep.rb', line 73 def trim_project end |