cocoapods-backup 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3c8e8a2520d726075bedfd23e9059a1e204b99136beb907e73d66a452ca11410
4
+ data.tar.gz: b75a8de0364f881e6112c1473f0e482cfd4b456824edcf953b172b314dc84c00
5
+ SHA512:
6
+ metadata.gz: e9e6ad51d5f888bffa9820a144ed99ad96a197404a53c01de5a7d64cbd8a8037473849eb19f119fe740d4ba5055fb89f2202eb6a907720c318fdb236f122271b
7
+ data.tar.gz: 7d43f29d112a47860a21bd27392e444314cdcb8ab06ee9f8c9a2ae18b7278b1864e83ccf27665d3f2d7a766dba24cf15fd845138a6cc375709c6daeb05e25502
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-backup.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+
9
+ gem 'mocha'
10
+ gem 'bacon'
11
+ gem 'mocha-on-bacon'
12
+ gem 'prettybacon'
13
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2020 kingcos <2821836721v@gmail.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # cocoapods-backup
2
+
3
+ A description of cocoapods-backup.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-backup
8
+
9
+ ## Usage
10
+
11
+ $ pod spec backup POD_NAME
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
13
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-backup/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-backup'
8
+ spec.version = '0.0.1'
9
+ spec.authors = ['kingcos']
10
+ spec.email = ['2821836721v@gmail.com']
11
+ spec.description = %q{Using current sources for your pods.}
12
+ spec.summary = %q{Using current sources for your pods.}
13
+ spec.homepage = 'https://github.com/kingcos/cocoapods-backup'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-backup/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-backup/command/backup'
@@ -0,0 +1,57 @@
1
+ module Pod
2
+ class Podfile
3
+ module DSL
4
+ # Saving original pod method
5
+ pod_method = instance_method(:pod)
6
+
7
+ # Exchanging methods
8
+ define_method(:pod) do |name, *args|
9
+ unless args.last.is_a?(Hash)
10
+ # Calling original pod method
11
+ pod_method.bind(self).(name, *args)
12
+ return
13
+ end
14
+
15
+ # :backup => true
16
+ should_backup = args.last.delete(:backup)
17
+ sandbox = Config.instance.sandbox
18
+
19
+ if should_backup
20
+ # 1. Finding MyPod.podspec.json
21
+ podspec_json_filename = "#{name}.podspec.json"
22
+ # /Users/kingcos/Project/Pods/Local Podspecs/MyPod.podspec.json
23
+ podspec_json_org_path = sandbox.specifications_root + podspec_json_filename
24
+ # /Users/kingcos/Project/Pods/MyPod
25
+ pod_source_path = sandbox.sources_root + name
26
+ # /Users/kingcos/Project/Pods/MyPod/MyPod.podspec.json
27
+ podspec_json_dest_path = pod_source_path + podspec_json_filename
28
+
29
+ if !podspec_json_org_path.exist?
30
+ Pod::UI.warn "[Skipped] Cannot finding #{name}.podspec.json in #{sandbox.specifications_root}"
31
+
32
+ pod_method.bind(self).(name, *args)
33
+ return
34
+ end
35
+
36
+ # 2. ln -s Pods/Local Podspecs/MyPod.podspec.json Pods/MyPod/MyPod.podspec.json
37
+ File.symlink(podspec_json_org_path, podspec_json_dest_path) unless File.symlink? (podspec_json_dest_path)
38
+
39
+ # 3. Using :path => 'Pods/MyPod'
40
+ args.last[:path] = pod_source_path.to_s
41
+
42
+ # 4. Removing :git / :tag / :branch settings
43
+ args.last.delete(:git)
44
+ args.last.delete(:tag)
45
+ args.last.delete(:branch)
46
+ args.last.delete(:commit)
47
+
48
+ # PS: I don't know whether it's necessary for svn users
49
+ # args.last.delete(:svn)
50
+ end
51
+
52
+ # 5. Calling original pod method
53
+ pod_method.bind(self).(name, *args)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsBackup
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-backup/command'
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Backup do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ backup }).should.be.instance_of Command::Backup
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,50 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'pretty_bacon'
10
+ require 'pathname'
11
+ require 'cocoapods'
12
+
13
+ Mocha::Configuration.prevent(:stubbing_non_existent_method)
14
+
15
+ require 'cocoapods_plugin'
16
+
17
+ #-----------------------------------------------------------------------------#
18
+
19
+ module Pod
20
+
21
+ # Disable the wrapping so the output is deterministic in the tests.
22
+ #
23
+ UI.disable_wrap = true
24
+
25
+ # Redirects the messages to an internal store.
26
+ #
27
+ module UI
28
+ @output = ''
29
+ @warnings = ''
30
+
31
+ class << self
32
+ attr_accessor :output
33
+ attr_accessor :warnings
34
+
35
+ def puts(message = '')
36
+ @output << "#{message}\n"
37
+ end
38
+
39
+ def warn(message = '', actions = [])
40
+ @warnings << "#{message}\n"
41
+ end
42
+
43
+ def print(message)
44
+ @output << message
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ #-----------------------------------------------------------------------------#
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-backup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - kingcos
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-02-26 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Using current sources for your pods.
42
+ email:
43
+ - 2821836721v@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - cocoapods-backup.gemspec
54
+ - lib/cocoapods-backup.rb
55
+ - lib/cocoapods-backup/command.rb
56
+ - lib/cocoapods-backup/command/backup.rb
57
+ - lib/cocoapods-backup/gem_version.rb
58
+ - lib/cocoapods_plugin.rb
59
+ - spec/command/backup_spec.rb
60
+ - spec/spec_helper.rb
61
+ homepage: https://github.com/kingcos/cocoapods-backup
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubygems_version: 3.0.6
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Using current sources for your pods.
84
+ test_files:
85
+ - spec/command/backup_spec.rb
86
+ - spec/spec_helper.rb