Class: Awestruct::CLI::Manifest::CopyFile
- Inherits:
-
Object
- Object
- Awestruct::CLI::Manifest::CopyFile
- Defined in:
- lib/awestruct/cli/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.
145 146 147 148 |
# File 'lib/awestruct/cli/manifest.rb', line 145 def initialize(path, input_path) @path = path @input_path = input_path end |
Instance Method Details
#notunperform(dir) ⇒ Object
168 169 170 171 172 173 174 175 176 |
# File 'lib/awestruct/cli/manifest.rb', line 168 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
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/awestruct/cli/manifest.rb', line 150 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
164 165 166 |
# File 'lib/awestruct/cli/manifest.rb', line 164 def unperform(dir) # nothing end |