Sha256: 9ddb0296b082b18d330b5761d39b61dd8f3cb14a08d50b3307c122e4544fbbf6

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

module GrapePress
  module Tree
    private

    def generate_tree
      generate_app_tree
      generate_bin_tree
      generate_config_tree
      generate_spec_tree
      generate_database_tree
      generate_models_tree
    end

    def generate_app_tree
      empty_directory app_name
      empty_directory File.join(app_name, 'app')
      empty_directory File.join(app_name, 'app', 'api')
      empty_directory File.join(app_name, 'app', 'api', 'v1')
      empty_directory File.join(app_name, 'app', 'api', 'v1', 'entities')
    end

    def generate_bin_tree
      empty_directory File.join(app_name, 'bin')
    end

    def generate_config_tree
      empty_directory File.join(app_name, 'config')
      empty_directory File.join(app_name, 'config', 'environments')
      empty_directory File.join(app_name, 'config', 'initializers')
      empty_directory File.join(app_name, 'config', 'locales')
    end

    def generate_spec_tree
      empty_directory File.join(app_name, 'spec')
      empty_directory File.join(app_name, 'spec', 'support')
    end

    def generate_database_tree
      return unless active_record
      empty_directory File.join(app_name, 'db')
      empty_directory File.join(app_name, 'db', 'migrations')
    end

    def generate_models_tree
      return unless active_record || mongoid
      empty_directory File.join(app_name, 'app', 'models')
      empty_directory File.join(app_name, 'spec', 'models')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape_press-0.0.2 lib/grape_press/tree.rb
grape_press-0.0.1 lib/grape_press/tree.rb