class Marv::Project::Functions
Public Class Methods
new(builder)
click to toggle source
Initialize functions builder
# File lib/marv/project/builder/functions.rb, line 6 def initialize(builder) @builder = builder @task = builder.task @project = builder.project @config = builder.project.config end
Public Instance Methods
clean_folders()
click to toggle source
Clean folders
# File lib/marv/project/builder/functions.rb, line 71 def clean_folders @task.shell.mute do # Clean extra folder from project root extra_folders.each do |folder| source = folder.gsub(@project.source_path, '') target = ::File.join(@project.build_path, source) @task.remove_dir target end end end
clean_functions()
click to toggle source
Clean functions
# File lib/marv/project/builder/functions.rb, line 14 def clean_functions @task.shell.mute do #remove functions and plugin php @task.remove_file ::File.join(@project.build_path, ::File.basename(@project.functions_file)) @task.remove_file ::File.join(@project.build_path, ::File.basename(@project.plugin_file)) # Remove functions folder @task.remove_dir ::File.join(@project.build_path, 'functions') end end
clean_includes()
click to toggle source
Clean includes
# File lib/marv/project/builder/functions.rb, line 52 def clean_includes @task.shell.mute do @task.remove_dir ::File.join(@project.build_path, 'includes') end end
copy_folders()
click to toggle source
Copy folders
# File lib/marv/project/builder/functions.rb, line 84 def copy_folders @task.shell.mute do # Copy extra folders to project root extra_folders.each do |folder| source = folder.gsub(@project.source_path, '') target = ::File.join(@project.build_path, source) @task.directory folder, target, :force => true end end end
copy_functions()
click to toggle source
Copy functions
# File lib/marv/project/builder/functions.rb, line 26 def copy_functions @task.shell.mute do files = copy_functions_files ::Dir.glob(::File.join(@project.functions_path, '*')).each do |file| unless files.include?(file) @task.copy_file file, ::File.join(@project.build_path, 'functions', ::File.basename(file)), :force => true end end end end
copy_functions_files()
click to toggle source
Copy functions
# File lib/marv/project/builder/functions.rb, line 39 def copy_functions_files files = [@project.functions_file, @project.plugin_file] ::Dir.glob(::File.join(@project.functions_path, '*')).each do |file| if files.include?(file) @task.copy_file file, ::File.join(@project.build_path, ::File.basename(file)), :force => true end end return files end
copy_includes()
click to toggle source
Copy includes
# File lib/marv/project/builder/functions.rb, line 59 def copy_includes @task.shell.mute do ::Dir.glob(::File.join(@project.includes_path, '**', '*')).each do |file| source = file.gsub(@project.source_path, '') target = ::File.join(@project.build_path, source) @task.copy_file file, target, :force => true unless ::File.directory?(file) end end end
extra_folders()
click to toggle source
Extra folders
# File lib/marv/project/builder/functions.rb, line 97 def extra_folders default = ['assets', 'functions', 'includes', 'templates'] folders = [] # Remove marv folders from root path ::Dir.glob(::File.join(@project.source_path, '*')).each do |folder| if ::File.directory?(folder) and ! default.include?(::File.basename(folder)) folders << folder end end # Return folders array return folders end