class AddFile
Public Class Methods
dir(dir)
click to toggle source
# File lib/envGen/add_file.rb, line 88 def self.dir(dir) # takes in dir name, adds all Ruby files in dir files = self.findRuby(dir) # binding.pry files.each do |file| if file.include?(".rb") && File.file?(file) self.single(file) end end end
findRuby(dir)
click to toggle source
# File lib/envGen/add_file.rb, line 78 def self.findRuby(dir) # find all of the Ruby files in the current dir/sub dirs rubyFiles = [] Find.find(dir) do |path| if File.extname(path) == ".rb" rubyFiles << path # and compile a list end end rubyFiles end
multiple(*input)
click to toggle source
# File lib/envGen/add_file.rb, line 72 def self.multiple(*input) # handles writing files input.flatten.each do |f| single(f) end end
single(input)
click to toggle source
# File lib/envGen/add_file.rb, line 55 def self.single(input) # handles writing files # binding.pry new_file = PrepareFile.createIfNotInConfig(input) if new_file # if not nil # binding.pry if File.file?(new_file.file) # check if file with full path of new_file if new_file.isRuby? new_file.write else new_file.notRuby end else puts "'#{new_file.fileName}' not found" end end end