class Thermite::Rails::RootProject

A root project is really just the Rails project, which can have a number of nested “projects” under crates/[project name].

Attributes

path[R]

Public Class Methods

new(path) click to toggle source

@param path [String]

# File lib/thermite/rails/root_project.rb, line 13
def initialize(path)
  @path = find_root(path)
end

Public Instance Methods

ensure_built!() click to toggle source
# File lib/thermite/rails/root_project.rb, line 31
def ensure_built!
  projects.each(&:ensure_built!)
end
projects() click to toggle source

@return [Array<Thermite::Rails::Project>]

# File lib/thermite/rails/root_project.rb, line 18
def projects
  @projects ||= Dir["#{@path}/crates/*"].
                find_all { |f| File.exist?("#{f}/Cargo.toml") }.
                find_all { |f| File.exist?("#{f}/Cargo.toml") }.
                map { |d| Thermite::Rails::Project.new(d) }.
                find_all(&:thermite?)
end
projects_with_specs() click to toggle source

@return [Array<Thermite::Rails::Project>]

# File lib/thermite/rails/root_project.rb, line 27
def projects_with_specs
  projects.find_all(&:specs?)
end

Private Instance Methods

find_root(path) click to toggle source

@param path [String] @return [String]

# File lib/thermite/rails/root_project.rb, line 39
def find_root(path)
  Thermite::Rails.find_root(path) do |dir|
    !Dir["#{dir}/{Gemfile,*.gemspec}"].empty?
  end
end