Class: Awestruct::Commands::Manifest::CopyFile
- Inherits:
-
Object
- Object
- Awestruct::Commands::Manifest::CopyFile
- Defined in:
- lib/awestruct/commands/manifest.rb
Instance Method Summary (collapse)
-
- (CopyFile) initialize(path, input_path)
constructor
A new instance of CopyFile.
- - (Object) notunperform(dir)
- - (Object) perform(dir)
- - (Object) unperform(dir)
Constructor Details
- (CopyFile) initialize(path, input_path)
A new instance of CopyFile
143 144 145 146 |
# File 'lib/awestruct/commands/manifest.rb', line 143 def initialize(path, input_path) @path = path @input_path = input_path end |
Instance Method Details
- (Object) notunperform(dir)
166 167 168 169 170 171 172 173 174 |
# File 'lib/awestruct/commands/manifest.rb', line 166 def notunperform(dir) p = File.join( @dir, p ) if ( ! File.exist?( p ) ) $stderr.puts "Does not exist: #{p}" return end $stderr.puts "Remove: #{p}" FileUtils.rm( p ) end |
- (Object) perform(dir)
148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/awestruct/commands/manifest.rb', line 148 def perform(dir ) p = File.join( dir, @path ) if ( File.exist?( p ) ) $stderr.puts "Exists: #{p}" return end if ( ! File.directory?( File.dirname( p ) ) ) $stderr.puts "No directory: #{File.dirname( p )}" return end $stderr.puts "Create file: #{p}" File.open( p, 'w' ){|f| f.write( File.read( @input_path ) ) } end |
- (Object) unperform(dir)
162 163 164 |
# File 'lib/awestruct/commands/manifest.rb', line 162 def unperform(dir) # nothing end |