thor-scmversion 1.4.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c086a835e56747f0bda71f360fb49e0fc2189512
4
- data.tar.gz: 2f82d25b031619974b0943a25b8c4f03c1008874
3
+ metadata.gz: f417c73aba03caf6ddd77d9aad69be00262d4333
4
+ data.tar.gz: 5dcaf8daa59935a309364bde48b286f277f0963a
5
5
  SHA512:
6
- metadata.gz: a0ca30ca6c7aacf32f3d4da22bfc22723600cec7b96599b6a67b1424369b4d273dbf811512c4f75558d969dfb5e303835983a785c127074d10a19f5f45fd002a
7
- data.tar.gz: f14750060d9e4291696701f2918dce167d91dd6f326abe6e4d4903391c995066687a5286214e0e02da96aa97f8756a3df41beeac7268ee065d738f6521a52d66
6
+ metadata.gz: 3a72c4932c53806e275e3827e9a05b49a341000b75ad29dbca40abcdb0bb63575b4087233b11bade943a5e80f3bc9e9554875c8198ea1119c50d87a092a87b4c
7
+ data.tar.gz: 58cc46b5c5607fd379b48577eb08659ef2690cd633089d90cd6226b8cd0e0b4172a2e9cf7fe4f17af6d1ce58c47b347a2d64056c1500ced5e4042645e77062fc
@@ -5,12 +5,24 @@ module ThorSCMVersion
5
5
  #
6
6
  # @return [#kind_of? ScmVersion]
7
7
  def versioner
8
- if(File.exist? (".git"))
8
+ if is_git?
9
9
  return GitVersion
10
10
  else
11
11
  return P4Version
12
12
  end
13
13
  end
14
+
15
+ def is_git?
16
+ file_exists?(Dir.pwd, '.git')
17
+ end
18
+
19
+ def file_exists?(current_dir, file)
20
+ return true if File.exist?(file)
21
+ Dir.chdir('..') do
22
+ return false if Dir.pwd == current_dir
23
+ file_exists?(current_dir, file)
24
+ end
25
+ end
14
26
  end
15
27
 
16
28
  # author Josiah Kiehl <josiah@skirmisher.net>
@@ -1,35 +1,26 @@
1
+ require 'mixlib/shellout'
2
+
1
3
  module ThorSCMVersion
2
4
  class ShellUtils
3
5
  class << self
4
6
  def secure_password
5
7
  password = String.new
6
-
8
+
7
9
  while password.length < 20
8
10
  password << ::OpenSSL::Random.random_bytes(1).gsub(/\W/, '')
9
11
  end
10
12
  password
11
13
  end
12
-
14
+
13
15
  def sh(cmd, dir = '.', &block)
14
16
  out, code = sh_with_excode(cmd, dir, &block)
15
17
  code == 0 ? out : raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
16
18
  end
17
-
18
- def sh_with_excode(cmd, dir = '.', &block)
19
- cmd << " 2>&1"
20
- output = ""
21
- status = nil
22
- Dir.chdir(dir) {
23
- stdin, stdout, stderr, wait_thr = Open3::popen3(cmd)
24
-
25
- status = wait_thr.value
26
- output = stdout.readlines.join
27
19
 
28
- if status.to_i == 0
29
- block.call(output) if block
30
- end
31
- }
32
- [ output, status ]
20
+ def sh_with_excode(cmd, dir = '.', &block)
21
+ command = Mixlib::ShellOut.new(cmd << " 2>&1", :cwd => dir)
22
+ command.run_command
23
+ [command.stdout, command.exitstatus]
33
24
  end
34
25
  end
35
26
  end
@@ -15,7 +15,9 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = ThorSCMVersion::VERSION
17
17
 
18
- gem.add_dependency 'thor'
18
+ gem.add_dependency 'thor'
19
+ gem.add_dependency 'mixlib-shellout'
20
+
19
21
  gem.add_development_dependency 'webmock'
20
22
  gem.add_development_dependency 'geminabox'
21
23
  gem.add_development_dependency 'spork'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thor-scmversion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Ivey
@@ -10,132 +10,146 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-08 00:00:00.000000000 Z
13
+ date: 2014-05-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: mixlib-shellout
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
27
41
  - !ruby/object:Gem::Version
28
42
  version: '0'
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: webmock
31
45
  requirement: !ruby/object:Gem::Requirement
32
46
  requirements:
33
- - - '>='
47
+ - - ">="
34
48
  - !ruby/object:Gem::Version
35
49
  version: '0'
36
50
  type: :development
37
51
  prerelease: false
38
52
  version_requirements: !ruby/object:Gem::Requirement
39
53
  requirements:
40
- - - '>='
54
+ - - ">="
41
55
  - !ruby/object:Gem::Version
42
56
  version: '0'
43
57
  - !ruby/object:Gem::Dependency
44
58
  name: geminabox
45
59
  requirement: !ruby/object:Gem::Requirement
46
60
  requirements:
47
- - - '>='
61
+ - - ">="
48
62
  - !ruby/object:Gem::Version
49
63
  version: '0'
50
64
  type: :development
51
65
  prerelease: false
52
66
  version_requirements: !ruby/object:Gem::Requirement
53
67
  requirements:
54
- - - '>='
68
+ - - ">="
55
69
  - !ruby/object:Gem::Version
56
70
  version: '0'
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: spork
59
73
  requirement: !ruby/object:Gem::Requirement
60
74
  requirements:
61
- - - '>='
75
+ - - ">="
62
76
  - !ruby/object:Gem::Version
63
77
  version: '0'
64
78
  type: :development
65
79
  prerelease: false
66
80
  version_requirements: !ruby/object:Gem::Requirement
67
81
  requirements:
68
- - - '>='
82
+ - - ">="
69
83
  - !ruby/object:Gem::Version
70
84
  version: '0'
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: simplecov
73
87
  requirement: !ruby/object:Gem::Requirement
74
88
  requirements:
75
- - - '>='
89
+ - - ">="
76
90
  - !ruby/object:Gem::Version
77
91
  version: '0'
78
92
  type: :development
79
93
  prerelease: false
80
94
  version_requirements: !ruby/object:Gem::Requirement
81
95
  requirements:
82
- - - '>='
96
+ - - ">="
83
97
  - !ruby/object:Gem::Version
84
98
  version: '0'
85
99
  - !ruby/object:Gem::Dependency
86
100
  name: vcr
87
101
  requirement: !ruby/object:Gem::Requirement
88
102
  requirements:
89
- - - '>='
103
+ - - ">="
90
104
  - !ruby/object:Gem::Version
91
105
  version: '0'
92
106
  type: :development
93
107
  prerelease: false
94
108
  version_requirements: !ruby/object:Gem::Requirement
95
109
  requirements:
96
- - - '>='
110
+ - - ">="
97
111
  - !ruby/object:Gem::Version
98
112
  version: '0'
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: aruba
101
115
  requirement: !ruby/object:Gem::Requirement
102
116
  requirements:
103
- - - '>='
117
+ - - ">="
104
118
  - !ruby/object:Gem::Version
105
119
  version: '0'
106
120
  type: :development
107
121
  prerelease: false
108
122
  version_requirements: !ruby/object:Gem::Requirement
109
123
  requirements:
110
- - - '>='
124
+ - - ">="
111
125
  - !ruby/object:Gem::Version
112
126
  version: '0'
113
127
  - !ruby/object:Gem::Dependency
114
128
  name: rspec
115
129
  requirement: !ruby/object:Gem::Requirement
116
130
  requirements:
117
- - - '>='
131
+ - - ">="
118
132
  - !ruby/object:Gem::Version
119
133
  version: '0'
120
134
  type: :development
121
135
  prerelease: false
122
136
  version_requirements: !ruby/object:Gem::Requirement
123
137
  requirements:
124
- - - '>='
138
+ - - ">="
125
139
  - !ruby/object:Gem::Version
126
140
  version: '0'
127
141
  - !ruby/object:Gem::Dependency
128
142
  name: debugger
129
143
  requirement: !ruby/object:Gem::Requirement
130
144
  requirements:
131
- - - '>='
145
+ - - ">="
132
146
  - !ruby/object:Gem::Version
133
147
  version: '0'
134
148
  type: :development
135
149
  prerelease: false
136
150
  version_requirements: !ruby/object:Gem::Requirement
137
151
  requirements:
138
- - - '>='
152
+ - - ">="
139
153
  - !ruby/object:Gem::Version
140
154
  version: '0'
141
155
  description: Thor tasks to manage a VERSION file based on SCM tags
@@ -148,7 +162,7 @@ executables:
148
162
  extensions: []
149
163
  extra_rdoc_files: []
150
164
  files:
151
- - .gitignore
165
+ - ".gitignore"
152
166
  - Gemfile
153
167
  - LICENSE
154
168
  - README.md
@@ -183,17 +197,17 @@ require_paths:
183
197
  - lib
184
198
  required_ruby_version: !ruby/object:Gem::Requirement
185
199
  requirements:
186
- - - '>='
200
+ - - ">="
187
201
  - !ruby/object:Gem::Version
188
202
  version: '0'
189
203
  required_rubygems_version: !ruby/object:Gem::Requirement
190
204
  requirements:
191
- - - '>='
205
+ - - ">="
192
206
  - !ruby/object:Gem::Version
193
207
  version: '0'
194
208
  requirements: []
195
209
  rubyforge_project:
196
- rubygems_version: 2.0.3
210
+ rubygems_version: 2.0.14
197
211
  signing_key:
198
212
  specification_version: 4
199
213
  summary: A small set of Thor tasks you can include in your build scripts to manage