Class: Cubic::Generator::Gemfile

Inherits:
Base
  • Object
show all
Defined in:
lib/cubic/generators/gemfile.rb

Overview

Creates a Gemfiles in the root directory of the generated application.

Instance Attribute Summary

Attributes inherited from Base

#files

Instance Method Summary collapse

Methods inherited from Base

#callback, #generate, #initialize

Constructor Details

This class inherits a constructor from Cubic::Generator::Base

Instance Method Details

#designObject

Creates a hash that will be used for file generation purposes



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cubic/generators/gemfile.rb', line 7

def design
  group = ['source "https://rubygems.org"',
           'gem "sinatra"',
           'gem "rake"',
           'gem "sequel"',
           'gem "haml"']

  gems = [Config[:gems], Config[:orm], Config[:db]].flatten.compact
  gems.map! { |gem| "gem '#{gem}'" }

  @files << { name: 'Gemfile',
              path: '/',
              content: gems.unshift(group).flatten!.join("\n") }
end