Class: Shippy::Cli::Init

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/shippy/cli/init.rb', line 4

def self.exit_on_failure?
  true
end

.source_rootObject



8
9
10
# File 'lib/shippy/cli/init.rb', line 8

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#add_shippy_to_gemfileObject



26
27
28
29
30
# File 'lib/shippy/cli/init.rb', line 26

def add_shippy_to_gemfile
  insert_into_file "Gemfile", "gem 'shippy', '~> #{Shippy::VERSION}'"

  run "bundle install", abort_on_failure: false
end

#create_config_fileObject



12
13
14
# File 'lib/shippy/cli/init.rb', line 12

def create_config_file
  copy_file "templates/config/shippy.yml", "config/shippy.yml"
end

#create_default_appsObject



36
37
38
# File 'lib/shippy/cli/init.rb', line 36

def create_default_apps
  directory "templates/apps", "apps"
end

#create_secrets_fileObject



16
17
18
# File 'lib/shippy/cli/init.rb', line 16

def create_secrets_file
  copy_file "templates/config/secrets.yml", "config/secrets.yml"
end

#genegate_gitignoreObject



44
45
46
47
48
49
# File 'lib/shippy/cli/init.rb', line 44

def genegate_gitignore
  create_file ".gitignore"
  insert_into_file ".gitignore", "/.bundle/\n"
  insert_into_file ".gitignore", "/builds/\n"
  insert_into_file ".gitignore", "/config/secrets.yml\n"
end

#generate_binstubsObject



32
33
34
# File 'lib/shippy/cli/init.rb', line 32

def generate_binstubs
  run "bundle binstubs shippy"
end

#init_gemfileObject



20
21
22
23
24
# File 'lib/shippy/cli/init.rb', line 20

def init_gemfile
  return if ::File.exist?("Gemfile")

  run "bundle init", abort_on_failure: false
end

#init_gitObject



40
41
42
# File 'lib/shippy/cli/init.rb', line 40

def init_git
  run "git init"
end