Class: Awestruct::Commands::Manifest::CopyFile
- Inherits:
-
Object
- Object
- Awestruct::Commands::Manifest::CopyFile
- Defined in:
- lib/awestruct/commands/manifest.rb
Instance Method Summary collapse
-
#initialize(path, input_path) ⇒ CopyFile
constructor
A new instance of CopyFile.
- #notunperform(dir) ⇒ Object
- #perform(dir) ⇒ Object
- #unperform(dir) ⇒ Object
Constructor Details
#initialize(path, input_path) ⇒ CopyFile
Returns a new instance of CopyFile.
142 143 144 145 |
# File 'lib/awestruct/commands/manifest.rb', line 142 def initialize(path, input_path) @path = path @input_path = input_path end |
Instance Method Details
#notunperform(dir) ⇒ Object
165 166 167 168 169 170 171 172 173 |
# File 'lib/awestruct/commands/manifest.rb', line 165 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 |
#perform(dir) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/awestruct/commands/manifest.rb', line 147 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 |
#unperform(dir) ⇒ Object
161 162 163 |
# File 'lib/awestruct/commands/manifest.rb', line 161 def unperform(dir) # nothing end |