Class: Shippy::Cli::Init
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Shippy::Cli::Init
- Includes:
- Thor::Actions
- Defined in:
- lib/shippy/cli/init.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_shippy_to_gemfile ⇒ Object
- #create_config_file ⇒ Object
- #create_default_apps ⇒ Object
- #create_secrets_file ⇒ Object
- #genegate_gitignore ⇒ Object
- #generate_binstubs ⇒ Object
- #init_gemfile ⇒ Object
- #init_git ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
4 5 6 |
# File 'lib/shippy/cli/init.rb', line 4 def self.exit_on_failure? true end |
.source_root ⇒ Object
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_gemfile ⇒ Object
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_file ⇒ Object
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_apps ⇒ Object
36 37 38 |
# File 'lib/shippy/cli/init.rb', line 36 def create_default_apps directory "templates/apps", "apps" end |
#create_secrets_file ⇒ Object
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_gitignore ⇒ Object
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_binstubs ⇒ Object
32 33 34 |
# File 'lib/shippy/cli/init.rb', line 32 def generate_binstubs run "bundle binstubs shippy" end |
#init_gemfile ⇒ Object
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_git ⇒ Object
40 41 42 |
# File 'lib/shippy/cli/init.rb', line 40 def init_git run "git init" end |