Class: Versioneer::Helpers
- Inherits:
-
Object
- Object
- Versioneer::Helpers
- Defined in:
- lib/versioneer/helpers.rb
Class Method Summary collapse
- .cl_no_stderr ⇒ Object
- .cl_no_stdout ⇒ Object
- .cl_silence ⇒ Object
-
.lines?(input) ⇒ Boolean
Generic.
- .num_of_lines(input) ⇒ Object
- .platform ⇒ Object
-
.windows? ⇒ Boolean
Platform Specific.
Class Method Details
.cl_no_stderr ⇒ Object
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_stdout ⇒ Object
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_silence ⇒ Object
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
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 |
.platform ⇒ Object
22 23 24 25 |
# File 'lib/versioneer/helpers.rb', line 22 def platform return :windows if windows? :unix end |
.windows? ⇒ Boolean
Platform Specific
18 19 20 |
# File 'lib/versioneer/helpers.rb', line 18 def windows? Gem.respond_to? :win_platform? and Gem.send(:win_platform?) end |