Sha256: 1b1bb5a5510e46bd7861b9fb0600e39dfc408c0f73473f3fc7d6bde286f515db

Contents?: true

Size: 1.52 KB

Versions: 39

Compression:

Stored size: 1.52 KB

Contents

module Isomorfeus
  module Installer
    class Gemfile
      extend Isomorfeus::Installer::DSL

      class << self
        def execute
          install_gemfile
        end

        def generate_gem_line(gem_hash)
          line = "gem '#{gem_hash[:name]}', '#{gem_hash[:version]}'"
          line << ", require: false" if gem_hash.key?(:require) && !gem_hash[:require]
          line << "\n"
        end

        def install_gemfile
          rack_server_gems = ''
          Isomorfeus::Installer.rack_servers[Isomorfeus::Installer.options[:rack_server]]&.fetch(:gems)&.each do |gem|
            rack_server_gems << generate_gem_line(gem)
          end
          data_hash = { rack_server_gems: rack_server_gems.chop }

          if Isomorfeus::Installer.project_name == 'test_app'
            gem_lines = ''
            %i[isomorfeus isomorfeus-data isomorfeus-empowerment isomorfeus-i18n isomorfeus-mailer isomorfeus-operation isomorfeus-policy isomorfeus-preact isomorfeus-redux isomorfeus-transport].each do |i_module|
              gem_lines << "gem '#{i_module}', path: #{Isomorfeus::Installer.isomorfeus_module == i_module ? "'..'\n" : "'../../#{i_module}'"}\n"
            end
            data_hash[:isomorfeus_gems] = gem_lines.chop
          else
            data_hash[:isomorfeus_gems] = "gem 'isomorfeus', '~> #{Isomorfeus::VERSION}'"
          end

          create_file_from_template(Isomorfeus::Installer.templates_path, 'Gemfile.erb', 'Gemfile', data_hash)
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
isomorfeus-23.9.0.rc12 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc11 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc10 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc9 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc8 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc7 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc6 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc5 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc4 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc3 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc2 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.9.0.rc1 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.8.0.rc3 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.8.0.rc2 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.8.0.rc1 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.7.0.rc5 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.7.0.rc4 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.7.0.rc3 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.7.0.rc2 lib/isomorfeus/installer/gemfile.rb
isomorfeus-23.7.0.rc1 lib/isomorfeus/installer/gemfile.rb