Class: Dicker::Build
- Inherits:
-
Object
- Object
- Dicker::Build
- Defined in:
- lib/dicker/build.rb
Instance Method Summary collapse
- #build ⇒ Object
- #copy_files ⇒ Object
- #init_git ⇒ Object
-
#initialize(project, source_dir) ⇒ Build
constructor
A new instance of Build.
Constructor Details
#initialize(project, source_dir) ⇒ Build
Returns a new instance of Build.
5 6 7 8 |
# File 'lib/dicker/build.rb', line 5 def initialize(project, source_dir) @project = project @source_dir = source_dir end |
Instance Method Details
#build ⇒ Object
10 11 12 13 |
# File 'lib/dicker/build.rb', line 10 def build self.copy_files self.init_git end |
#copy_files ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dicker/build.rb', line 20 def copy_files Find.find("#{@source_dir}") do |source| target = source.sub(/^#{@source_dir}/, @project) if File.directory? source Find.prune if File.basename(source) == '.git' FileUtils.mkdir target unless File.exists? target else FileUtils.copy source, target puts "Copying #{source}" end end end |
#init_git ⇒ Object
15 16 17 18 |
# File 'lib/dicker/build.rb', line 15 def init_git Dir.chdir @project system('git init') end |