Class: FoxPage::Generator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



11
12
13
# File 'lib/fox_page/generator.rb', line 11

def self.source_root
  File.join(__dir__, "app_template")
end

Instance Method Details

#create_applicationObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/fox_page/generator.rb', line 15

def create_application
  Dir[File.join(self.class.source_root, "**/*.tt")]
    .map { |path| path.sub(self.class.source_root + "/", "") }
    .each do |path|
    template(path,
             File.join(name,
                       path.sub(/\.tt$/, "")
                           .gsub(/__dot__/, ".")))
  end
end

#init_git_repoObject



33
34
35
36
37
38
# File 'lib/fox_page/generator.rb', line 33

def init_git_repo
  Dir.chdir(name) do
    system("git init")
    system("git add .")
  end
end

#run_bundleObject



26
27
28
29
30
31
# File 'lib/fox_page/generator.rb', line 26

def run_bundle
  Dir.chdir(name) do
    system("bundle install")
    system("bundle binstubs foxpage")
  end
end