Class: Matrixeval::Ruby::Target

Inherits:
Target
  • Object
show all
Defined in:
lib/matrixeval/ruby/target.rb

Instance Method Summary collapse

Instance Method Details

#cli_example_linesObject



59
60
61
62
63
64
65
66
67
68
# File 'lib/matrixeval/ruby/target.rb', line 59

def cli_example_lines
  [
    "",
    "Example:",
    "    matrixeval --all bundle install",
    "    matrixeval --ruby 3.0 rspec a_spec.rb",
    "    matrixeval --ruby 3.1 --active_model 7.0 rake test",
    "    matrixeval bash"
  ]
end

#create_filesObject



70
71
72
73
74
75
76
77
# File 'lib/matrixeval/ruby/target.rb', line 70

def create_files
  gemfile_lock_folder = Matrixeval.working_dir.join(".matrixeval/gemfile_locks")
  FileUtils.mkdir_p gemfile_lock_folder

  Context.all.each do |context|
    FileUtils.touch gemfile_lock_folder.join(context.id)
  end
end

#env(context) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/matrixeval/ruby/target.rb', line 17

def env(context)
  {
    "BUNDLE_PATH" => "/bundle",
    "GEM_HOME" => "/bundle",
    "BUNDLE_APP_CONFIG" => "/bundle",
    "BUNDLE_BIN" => "/bundle/bin",
    "PATH" => "/app/bin:/bundle/bin:$PATH"
  }
end

#gitignore_pathsObject



46
47
48
49
50
# File 'lib/matrixeval/ruby/target.rb', line 46

def gitignore_paths
  [
    ".matrixeval/gemfile_locks"
  ]
end

#matrixeval_yml_template_pathObject



9
10
11
# File 'lib/matrixeval/ruby/target.rb', line 9

def matrixeval_yml_template_path
  Matrixeval::Ruby.root.join("lib/matrixeval/ruby/templates/matrixeval.yml")
end

#mounts(context) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/matrixeval/ruby/target.rb', line 27

def mounts(context)
  bundle_volume = bundle_volume(context)

  [
    "#{bundle_volume}:/bundle",
    "../gemfile_locks/#{context.id}:/app/Gemfile.lock"
  ]
end

#support_commandsObject



52
53
54
55
56
57
# File 'lib/matrixeval/ruby/target.rb', line 52

def support_commands
  [
    'ruby', 'rake', 'rails', 'rspec', 'bundle',
    'bin/rake', 'bin/rails', 'bin/rspec', 'bin/test'
  ]
end

#vector_keyObject



13
14
15
# File 'lib/matrixeval/ruby/target.rb', line 13

def vector_key
  "ruby"
end

#versionObject



5
6
7
# File 'lib/matrixeval/ruby/target.rb', line 5

def version
  Matrixeval::Ruby::VERSION
end

#volumes(context) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/matrixeval/ruby/target.rb', line 36

def volumes(context)
  bundle_volume = bundle_volume(context)

  {
    bundle_volume => {
      "name" => bundle_volume
    }
  }
end