Class: Suite::Generators::Project

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/suite/generators/project.rb

Instance Method Summary collapse

Instance Method Details

#copy_filesObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/suite/generators/project.rb', line 34

def copy_files
  template "application.js.erb", "#{name}/assets/javascripts/application.js"
  template "core.js.coffee", "#{name}/assets/javascripts/core.js.coffee"

  template "application.scss.erb", "#{name}/assets/stylesheets/#{name}.css.scss"

  template "suite.yml.erb", "#{name}/config/suite.yml"
  template "content.yml", "#{name}/config/content.yml"

  template "template.html.haml.erb", "#{name}/content/layouts/application.html.haml"
  template "homepage.html.haml", "#{name}/content/homepage.html.haml"
  template "info.html.haml", "#{name}/content/info.html.haml"
end

#create_configObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/suite/generators/project.rb', line 9

def create_config
  say "I’m going to ask you some questions to create your config file", :cyan
  say "You can change these values in your config/suite.yml file", :cyan
  @compress_javascript = yes? "Compress JavaScript? [Yn]"
  @shorten_javascript_variables = yes? "Shorten JavaScript Variables? [Yn]"
  @compress_stylesheet = yes? "Compress CSS? [Yn]"
  @using_cdn = yes? "Will you serve assets from a CDN?"
  if @using_cdn
    @asset_host = ask("CDN Host and path [e.g. http://ak43nam.cloudfront.net/new_site]").gsub(/\/$/,'')
  end
end

#create_directory_structureObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/suite/generators/project.rb', line 21

def create_directory_structure
  empty_directory
  empty_directory "build"
  empty_directory "config"
  empty_directory "content"
  empty_directory "content/layouts"
  empty_directory "assets"
  empty_directory "assets/icons"
  empty_directory "assets/images"
  empty_directory "assets/javascripts"
  empty_directory "assets/stylesheets"
end

#gitObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/suite/generators/project.rb', line 48

def git
  if yes? "Create git repo? [Yn]"
    shell.mute do
      inside name do
        run 'git init'
      end
      template "gitignore", "#{name}/.gitignore"
    end
  end
end