Class: Boostx::Core::Builder
- Inherits:
-
Object
- Object
- Boostx::Core::Builder
- Defined in:
- lib/boostx/core/builder.rb
Instance Method Summary collapse
- #init(project_name) ⇒ Object
- #make_dir(folder_name) ⇒ Object
- #make_file(file_name, path = Dir.pwd, extension = '.rb') ⇒ Object
Instance Method Details
#init(project_name) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/boostx/core/builder.rb', line 27 def init(project_name) directions = ['lib', "lib/#{project_name}"] directions.each do |dir| self.make_dir(dir) end make_file("#{project_name}", 'lib') make_file('Gemfile', Dir.pwd, '') end |
#make_dir(folder_name) ⇒ Object
6 7 8 |
# File 'lib/boostx/core/builder.rb', line 6 def make_dir(folder_name) FileUtils::mkdir_p folder_name end |
#make_file(file_name, path = Dir.pwd, extension = '.rb') ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/boostx/core/builder.rb', line 10 def make_file(file_name, path = Dir.pwd, extension = '.rb') unless File.directory?(path) self.make_dir(path) end if path != Dir.pwd path << '/' else path = '' end path << "#{file_name}#{extension}" new_file = File.new(path, 'w') new_file.close end |