Class: Bjork::Generator

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

Instance Method Summary collapse

Instance Method Details

#generate_files!Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/bjork/generator.rb', line 12

def generate_files!
  # Copy project template
  directory "project", location

  %w[
    Gemfile
  ].each do |file|
    template file, File.join(location, file)
  end
end

#setup!Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/bjork/generator.rb', line 23

def setup!
  inside(location) do
    fn = -> { run('bundle install') }

    if defined? Bundler
      Bundler.with_clean_env(&fn)
    else
      fn.call
    end
  end
end