summaryrefslogtreecommitdiff
path: root/spec/support/platforms.rb
blob: e17573855afccf20589caeebdfaf4f1f78f067b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module Spec
  module Platforms
    def rb
      Gem::Platform::RUBY
    end

    def mac
      Gem::Platform.new('x86-darwin-10')
    end

    def java
      Gem::Platform.new([nil, "java", nil])
    end

    def linux
      Gem::Platform.new(['x86', 'linux', nil])
    end

    def mswin
      Gem::Platform.new(['x86', 'mswin32', nil])
    end

    def all_platforms
      [rb, java, linux, mswin]
    end

    def not_local
      all_platforms.reject { |p| p == Gem::Platform.local }
    end

    def local_tag
      if RUBY_PLATFORM == "java"
        :jruby
      elsif RUBY_VERSION >= "1.9"
        :ruby_19
      else
        :ruby_18
      end
    end

    def not_local_tag
      [:ruby_18, :ruby_19, :jruby].find { |tag| tag != local_tag }
    end
  end
end