Class: DrinkUpDoctor::NewTwbsSite

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/drink_up_doctor/new_twbs_site.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



22
23
24
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 22

def self.source_root
  File.expand_path("../../../", __FILE__)
end

Instance Method Details

#app_nameObject



8
9
10
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 8

def app_name
  @app_name || File.basename($0)
end

#copy_bootstrap_boilerplateObject



84
85
86
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 84

def copy_bootstrap_boilerplate
  directory "bootstrap-boilerplate", name
end

#copy_gemfileObject



75
76
77
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 75

def copy_gemfile
  copy_file "templates/Gemfile", "#{name}/Gemfile"
end

#copy_gulp_fileObject



71
72
73
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 71

def copy_gulp_file
  template "templates/gulpfile.js.erb", "#{name}/gulpfile.js"
end

#create_baseurl_configObject



54
55
56
57
58
59
60
61
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 54

def create_baseurl_config
  config_file = "#{name}/_baseurl.yml"
  config = {
    "baseurl" => options["baseurl"]
  }
  create_file config_file, config.to_yaml
  prepend_to_file config_file, "# Generated by #{app_name}"
end

#create_bower_fileObject



63
64
65
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 63

def create_bower_file
  template "templates/bower.json.erb", "#{name}/bower.json"
end

#create_configObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 30

def create_config
  config_file = "#{name}/_config.yml"
  config = {"name" => name}
  config.merge! options
  config.merge!({
      "social" => {
        "twitter" => options["twitter_username"],
        "github"  => options["github_username"]
      },
      "baseurl" => "",
      "markdown" => "kramdown",
      "kramdown" => {
        "input" => "GFM",
        "hard_wrap" => false
      },
      "defaults" => {
        "author" => options["author"]
      },
      "exclude" => %w[README.md bower.json package.json gulpfile.js node_modules bower_components Gemfile Gemfile.lock]
    })
  create_file config_file, config.to_yaml
  prepend_to_file config_file, "# Generated by #{app_name}\n"
end

#create_package_fileObject



67
68
69
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 67

def create_package_file
  template "templates/package.json.erb", "#{name}/package.json"
end

#create_project_directoryObject



26
27
28
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 26

def create_project_directory
  empty_directory name
end

#create_setupObject



79
80
81
82
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 79

def create_setup
  copy_file "templates/setup.sh", "#{name}/.setup.sh"
  chmod "#{name}/.setup.sh", 0755
end


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/drink_up_doctor/new_twbs_site.rb', line 88

def print_instructions
  puts <<-instructions

********************************************************************************

  Completing the Installation
  ---------------------------

  Change into the new site directory and run the setup script:


  $ cd "./#{name}"
  $ ./.setup.sh

  This will install the npm modules, bower components, and ruby gems
  needed to work with your new site.

  After the setup is complete, you can start up the gulp server and
  start blogging:

  $ gulp

  When you are ready to publish, shut down the gulp server with Ctrl-C
  and run the distribution build:

  $ gulp dist

  The distribution will be in "./#{name}/_dist/" and you can push that
  to where your site is located. (Github pages, AWS S3, your own server,
  or whatever you choose to use.)

********************************************************************************

instructions
end