module Pave class Concrete include Pave::Shell attr_accessor :name def self.create(name) say "" return say "Options should be given after the application name. For details run: `pave help`" unless name.size > 0 say "Setting up Concrete5 in folder #{name}." new(name).setup end def initialize(name) @name = name end def setup set_up_pave clone_concrete5 set_up_folders add_config_customizations set_up_git create_virtual_host self end def set_up_pave sh "mkdir ~/.pave" unless File.exists?(File.join(Dir.home, ".pave/")) end def clone_concrete5 c5 = "concrete5.6.2.1" c5_link = "http://www.concrete5.org/download_file/-/view/58379/8497" unless File.exists?(File.join(Dir.home, ".pave/#{c5}.zip")) say "* Downloading #{c5}..." sh "curl #{c5_link} > ~/.pave/#{c5}.zip" end say "* Copying Concrete5 into #{name}..." sh "unzip -qq ~/.pave/#{c5}.zip && mv #{c5} #{name}" end def set_up_folders say "* Setting up folders..." remove_extra_folders modify_folder_permissions end def set_up_git say "* Setting up git..." sh "touch #{name}/.gitignore" gitignored.each{ |ignored| sh "echo '#{ignored}' >> #{name}/.gitignore" } gitkept_folders.each{ |folder| sh "touch #{name}/#{folder}/.keep" } sh "touch #{name}/files/.keep" sh "touch #{name}/updates/.keep" end def add_config_customizations config_file = "#{name}/concrete/core/controllers/single_pages/install.php" insert_pattern = "'{$salt}');\\n\";" file_insert config_file, insert_pattern, config_customizations end def config_customizations command =<