Sha256: a4a1515e4964e1c4667042fc0c1d6a04f56a495373c9b50af784f1f95c240ecd

Contents?: true

Size: 898 Bytes

Versions: 10

Compression:

Stored size: 898 Bytes

Contents

module Munge
  module Cli
    module Commands
      class Init
        include Thor::Base
        include Thor::Actions

        def self.source_root
          File.expand_path("../../../../../seeds", __FILE__)
        end

        def initialize(path)
          self.options = {}
          self.destination_root = File.expand_path(path)
        end

        def call
          directory(".", destination_root)

          inside(destination_root) do
            run_bundle("install")
            run_bundle("binstub munge")
          end
        end

        private

        def run_bundle(command)
          if Gem::Specification.find_all_by_name("bundler").any?
            say_status :run, "bundle #{command}"

            require "bundler"

            ::Bundler.with_clean_env do
              system("bundle #{command}")
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
munge-0.18.0 lib/munge/cli/commands/init.rb
munge-0.17.0 lib/munge/cli/commands/init.rb
munge-0.16.0 lib/munge/cli/commands/init.rb
munge-0.15.1 lib/munge/cli/commands/init.rb
munge-0.15.0 lib/munge/cli/commands/init.rb
munge-0.14.0 lib/munge/cli/commands/init.rb
munge-0.13.0 lib/munge/cli/commands/init.rb
munge-0.12.0 lib/munge/cli/commands/init.rb
munge-0.11.1 lib/munge/cli/commands/init.rb
munge-0.11.0 lib/munge/cli/commands/init.rb