orientepodspecpush 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ee4abb7d6b40f03afa3a9035d2993420db413bd1ba2e3e5037ff7978769c9f83
4
+ data.tar.gz: '081f7304f024520f1e08225d0e3140bc0a93faf74704f18c1a056c727ac37440'
5
+ SHA512:
6
+ metadata.gz: 0fe035601c68d16d8c0fa62b27a10cc25d911cc6b26a90e5c8688e704fc2bd81b0e738c88b88826246de6a7bcf1997ec97d3b0e58eabec5e93702c330251f6f2
7
+ data.tar.gz: f1597ceae9618a149e068ec2d72d8cd9faf593efd9716d99e3792a5e9f02ef03f39037ca3eb315068638e4628c6072c35a2f6ccfd874a40ea5d633666c104a70
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in podspecpush.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 John wang
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Podspecpush
2
+
3
+ Tired of linting, checking, pushing your cocoapod spec? No more! Once you are satisified with your pod, simply increment and push the tag. No changes to .podspec required, the tooling will update this for you!
4
+
5
+ You can then publish your next version by running `orientepodspecpush --specRepo <reponame>`!
6
+
7
+ Thats it!
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'orientepodspecpush'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install orientepodspecpush
24
+
25
+ ## Usage
26
+
27
+ ```sh
28
+ Options:
29
+ -s, --specRepo=<s> Name of the repo to push to. See pod repo list for available repos
30
+ -w, --workspace=<s> Path to cocoapod workspace
31
+ -o, --sources=<s> Comma delimited list of private repo sources to consider when linting private repo. Master is included by default so private repos can source master
32
+ -p, --private If set, assume the cocoapod is private and skip public checks
33
+ -h, --help Show this message
34
+ ```
35
+
36
+ Note: The force flag is off by default. If set to true you will push with warnings.
37
+
38
+ ## Development
39
+
40
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
41
+
42
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
43
+
44
+ ## Contributing
45
+
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jcarroll-mediafly/podspecpush.
47
+
48
+
49
+ ## License
50
+
51
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
52
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "orientepodspecpush"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "podspecpush"
4
+
5
+ podpush = Podspecpush::PodPush.new
6
+ podpush.push
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module Orientepodspecpush
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,152 @@
1
+ require "orientepodspecpush/version"
2
+ require 'colorize'
3
+ require 'trollop'
4
+
5
+ module Orientepodspecpush
6
+ class PodPush
7
+
8
+ def specfile
9
+ Dir["*.podspec"].first
10
+ end
11
+
12
+ def shouldUseBundleExec
13
+ File.exist?('Gemfile')
14
+ end
15
+
16
+ def ensureSpecfile
17
+ podspecFile = specfile
18
+
19
+ puts "No spec file found".red unless podspecFile != nil
20
+ exit unless podspecFile != nil
21
+ end
22
+
23
+ def ensureGitClean
24
+ if `git status --porcelain`.length != 0
25
+ puts "Repo is not clean; will not push new version".red
26
+ exit
27
+ end
28
+
29
+ cmd = []
30
+ cmd << ['bundle exec'] if shouldUseBundleExec
31
+ cmd << ['pod cache clean --all']
32
+ system cmd.join(' ')
33
+ end
34
+
35
+ def makeLintCmd(opts)
36
+ lintCmd = []
37
+ lintCmd << ['bundle exec'] if shouldUseBundleExec
38
+ lintCmd << ["pod spec lint"]
39
+
40
+ # Build sources
41
+ sources = ["https://github.com/CocoaPods/Specs.git"]
42
+ sources << opts[:sources] unless opts[:sources] == nil
43
+ sourcesArg = "--sources=" + sources.join(",")
44
+
45
+ # Build lintCmd
46
+ lintCmd << specfile
47
+ lintCmd << sourcesArg
48
+ lintCmd << ["--private"] unless opts[:private] == false
49
+
50
+ # finalize
51
+ lintCmd.join(' ')
52
+ end
53
+
54
+ def makePushCmd(opts)
55
+ cmd = []
56
+ cmd << ['bundle exec'] if shouldUseBundleExec
57
+ cmd << ["pod repo push #{opts[:specRepo]} #{specfile} --allow-warnings"]
58
+
59
+ cmd.join(' ')
60
+ end
61
+
62
+ def updateVersion
63
+ puts "Please enter new version of the pod so we can tag, lint and push it! (e.g. 1.2.0)".blue
64
+ @podVersion = gets.chomp.downcase
65
+
66
+ puts "Please enter new a brief message to put in the git tag describing what's changed".blue
67
+ @podVersionMessage = gets.chomp.downcase
68
+
69
+ system "git tag -a #{@podVersion} -m '#{@podVersionMessage}'"
70
+ system "git push --tags"
71
+
72
+ contents = File.read(specfile)
73
+ oldVersion = Regexp.new('[0-9.]{2,6}').match(Regexp.new('(s.version)\s*=.*\n').match(contents).to_s).to_s
74
+ File.write(specfile, contents.sub!(oldVersion, @podVersion))
75
+ end
76
+
77
+ def rollbackTag
78
+ puts "Rolling back git tags".green
79
+ system "git tag -d #{@podVersion}"
80
+ system "git push -d origin #{@podVersion}"
81
+ exit
82
+ end
83
+
84
+ def executeLint(withWarnings)
85
+ cmd = [@lintCmd]
86
+ cmd << "--allow-warnings" unless withWarnings == false
87
+
88
+ command = cmd.join(' ')
89
+
90
+ puts "Executing: #{command}".green
91
+ success = system command
92
+
93
+ if success == false && withWarnings == false
94
+ # Try again?
95
+ puts "Linting failed, try again by allowing warnings? [Y/n]".blue
96
+ gets.chomp.downcase == "y" ? executeLint(true) : rollbackTag
97
+ elsif success == false && withWarnings == true
98
+ puts "Even with warnings, something is wrong. Look for any errors".red
99
+ rollbackTag
100
+ end
101
+ end
102
+
103
+ def executePush
104
+ puts "Executing: #{@pushCmd}".green
105
+ success = system @pushCmd
106
+
107
+ if success == false
108
+ puts "Push failed, see errors.".red
109
+ rollbackTag
110
+ end
111
+ end
112
+
113
+ def commitThisRepo
114
+ puts "Congrats! The pod has been linted and successfully push to the spec repo! All that is left is to commit the podspec here!".green
115
+
116
+ puts "Could not commit files, consider finishing by hand by performing a git commit and push. Your spec repo should be up to date".red unless system('git commit -am "[Versioning] Updating podspec"') == true
117
+ puts "Could not push to server, consider finishing by hand by performing a git push. Your spec repo should be up to date".red unless system('git push origin master')
118
+ end
119
+
120
+ def push
121
+ opts = Trollop::options do
122
+ opt :specRepo, "Name of the repo to push to. See pod repo list for available repos", :type => :string
123
+ opt :workspace, "Path to cocoapod workspace", :type => :string
124
+ opt :sources, "Comma delimited list of private repo sources to consider when linting private repo. Master is included by default so private repos can source master", :type => :string
125
+ opt :private, "If set, assume the cocoapod is private and skip public checks"
126
+ end
127
+ # Need these two
128
+ Trollop::die :specRepo, "Spec Repo must be provided" if opts[:specRepo] == nil
129
+ Trollop::die :workspace, "Workspace path must be provided" if opts[:workspace] == nil
130
+
131
+ Dir.chdir(opts[:workspace]) do
132
+ # Check
133
+ ensureGitClean
134
+ ensureSpecfile
135
+
136
+ # User input
137
+ updateVersion
138
+
139
+ # Cmds
140
+ @lintCmd = makeLintCmd(opts)
141
+ @pushCmd = makePushCmd(opts)
142
+
143
+ # execute
144
+ executeLint(false)
145
+ executePush
146
+
147
+ # Tidy up this repo!!
148
+ commitThisRepo
149
+ end
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'orientepodspecpush/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "orientepodspecpush"
8
+ spec.version = Orientepodspecpush::VERSION
9
+ spec.authors = ["John wang"]
10
+ spec.email = ["j429777299@qq.com"]
11
+
12
+ spec.summary = "Lint, publish and push podspec after tagging"
13
+ spec.description = "Once you tag a new version of your cocoapod run this to automatically run pod spec lint, pod push and finally update your local cocoapod spec file. All you must do is git tag!"
14
+ spec.homepage = "https://github.com/johnWang06/orientepodspecpush.git"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = ["orientepodspecpush"]
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency 'trollop'
25
+ spec.add_runtime_dependency 'colorize'
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.13"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: orientepodspecpush
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John wang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: trollop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Once you tag a new version of your cocoapod run this to automatically
70
+ run pod spec lint, pod push and finally update your local cocoapod spec file. All
71
+ you must do is git tag!
72
+ email:
73
+ - j429777299@qq.com
74
+ executables:
75
+ - orientepodspecpush
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - ".gitignore"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/orientepodspecpush
86
+ - bin/setup
87
+ - lib/orientepodspecpush.rb
88
+ - lib/orientepodspecpush/version.rb
89
+ - orientepodspecpush.gemspec
90
+ homepage: https://github.com/johnWang06/orientepodspecpush.git
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.7.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Lint, publish and push podspec after tagging
114
+ test_files: []