class Sumodev::Generators::Fork::V3

Attributes

destination_dir[RW]

Public Instance Methods

checkout_fork() click to toggle source
# File lib/sumodev/generators/fork/v3.rb, line 23
def checkout_fork
  git :clone    => "#{options[:fork_repository]} ."
  git :checkout => "origin/#{options[:branch]}"
  FileUtils.rm_rf '.git'
end
create_root() click to toggle source
# File lib/sumodev/generators/fork/v3.rb, line 17
def create_root
  self.destination_root = self.destination_dir = Pathname.pwd + client + name
  FileUtils.mkdir_p destination_dir
  FileUtils.chdir   destination_dir
end
initialize_repo() click to toggle source
# File lib/sumodev/generators/fork/v3.rb, line 29
def initialize_repo
  git :init
  git_track 'Initial commit'
end
setup_globals() click to toggle source
# File lib/sumodev/generators/fork/v3.rb, line 34
def setup_globals
  git_track 'Setting up globals' do
    copy_dest_file 'library/globals.base.php', 'library/globals.php'
    copy_dest_file 'library/globals_frontend.base.php', 'library/globals_frontend.php'
    copy_dest_file 'library/globals_backend.base.php', 'library/globals_backend.php'

    replace_in_file 'library/globals.php', {
      "'<debug-mode>'"         => 'true',
      "<spoon-debug-email>"    => 'bugs@sumocoders.be',
      "<database-name>"        => name,
      "<database-hostname>"    => 'localhost',
      "<database-port>"        => '3306',
      "<database-username>"    => config[:db][:username],
      "<database-password>"    => config[:db][:password],
      "<site-domain>"          => "#{name}.#{client}.dev",
      "'<site-multilanguage>'" => options[:multilanguage].to_s,
      "<action-group-tag>"     => '@actiongroup',
      "<action-rights-level>"  => 7,
      "<path-www>"             => destination_dir + "default_www",
      "<path-library>"         => destination_dir + "library"
    }

    replace_in_file 'library/globals_frontend.php', {
      '<site-default-language>' => options[:default_language]
    }
  end
end

Private Instance Methods

config() click to toggle source

Config

# File lib/sumodev/generators/fork/v3.rb, line 66
def config
  # TODO - Fetch this from ~/.sumorc OR ~/.my.cnf
  {
    :db => {
      :username => 'root',
      :password => 'root'
    }
  }
end