cocoapods-sync-podspecs 0.1.8 → 0.2.3

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
  SHA256:
3
- metadata.gz: ae877a1d3ef35b5d178b455a22b872b0f5c839b3d45f2656c0ed427d7f0b7240
4
- data.tar.gz: 0226fd6c81608a45fe4afc7761819e0061e7be7f7d77daea91b7a998c941aa19
3
+ metadata.gz: 148f916d6953be84369f617a1374967dd88df17cd2974bbaf426cbcc49a45493
4
+ data.tar.gz: c29cba13bae55991fe02e9546f8d0a35bd682c2ba129d3792052a0ee0be9fdb9
5
5
  SHA512:
6
- metadata.gz: bdc83403e0034b61a89c9c2c45d123c5f96239ba8f7e81ae7d207fafede0aa2ae7ccbfc813ea113c50d3070042aa0b16fcf799c82e3adb315593902b640460ce
7
- data.tar.gz: 0e9ab8479df3b55e7b45c97e11ce076cdee301b244361b8d7038a4aa6bad46c0890548643f70a080a7a6cb3ca66fa05ec2240c58f3e980a5be457da843ebb637
6
+ metadata.gz: 022e140345753ad8ebaa9fe3a95654aa669b6ce39a5932740d9a020c71f96b77b92bce05c98d68020ac82810d81a6a8178fd60314529e1bcccd6f96460a8379f
7
+ data.tar.gz: 6bcf88f9265d7e9e1452c5f9c30107174fd613da45c5e5a2f04bb9069eb2e2b10c22b03270ff192b9d0fdab837337666361e019b99062eebb46fea659bdf4bdc
@@ -48,10 +48,11 @@ module Pod
48
48
  end
49
49
 
50
50
  def modify_podspec(path, version)
51
- unless version =~ /^\d{1,}.\d.\d$|^\d{1,}.\d$|^\d{1,}$/
52
- UI.puts "s.version: not found"
51
+ unless version =~ /^(\d+\.)?(\d+\.)?(\*|\d+)$/
52
+ UI.puts "Invalid version #{version}"
53
53
  return
54
54
  end
55
+
55
56
  unless File.exist?path
56
57
  UI.puts "Podspec file not found"
57
58
  return
@@ -60,13 +61,8 @@ module Pod
60
61
  File.open(path, "r+") do |f|
61
62
  s = ""
62
63
  f.each_line do |line|
63
- if line.to_s =~ /s\.version\s*=\s*"(\d{1,}.\d.\d|\d{1,}.\d|\d{1,})"/
64
- line = line.sub(/\d{1,}.\d.\d|\d{1,}.\d|\d{1,}/) do |match|
65
- version.to_s
66
- end
67
- end
68
- if line.to_s =~ /s\.version\s*=\s*'(\d{1,}.\d.\d|\d{1,}.\d|\d{1,})'/
69
- line = line.sub(/\d{1,}.\d.\d|\d{1,}.\d|\d{1,}/) do |match|
64
+ if line.to_s =~ /s\.version\s*=\s*'|"(\d+\.)?(\d+\.)?(\*|\d+)'|"/
65
+ line = line.sub(/(\d+\.)?(\d+\.)?(\*|\d+)/) do |match|
70
66
  version.to_s
71
67
  end
72
68
  end
@@ -74,7 +70,6 @@ module Pod
74
70
  end
75
71
  File.open(path, "w+") do |f| f.write(s) end
76
72
  end
77
-
78
73
  end
79
74
 
80
75
  # @return [Array<Pathname>] The path of the specifications to push.
@@ -15,16 +15,18 @@ module Pod
15
15
 
16
16
  def self.options
17
17
  [
18
- ['--local-only', 'Does not perform the step of pushing REPO to its remote'],
19
- ['--ignore-exists', 'Ignore exists tag'],
20
- ['--force-tag', 'Force create new tag'],
18
+ ['--commit-local', 'Make commit for bump version'],
19
+ ['--push-remote', 'Perform the step of pushing REPO to its remote'],
20
+ ['--continue-if-exists', 'Continues running when tag is existed'],
21
+ ['--tag-on-change', 'Just push tag when podspec is changed'],
21
22
  ].concat(super)
22
23
  end
23
24
 
24
25
  def initialize(argv)
25
- @force_tag = argv.flag?('force-tag')
26
- @ignore_exists = argv.flag?('ignore-exists')
27
- @local_only = argv.flag?('local-only')
26
+ @commit_local = argv.flag?('commit-local', false)
27
+ @tag_on_change = argv.flag?('tag-on-change', false)
28
+ @continue_if_exists = argv.flag?('continue-if-exists', false)
29
+ @push_remote = argv.flag?('push-remote', false)
28
30
  @tag_version = argv.shift_argument
29
31
  @current_repo_dir = ''
30
32
  super
@@ -41,17 +43,23 @@ module Pod
41
43
  end
42
44
 
43
45
  def run
46
+ processedPaths = Array.new
47
+
44
48
  podspec_files.each do |spec_file|
45
49
  spec = Pod::Specification.from_file(spec_file)
46
50
 
47
51
  @tag_version = spec.version.to_s unless !@tag_version.nil?
48
52
  @current_repo_dir = Pathname(spec_file).dirname
49
53
 
54
+ next if processedPaths.include?(@current_repo_dir)
55
+
56
+ processedPaths.push(@current_repo_dir)
57
+
50
58
  # check_repo_status(spec.name, Pathname(spec_file).dirname)
51
59
  # update_repo(spec.name, Pathname(spec_file).dirname)
52
60
 
53
61
  exists_tag = pod_repo_git('tag').include?(@tag_version)
54
- if exists_tag && !@ignore_exists
62
+ if exists_tag && !@continue_if_exists
55
63
  raise Informative, "#{spec.name}: tag #{@tag_version} already exists"
56
64
  end
57
65
 
@@ -67,15 +75,15 @@ module Pod
67
75
 
68
76
  # only commit if modified
69
77
  if pod_repo_git('status', '--porcelain').include?(podspec_name)
70
- pod_repo_git('add', '*.podspec')
71
- pod_repo_git('commit', '--no-verify', '-m', message)
72
- push_pod_repo(name) unless @local_only
78
+ pod_repo_git('add', '*.podspec') unless !@commit_local
79
+ pod_repo_git('commit', '--no-verify', '-m', message) unless !@commit_local
80
+ push_pod_repo(name) unless !@push_remote
73
81
 
74
82
  pod_repo_git('tag', '-a', @tag_version, '-m', message)
75
83
  push_tag_repo
76
- elsif @force_tag
77
- check_repo_status(spec.name, @current_repo_dir)
78
- update_repo(spec.name, @current_repo_dir)
84
+ elsif !@tag_on_change
85
+ check_repo_status(name, @current_repo_dir)
86
+ update_repo(name, @current_repo_dir)
79
87
 
80
88
  pod_repo_git('tag', '-a', @tag_version, '-m', message)
81
89
  push_tag_repo
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-sync-podspecs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - quangmv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-05 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods