Class: Singu::CLI

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

Constant Summary collapse

DEFAULT_SINATRA_TEMPLATE_REPO =
'regedarek/singu-sinatra-template'
DEFAULT_ANGULAR_TEMPLATE_REPO =
'regedarek/singu-angular-template'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



14
15
16
# File 'lib/singu/cli.rb', line 14

def self.source_root
  "."
end

Instance Method Details

#create_app_from_templateObject



29
30
31
32
33
34
# File 'lib/singu/cli.rb', line 29

def create_app_from_template
  sinatra_repo = options.fetch(:template){{}}.fetch('sinatra', DEFAULT_SINATRA_TEMPLATE_REPO)
  angular_repo = options.fetch(:template){{}}.fetch('angular', DEFAULT_ANGULAR_TEMPLATE_REPO)
  clone_repo(sinatra_repo)
  clone_repo(angular_repo) unless options[:'skip-angular']
end

#initialize_git_repoObject



36
37
38
39
40
# File 'lib/singu/cli.rb', line 36

def initialize_git_repo
  inside(@app_path) do
    run('git init .')
  end
end

#install_dependenciesObject



42
43
44
45
46
# File 'lib/singu/cli.rb', line 42

def install_dependencies
  inside(@app_path) do
    run('bundle')
  end
end

#setupObject



24
25
26
27
# File 'lib/singu/cli.rb', line 24

def setup
  @app_path = name.directory_name
  @name     = name.file_name
end