class Photish::Command::Init

Public Instance Methods

run() click to toggle source
# File lib/photish/command/init.rb, line 4
def run
  if runtime_config.example
     init_example
  else
     init_barebones
  end
  log.debug "Photish site initiated successfully"
end

Private Instance Methods

asset_path(*path) click to toggle source
# File lib/photish/command/init.rb, line 55
def asset_path(*path)
  File.join(File.dirname(__FILE__), '..', 'assets', path)
end
barebones_site_dir() click to toggle source
# File lib/photish/command/init.rb, line 47
def barebones_site_dir
  asset_path('barebones', 'site')
end
config_file() click to toggle source
# File lib/photish/command/init.rb, line 35
def config_file
  asset_path('config.yml')
end
example_photo_dir() click to toggle source
# File lib/photish/command/init.rb, line 43
def example_photo_dir
  asset_path('example', 'photos')
end
example_site_dir() click to toggle source
# File lib/photish/command/init.rb, line 51
def example_site_dir
  asset_path('example', 'site')
end
gemfile_file() click to toggle source
# File lib/photish/command/init.rb, line 31
def gemfile_file
  asset_path('Gemfile')
end
gitignore_file() click to toggle source
# File lib/photish/command/init.rb, line 39
def gitignore_file
  asset_path('gitignore')
end
init_barebones() click to toggle source
# File lib/photish/command/init.rb, line 15
def init_barebones
  FileUtils.cp_r(config_file, Dir.pwd)
  FileUtils.cp_r(gemfile_file, Dir.pwd)
  FileUtils.cp_r(gitignore_file, File.join(Dir.pwd, '.gitignore'))
  FileUtils.mkdir_p('photos')
  FileUtils.cp_r(barebones_site_dir, Dir.pwd)
end
init_example() click to toggle source
# File lib/photish/command/init.rb, line 23
def init_example
  FileUtils.cp_r(config_file, Dir.pwd)
  FileUtils.cp_r(gemfile_file, Dir.pwd)
  FileUtils.cp_r(gitignore_file, File.join(Dir.pwd, '.gitignore'))
  FileUtils.cp_r(example_photo_dir, Dir.pwd)
  FileUtils.cp_r(example_site_dir, Dir.pwd)
end