Class: Motion::Util::IbHeaderGenerator
- Inherits:
-
Object
- Object
- Motion::Util::IbHeaderGenerator
- Defined in:
- lib/motion-util/command/ib_header.rb
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/motion-util/command/ib_header.rb', line 6 def run project_dir = Dir.pwd dst_dir = File.join project_dir, "tmp", "header" FileUtils.mkdir_p dst_dir Dir.glob(["app/**/*.rb", "lib/**/*.rb"]) do |f| ib = IbHeader.new ib.source = File.read(f) dst_name = ib.dst_name_of f dst = File.join(dst_dir, dst_name) FileUtils.mkdir_p File.dirname(dst) File.open(dst, "w") do |f| f.write(ib.context) end end end |