Sha256: f1edac2b837813216a0a2703f43a397561c620bcbf96e0d1954d3994391e9452

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

stdlib_dependencies = %w[benchmark date digest forwardable json logger monitor mutex_m singleton time]
gem_dependencies = %w[nokogiri]
rails_dependencies = %w[activesupport]

VERSIONS.each do |version|
  namespace version do
    namespace :active_model do
      export = "export/activemodel/#{version}"

      desc "export to #{export}"
      task :export do
        sh "rm -fr #{export}"
        sh "mkdir -p #{export}"

        sh "cp -a out/#{version}/active_model.rbs #{export}"
        sh "cp -a out/#{version}/active_model #{export}"
        sh "rm #{export}/active_model/railtie.rbs"

        Pathname(export).join("EXTERNAL_TODO.rbs").write(<<~RBS)
          # !!! GENERATED CODE !!!
          # Please see generators/rails-generator

          class Delegator
          end
          class SimpleDelegator < Delegator
          end
        RBS
      end

      desc "validate version=#{version} gem=active_model"
      task :validate do
        stdlib_opt = stdlib_dependencies.map{"-r #{_1}"}.join(" ")
        gem_opt = gem_dependencies.map{"-I ../../.gem_rbs_collection/#{_1}"}.join(" ")
        rails_opt = rails_dependencies.map{"-I export/#{_1}/#{version}"}.join(" ")
        sh "rbs #{stdlib_opt} #{gem_opt} #{rails_opt} -I #{export} validate --silent"
      end

      desc "install to ../../../gems/activemodel/#{version}"
      task :install do
        install_to = File.expand_path("../../../gems/activemodel/#{version}", __dir__)
        sh "rm -fr #{install_to}"
        sh "cp -a #{export} #{install_to}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
orthoses-rails-0.6.0 examples/rails/tasks/active_model.rake
orthoses-rails-0.5.0 examples/rails/tasks/active_model.rake