Class: Prow::AppBuilder::Create

Inherits:
Struct
  • Object
show all
Defined in:
lib/prow/app_builder/create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



3
4
5
# File 'lib/prow/app_builder/create.rb', line 3

def path
  @path
end

Instance Method Details

#app_pathObject



47
48
49
# File 'lib/prow/app_builder/create.rb', line 47

def app_path
  path || `pwd`.chomp
end

#copy(file_path) ⇒ Object



39
40
41
# File 'lib/prow/app_builder/create.rb', line 39

def copy(file_path)
  FileUtils.cp(templates_path + "/" + file_path, app_path + "/" + file_path)
end

#copy_pages_and_layoutsObject



20
21
22
23
# File 'lib/prow/app_builder/create.rb', line 20

def copy_pages_and_layouts
  copy('templates/layouts/default.mustache')
  copy('templates/pages/index.mustache')
end

#copy_partialsObject



25
26
27
# File 'lib/prow/app_builder/create.rb', line 25

def copy_partials
  ShipdStyle::CopyDirectory.new(app_path + "/templates/partials", "templates").perform
end

#create_and_move_stylesheetsObject



29
30
31
32
33
# File 'lib/prow/app_builder/create.rb', line 29

def create_and_move_stylesheets
  copier = ShipdStyle::CopyStylesheets.new(app_path)
  copier.perform
  copier.remove_namespace
end

#mkdir(dir) ⇒ Object



35
36
37
# File 'lib/prow/app_builder/create.rb', line 35

def mkdir(dir)
  FileUtils.mkdir(app_path + "/" + dir) unless File.exist?(dir)
end

#performObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/prow/app_builder/create.rb', line 4

def perform
  copy('config.ru')
  copy('Guardfile')
  mkdir('public')
  mkdir('templates')
  mkdir('config')
  mkdir('templates/layouts')
  mkdir('templates/pages')
  mkdir('templates/partials')
  copy('config/pages.json')
  copy_partials
  mkdir('sass')
  create_and_move_stylesheets
  copy_pages_and_layouts
end

#templates_pathObject



43
44
45
# File 'lib/prow/app_builder/create.rb', line 43

def templates_path
  File.dirname(__FILE__) + "/templates"
end