Top Level Namespace

Defined Under Namespace

Modules: InlineFormsInstaller Classes: ExampleAppApartmentFieldTurboTest, ExampleAppApartmentNameListTest, ExampleAppApartmentNameRequiredTest, ExampleAppApartmentNameValidationTest, ExampleAppApartmentOpeningDateTest, ExampleAppApartmentPhotoTest, ExampleAppApartmentPhotosPaginationTest, ExampleAppApartmentRowTurboTest, ExampleAppApartmentTopLevelNewTest, ExampleAppApartmentTopLevelPaginationTest, ExampleAppApartmentVersionsTurboTest, ExampleAppGuestAccessTest, ExampleAppIntegrationTestCase, ExampleAppOwnerTabsTest, ExampleAppPaperTrailChangesetTest, ExampleAppPhotoRevertTest, ExampleAppPhotosTest, ExampleAppPlainTextRichTextEdgeCasesTest, ExampleAppRoutingTest, ExampleAppTurboLayoutTest, ExampleAppValidationHintsTest

Constant Summary collapse

INSTALLER_ROOT =
File.expand_path(ENV.fetch("INLINE_FORMS_INSTALLER_ROOT", File.expand_path("..", __dir__)))
INLINE_FORMS_ROOT =
File.expand_path(ENV.fetch("INLINE_FORMS_ROOT", INSTALLER_ROOT))

Instance Method Summary collapse

Instance Method Details

#bundle_install!Object



24
25
26
27
28
29
30
31
32
# File 'lib/inline_forms_installer/installer_core.rb', line 24

def bundle_install!
  say "- Running bundle install..."
  unless system("bundle", "install")
    abort "ERROR: bundle install failed in #{Dir.pwd}. From the app directory run: rvm use . && bundle install"
  end
  unless system("bundle", "check")
    abort "ERROR: bundle check failed (gems missing). From the app directory run: rvm use . && bundle install"
  end
end

#install_prerelease_gems_from_roots!Object

Pre-install built .gem files into the app RVM gemset so Bundler can resolve inline_forms ~> 8 before those releases exist on RubyGems. Set INLINE_FORMS_RELEASE_ROOT and/or VALIDATION_HINTS_ROOT (creator sets the latter when a sibling validation_hints checkout exists).



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/inline_forms_installer/installer_core.rb', line 38

def install_prerelease_gems_from_roots!
  roots = []
  %w[INLINE_FORMS_RELEASE_ROOT VALIDATION_HINTS_ROOT].each do |key|
    root = ENV[key].to_s
    roots << File.expand_path(root) if root != "" && File.directory?(root)
  end
  roots.uniq!
  return if roots.empty?

  %w[validation_hints inline_forms inline_forms_installer].each do |name|
    gem_file = roots.filter_map { |root|
      files = Dir[File.join(root, "#{name}-*.gem")]
      files.sort.last if files.any?
    }.max
    next unless gem_file && File.file?(gem_file)

    say "- Installing #{File.basename(gem_file)} into app gemset..."
    run "gem install #{Shellwords.escape(gem_file)} --no-document"
  end
end

#use_app_rvm_gemset!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/inline_forms_installer/installer_core.rb', line 7

def use_app_rvm_gemset!
  return if ENV["skiprvm"] == "true"
  return unless (gemset = ENV["inline_forms_rvm_gemset"]).to_s != ""

  begin
    require "rvm"
  rescue LoadError
    say "rvm gem not available; skipping gemset switch", :yellow
    return
  end
  return unless RVM.current

  say "Working directory is #{Dir.pwd}", :green
  RVM.use_from_path! "."
  say "Installing using gemset: #{RVM.current.environment_name}", :green
end