cocoapods-checksui 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8995d3d8b102dd7fd6d1d5f3ef17adb1dfbf34e5
4
+ data.tar.gz: e1095e125ddb26b2ee224c632fb8ed8017893ea0
5
+ SHA512:
6
+ metadata.gz: e94db42364f849d157a7b87c1f735b8a36f15f5797411dfa15ca673a9b301a0c303b27ec32eb1fbff11b4fef108ef0b2b2d556470d542f68ceeef8188f0f9d05
7
+ data.tar.gz: dc104553aa4a0f603adc4276406f18877754ff0c27447b1477d8133812df0904689778cc363ed79370db560fbc239a0fa646a1aa6abde1bf50db0226373aa7d8
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ .idea
4
+ .DS_Store
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-checksui.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 田杰
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,40 @@
1
+ # cocoapods-checksui
2
+
3
+ ## Thanks for [square/cocoapods-check](https://github.com/square/cocoapods-check).
4
+
5
+ cocoapods-checksui displays the differences between locked and remote Pods. It can save time by quickly showing whether it's necessary to run `pod install`. And check commit or tag after run `pod install`.
6
+
7
+ ## Installation
8
+
9
+ $ gem install cocoapods-checksui
10
+
11
+ ## Usage
12
+
13
+ `pod check-sui` will display a list of Pods that will be installed by running `pod install`:
14
+
15
+ $ pod check-sui
16
+ ~KNCardComponent, ~KNCommunity
17
+ [!] `pod install` will install 2 Pods.
18
+
19
+ The symbol before each Pod name indicates the status of the Pod. A `~` indicates a version of a Pod exists locally, but the version specified in `Podfile.lock` is different. Pods that don't require an update will not be listed.
20
+
21
+ Verbose mode shows a bit more detail:
22
+
23
+ $ pod check-sui --verbose
24
+ KNCardComponent locked_commit: a38a24db9660c8d48377c00e508492fc2d36162a -> remote_commit: 08006d30dc2c05215d0a9e1c383a35fbd6235425
25
+ KNCommunity locked_commit: 095d3a2db1bbb0dcc653729c493e7e6cac7209c6 -> remote_commit: 3eb7a3572c54b3be82c4f80ecab7a4680c7811f4
26
+ [!] `pod install` will install 2 Pods.
27
+
28
+ If no Pods are out of date, then the output looks like:
29
+
30
+ $ pod check-sui
31
+ The Podfile's dependencies are satisfied
32
+
33
+ ## Exit Code
34
+
35
+ If any Pods are out of date, `pod check-sui` will exit with a non-zero exit code. Otherwise it will exit with an exit code of zero.
36
+
37
+ ## License
38
+
39
+ cocoapods-checksui is under the MIT license. See the [LICENSE](LICENSE) file for details.
40
+
@@ -0,0 +1,11 @@
1
+ A checklist for releasing the Gem:
2
+
3
+ * Test: `rake`
4
+ * Bump version in lib/cocoapod_check_sui.rb
5
+ * Commit
6
+ * `git tag x.y.z`
7
+ * `git push`
8
+ * `git push --tags`
9
+ * `gem build cocoapods-checksui.gemspec`
10
+ * `gem push cocoapods-checksui-x.y.z.gem`
11
+ * Create release on GitHub from tag
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods_check_sui.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-checksui'
8
+ spec.version = CocoapodsCheckSui::VERSION
9
+ spec.authors = ['htxs']
10
+ spec.email = ['gzucm_tianjie@foxmail.com']
11
+
12
+ spec.summary = %q{'checksui' plugin for CocoaPods}
13
+ spec.description = spec.summary
14
+ spec.homepage = "https://github.com/htxs/cocoapods-checksui"
15
+
16
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.0'
21
+ spec.add_development_dependency "rake", '~> 10.0'
22
+ spec.add_development_dependency "rspec"
23
+
24
+ spec.add_dependency 'cocoapods', '~> 1.0'
25
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsCheckSui
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1 @@
1
+ require 'pod/command/checksui'
@@ -0,0 +1,119 @@
1
+ # The CocoaPods check-sui command.
2
+
3
+ # The CocoaPods namespace
4
+ module Pod
5
+ class Command
6
+ class CheckSui < Command
7
+ self.summary = <<-SUMMARY
8
+ Displays which Pods would be changed by running `pod install`
9
+ SUMMARY
10
+
11
+ self.description = <<-DESC
12
+ Compares the Pod lockfile with the podfile and shows
13
+ any differences for commit or tag. In non-verbose mode,
14
+ '~' indicates an existing Pod will be updated to the version specified in Podfile.lock.
15
+ DESC
16
+
17
+ self.arguments = []
18
+
19
+ def self.options
20
+ [
21
+ ['--verbose', 'Show change details.']
22
+ ].concat(super)
23
+ end
24
+
25
+ def initialize(argv)
26
+ @check_command_verbose = argv.flag?('verbose')
27
+ super
28
+ end
29
+
30
+ def run
31
+ unless config.lockfile
32
+ raise Informative, 'Missing Podfile.lock!'
33
+ end
34
+
35
+ results = find_differences(config)
36
+ has_same_manifests = check_manifests(config)
37
+ print_results(results, has_same_manifests)
38
+ end
39
+
40
+ def check_manifests(config)
41
+ # Bail if the first time
42
+ return true unless config.sandbox.manifest
43
+
44
+ root_lockfile = config.lockfile.defined_in_file
45
+ pods_manifest = config.sandbox.manifest_path
46
+
47
+ File.read(root_lockfile) == File.read(pods_manifest)
48
+ end
49
+
50
+ def find_differences(config)
51
+ sui_pods = {}
52
+ config.podfile.dependencies.each do |dependency|
53
+ if dependency.external? &&
54
+ (dependency.external_source[:branch] != nil || dependency.external_source[:tag] != nil || dependency.external_source[:commit] != nil)
55
+ sui_pods[dependency.name] = dependency.external_source.clone
56
+ end
57
+ end
58
+ sui_pod_names = sui_pods.keys
59
+
60
+ sui_pod_names.sort.uniq.map do |spec_name|
61
+ locked_checkout = config.lockfile.checkout_options_for_pod_named(spec_name)
62
+ next if locked_checkout.nil?
63
+
64
+ locked_checkout_commit = locked_checkout[:commit]
65
+ locked_checkout_tag = locked_checkout[:tag]
66
+ development_tag = sui_pods[spec_name][:tag]
67
+ development_commit = sui_pods[spec_name][:commit]
68
+
69
+ if development_tag != nil && locked_checkout_tag != nil && development_tag != locked_checkout_tag
70
+ # check tag
71
+ changed_result(spec_name, "locked_tag: #{locked_checkout_tag}", "development_tag: #{development_tag}")
72
+ elsif development_commit != nil && locked_checkout_commit != nil && development_commit != locked_checkout_commit
73
+ # check local commit
74
+ changed_result(spec_name, "locked_commit: #{locked_checkout_commit}", "development_commit: #{development_commit}")
75
+ elsif locked_checkout_commit != nil
76
+ # check remote commit
77
+ remote_commit = get_latest_remote_commit(sui_pods[spec_name])
78
+ if remote_commit != locked_checkout_commit
79
+ changed_result(spec_name, "locked_commit: #{locked_checkout_commit}", "remote_commit: #{remote_commit}")
80
+ end
81
+ end
82
+ end.compact
83
+ end
84
+
85
+ def get_latest_remote_commit(external_source)
86
+ if @check_command_verbose
87
+ UI.puts "Fetch remote commit for #{external_source[:git]} on branch: #{external_source[:branch]}"
88
+ end
89
+
90
+ command = "git ls-remote #{external_source[:git]} #{external_source[:branch]} | awk '{print$1}'"
91
+ return (`#{command}` || '').strip
92
+ end
93
+
94
+ def changed_result(spec_name, manifest_version, locked_version)
95
+ if @check_command_verbose
96
+ "#{spec_name} #{manifest_version} -> #{locked_version}"
97
+ else
98
+ "~#{spec_name}"
99
+ end
100
+ end
101
+
102
+ def print_results(results, same_manifests)
103
+ return UI.puts "The Podfile's dependencies are satisfied" if results.empty? && same_manifests
104
+
105
+ unless same_manifests
106
+ raise Informative, 'The Podfile.lock does not match the Pods/Manifest.lock.'
107
+ end
108
+
109
+ if @check_command_verbose
110
+ UI.puts results.join("\n")
111
+ else
112
+ UI.puts results.join(', ')
113
+ end
114
+
115
+ raise Informative, "`pod install` will install #{results.length} Pod#{'s' if results.length > 1}."
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,8 @@
1
+ require 'cocoapods'
2
+ require 'tempfile'
3
+
4
+ require_relative '../lib/pod/command/checksui'
5
+
6
+ describe Pod::Command::CheckSui do
7
+ # pass
8
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-checksui
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - htxs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-10-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cocoapods
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: "'checksui' plugin for CocoaPods"
70
+ email:
71
+ - gzucm_tianjie@foxmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rakeTasks"
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - RELEASING.md
82
+ - Rakefile
83
+ - cocoapods-checksui.gemspec
84
+ - lib/cocoapods_check_sui.rb
85
+ - lib/cocoapods_plugin.rb
86
+ - lib/pod/command/checksui.rb
87
+ - spec/checksui_spec.rb
88
+ homepage: https://github.com/htxs/cocoapods-checksui
89
+ licenses: []
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.5.2.3
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: "'checksui' plugin for CocoaPods"
111
+ test_files:
112
+ - spec/checksui_spec.rb