cocoapods-tdfire-binary 1.3.18 → 1.4.18

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: 01ae497860497383cab9c30506a52bcf09f255d0
4
- data.tar.gz: fd5a3e7cd1f728d50e4e2c286c3062c801ec170f
3
+ metadata.gz: 19f2b9d05cd7cb696ee696deca9a319f1c1cf34e
4
+ data.tar.gz: a76a561795cb3d78c06377f4f3bda4066de13583
5
5
  SHA512:
6
- metadata.gz: 7b3dcb7f79f1103358b875a775192f344fd529a555c0ee697fead1c2c61292e0ee6524c6b3b498a94337ca3b85ab0adaea0958946a7e2ace7feba317c1d3def4
7
- data.tar.gz: d5f12c1d5ceda92d92cdffabdcc6f88b8a6be010a67171425e61cdc679ef7a5fe909e548588c13f5976afcd448d5856741415c92745babe0441617e4539690f4
6
+ metadata.gz: 70e622dfabfc7ff55a27b383e14e32b1bf6800ab48c35ea8c3fa7e124901c1fabb5737ba4cd4d9e65f0b1e3d06803d5b74a72e5a8a9faee0cee3b33ca70274f2
7
+ data.tar.gz: 06a0e277d36dadce66baf6e4d47adc4e0584dfd142866ebc0aae1f251522ff1b4d8f2ed86406402c60fdddae2b37a2803ec985fa3d967ee923905d96515640c9
@@ -1,5 +1,6 @@
1
1
  require 'cocoapods-tdfire-binary/command/lib/create'
2
2
  require 'cocoapods-tdfire-binary/command/lib/import'
3
+ require 'cocoapods-tdfire-binary/command/lib/upgrade'
3
4
 
4
5
  module Pod
5
6
  class Command
@@ -0,0 +1,86 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-tdfire-binary/binary_url_manager'
3
+
4
+ module Pod
5
+ class Command
6
+ class Binary < Command
7
+ class Lib < Binary
8
+ class Upgrade < Lib
9
+ self.abstract_command = false
10
+ self.summary = '更新 podspec 版本'
11
+ self.description = <<-DESC
12
+ 更新 podspec 版本
13
+ DESC
14
+
15
+ def self.options
16
+ [
17
+ ['--type', '更新版本类型,patch/minor/major'],
18
+ ['--version', '更新版本号,优先级比 --type 高'],
19
+ ['--commit', '提交 commit 日志,没有设置则不 add']
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @type = argv.option('type') || 'patch'
25
+ @version = argv.option('version')
26
+ @commit = argv.option('commit')
27
+ @spec_file = first_podspec
28
+ super
29
+ end
30
+
31
+ def validate!
32
+ super
33
+ help! '当前目录下没有podspec文件.' if @spec_file.nil?
34
+ end
35
+
36
+ def run
37
+ path = Pathname.new(@spec_file)
38
+ spec = Pod::Specification.from_file(path)
39
+ version = unit_increase_version(spec.version, @type)
40
+ version = @version if @version
41
+
42
+ UI.section("Tdfire: upgrade podspec version to #{version} ...") do
43
+ spec_string = File.read(Pathname.new(@spec_file))
44
+ spec_content = update_podspec_content(spec_string, version)
45
+ File.open(path, "w") do |io|
46
+ io << spec_content
47
+ end
48
+
49
+ if @commit
50
+ `git add #{path}`
51
+ `git commit -m "#{@commit}"`
52
+ end
53
+ end
54
+ end
55
+
56
+ def update_podspec_content(podspec_content, version)
57
+ require_variable_prefix = true
58
+ version_var_name = 'version'
59
+ variable_prefix = require_variable_prefix ? /\w\./ : //
60
+ version_regex = /^(?<begin>[^#]*#{variable_prefix}#{version_var_name}\s*=\s*['"])(?<value>(?<major>[0-9]+)(\.(?<minor>[0-9]+))?(\.(?<patch>[0-9]+))?(?<appendix>(\.[0-9]+)*)?(-(?<prerelease>(.+)))?)(?<end>['"])/i
61
+
62
+ version_match = version_regex.match(podspec_content)
63
+ updated_podspec_content = podspec_content.gsub(version_regex, "#{version_match[:begin]}#{version}#{version_match[:end]}")
64
+ updated_podspec_content
65
+ end
66
+
67
+ def unit_increase_version(version, type)
68
+ major = version.major
69
+ minor = version.minor
70
+ patch = version.patch
71
+ case type
72
+ when 'major'
73
+ major += 1
74
+ when 'minor'
75
+ minor += 1
76
+ when 'patch'
77
+ patch += 1
78
+ else
79
+ end
80
+ Pod::Version.new("#{major}.#{minor}.#{patch}")
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsTdfireBinary
2
- VERSION = "1.3.18"
2
+ VERSION = "1.4.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-tdfire-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.18
4
+ version: 1.4.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-15 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -129,6 +129,7 @@ files:
129
129
  - lib/cocoapods-tdfire-binary/command/lib.rb
130
130
  - lib/cocoapods-tdfire-binary/command/lib/create.rb
131
131
  - lib/cocoapods-tdfire-binary/command/lib/import.rb
132
+ - lib/cocoapods-tdfire-binary/command/lib/upgrade.rb
132
133
  - lib/cocoapods-tdfire-binary/command/lint.rb
133
134
  - lib/cocoapods-tdfire-binary/command/list.rb
134
135
  - lib/cocoapods-tdfire-binary/command/package.rb