Sha256: dbd62e6ea0500f9b2ae72779bb4e9370929d97d1421f0804b998b070bdeda9e6

Contents?: true

Size: 1.6 KB

Versions: 31

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

require "sprockets/railtie"
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[spec rubocop]

Bundler.require(:default)

# Load your gem's code
require_relative "lib/easy_ml"

# Load the annotate tasks
require "annotate/annotate_models"

task :environment do
  require "combustion"
  require "sprockets"
  Combustion.path = "spec/internal"
  Combustion.initialize! :active_record do |config|
    config.assets = ActiveSupport::OrderedOptions.new # Stub to avoid errors
    config.assets.enabled = false # Set false since assets are handled by Vite
  end
  EasyML::Engine.eager_load!
end

namespace :easy_ml do
  task annotate_models: :environment do
    model_dir = File.expand_path("app/models", EasyML::Engine.root)
    $LOAD_PATH.unshift(model_dir) unless $LOAD_PATH.include?(model_dir)

    AnnotateModels.do_annotations(
      is_rake: true,
      model_dir: [EasyML::Engine.root.join("app/models/easy_ml").to_s],
      root_dir: [EasyML::Engine.root.join("app/models/easy_ml").to_s],
      include_modules: true, # Include modules/namespaces in the annotation
    )
  end

  task :create_test_migrations do
    require "combustion"
    require "rails/generators"
    require_relative "lib/easy_ml/railtie/generators/migration/migration_generator"

    db_files = Dir.glob(EasyML::Engine.root.join("spec/internal/db/migrate/**/*"))

    FileUtils.rm(db_files)
    Rails::Generators.invoke("easy_ml:migration", [], { destination_root: EasyML::Engine.root.join("spec/internal") })
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
easy_ml-0.2.0.pre.rc40 Rakefile
easy_ml-0.2.0.pre.rc39 Rakefile
easy_ml-0.2.0.pre.rc38 Rakefile
easy_ml-0.2.0.pre.rc37 Rakefile
easy_ml-0.2.0.pre.rc36 Rakefile
easy_ml-0.2.0.pre.rc35 Rakefile
easy_ml-0.2.0.pre.rc34 Rakefile
easy_ml-0.2.0.pre.rc33 Rakefile
easy_ml-0.2.0.pre.rc32 Rakefile
easy_ml-0.2.0.pre.rc31 Rakefile
easy_ml-0.2.0.pre.rc30 Rakefile
easy_ml-0.2.0.pre.rc29 Rakefile
easy_ml-0.2.0.pre.rc28 Rakefile
easy_ml-0.2.0.pre.rc27 Rakefile
easy_ml-0.2.0.pre.rc26 Rakefile
easy_ml-0.2.0.pre.rc25 Rakefile
easy_ml-0.2.0.pre.rc24 Rakefile
easy_ml-0.2.0.pre.rc23 Rakefile
easy_ml-0.2.0.pre.rc22 Rakefile
easy_ml-0.2.0.pre.rc21 Rakefile