thor-scmversion 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -55,6 +55,8 @@ Usage Examples:
55
55
  $ thor version:current
56
56
  1.2.1
57
57
  $ thor version:bump auto
58
+ 1.2.1+build.1
59
+ $ thor version:bump patch
58
60
  1.2.2
59
61
  $ thor version:bump major
60
62
  2.0.0
@@ -1,10 +1,4 @@
1
1
  module ThorSCMVersion
2
- class << self
3
- def windows?
4
- RbConfig::CONFIG["arch"] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
5
- end
6
- end
7
-
8
2
  class MissingP4ConfigException < StandardError
9
3
  def initialize(config_option)
10
4
  @config_option = config_option
@@ -71,13 +65,11 @@ module ThorSCMVersion
71
65
  end
72
66
 
73
67
  def depot_path(path)
74
- path = File.expand_path(path)
75
- path = path.gsub(File::Separator, File::ALT_SEPARATOR) if ThorSCMVersion.windows?
76
- `p4 where "#{path}/..."`.split(" ").first.gsub("/...", "")
68
+ `p4 dirs #{File.expand_path(path)}`.chomp
77
69
  end
78
70
 
79
71
  def module_name(path)
80
- depot_path(path).gsub("//", "").gsub("/", "-")
72
+ File.expand_path(path).split("/").last
81
73
  end
82
74
 
83
75
  def parse_label(label, p4_module_name)
@@ -105,10 +97,10 @@ module ThorSCMVersion
105
97
  end
106
98
 
107
99
  def tag
108
- if ThorSCMVersion.windows?
109
- `type "#{File.expand_path(get_p4_label_file).gsub(File::Separator, File::ALT_SEPARATOR)}" | p4 label -i`
100
+ if windows?
101
+ `type #{File.expand_path(get_p4_label_file).gsub(File::Separator, File::ALT_SEPARATOR)} | p4 label -i`
110
102
  else
111
- `cat "#{File.expand_path(get_p4_label_file)}" | p4 label -i`
103
+ `cat #{File.expand_path(get_p4_label_file)} | p4 label -i`
112
104
  end
113
105
  end
114
106
 
@@ -151,5 +143,9 @@ View:
151
143
  file
152
144
  end
153
145
  end
146
+
147
+ def windows?
148
+ RbConfig::CONFIG["arch"] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
149
+ end
154
150
  end
155
- end
151
+ end
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.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-10-25 00:00:00.000000000 Z
14
+ date: 2013-01-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 1.8.21
199
+ rubygems_version: 1.8.23
200
200
  signing_key:
201
201
  specification_version: 3
202
202
  summary: A small set of Thor tasks you can include in your build scripts to manage