Class: Versioneer::Helpers

Inherits:
Object
  • Object
show all
Defined in:
lib/versioneer/helpers.rb

Class Method Summary collapse

Class Method Details

.cl_no_stderrObject



34
35
36
37
38
39
# File 'lib/versioneer/helpers.rb', line 34

def cl_no_stderr
  {
      unix: '2>/dev/null',
      windows: '2>nul'
  }.fetch(platform)
end

.cl_no_stdoutObject



27
28
29
30
31
32
# File 'lib/versioneer/helpers.rb', line 27

def cl_no_stdout
  {
      unix: '>/dev/null',
      windows: '>nul'
  }.fetch(platform)
end

.cl_silenceObject



41
42
43
44
45
46
# File 'lib/versioneer/helpers.rb', line 41

def cl_silence
  {
      unix: '>/dev/null 2>&1',
      windows: '>nul 2>&1'
  }.fetch(platform)
end

.lines?(input) ⇒ Boolean

Generic

Returns:

  • (Boolean)


7
8
9
# File 'lib/versioneer/helpers.rb', line 7

def lines?(input)
  num_of_lines(input) > 0
end

.num_of_lines(input) ⇒ Object



11
12
13
14
# File 'lib/versioneer/helpers.rb', line 11

def num_of_lines(input)
  return 0 unless input.is_a? String and not input.empty?
  input.chomp.split("\n").size
end

.platformObject



22
23
24
25
# File 'lib/versioneer/helpers.rb', line 22

def platform
  return :windows if windows?
  :unix
end

.windows?Boolean

Platform Specific

Returns:

  • (Boolean)


18
19
20
# File 'lib/versioneer/helpers.rb', line 18

def windows?
  Gem.respond_to? :win_platform? and Gem.send(:win_platform?)
end