class Bindle::Commands::Init

Public Instance Methods

bundle_install() click to toggle source

From railties: github.com/rails/rails/blob/f96478369e/railties/lib/rails/generators/app_base.rb#L253

# File lib/bindle/commands/init.rb, line 62
def bundle_install
  say_status :running, "bundle install"

  _bundle_command = Gem.bin_path('bundler', 'bundle')

  require 'bundler'

  if !options[:pretend]
    Bundler.with_clean_env do
      print `"#{Gem.ruby}" "#{_bundle_command}" install --binstubs`
    end
  end
end
chef() click to toggle source
# File lib/bindle/commands/init.rb, line 40
def chef
  empty_directory "chef"

  inside "chef" do
    directory "roles"

    template "README.md"
  end
end
cheffile() click to toggle source
# File lib/bindle/commands/init.rb, line 28
def cheffile
  template "Cheffile"
end
gemfile() click to toggle source
# File lib/bindle/commands/init.rb, line 32
def gemfile
  template "Gemfile"
end
gitignore() click to toggle source
# File lib/bindle/commands/init.rb, line 50
      def gitignore
        if File.exists?(File.join(self.destination_root, ".git"))
          append_to_file ".gitignore", <<-IGNORE.strip_heredoc
            /chef/cookbooks
            /chef/tmp
            /chef/packages
            /.vagrant
          IGNORE
        end
      end
install_cookbooks() click to toggle source
# File lib/bindle/commands/init.rb, line 76
def install_cookbooks
  say_status :running, "librarian-chef install"

  if !options[:pretend]
    environment = Librarian::Chef::Environment.new({pwd: self.destination_root})
    Librarian::Action::Resolve.new(environment).run
    Librarian::Action::Install.new(environment).run
  end
end
kniferb() click to toggle source
# File lib/bindle/commands/init.rb, line 19
def kniferb
  empty_directory ".chef"
  template "knife.rb", ".chef/knife.rb"
end
librarian() click to toggle source
# File lib/bindle/commands/init.rb, line 36
def librarian
  directory "librarian", ".librarian"
end
main() click to toggle source
# File lib/bindle/commands/init.rb, line 13
def main
  unless name.nil?
    self.destination_root = project_name
  end
end
vagrantfile() click to toggle source
# File lib/bindle/commands/init.rb, line 24
def vagrantfile
  template "Vagrantfile"
end

Protected Instance Methods

project_name() click to toggle source
# File lib/bindle/commands/init.rb, line 88
def project_name
  @project_name ||= begin
    if name.nil?
      File.basename(Dir.getwd).tr(".", "-")
    else
      name
    end
  end
end