podspecdolly 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 612c46e5f9b489fc73e43db81227b5da3b44b2db
4
+ data.tar.gz: 12b48f34ae4e365273e235c9731e6e2b8b1e5d1d
5
+ SHA512:
6
+ metadata.gz: 1be55ebfb700367f417e575313c804da1f418987a2e98c742f03889dc2620ef8950ef354887daa4a6aa890f55bbda03d921f42a389517b39eb89fd940f62f5c6
7
+ data.tar.gz: 7c0bdf35a667492ef4eee5660984c1003209bbcb4c84036036d3c4eb84224ff85416f3c63f6098d4c8b8f11264008841448d18775093fd9775f049954c43672a
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at dodinhthyson@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ SKIP_UNRELEASED_VERSIONS = false
2
+ # Specify your gem's dependencies in podspecdolly.gemspec
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Podspecdolly
2
+
3
+ As the global podspec on github of Cocoapods is growing larger, any process involving cocoapod is a pain especially if your project has 10 or more dependencies. The option is to run a local or self-hosted podspec. This tool will allow you to rely totally on your own podspec by cloning only the pods that you want, based on a podfile, without the need to send a pull request to Cocoapods/Specs
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'podspecdolly'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install podspecdolly
20
+
21
+ I didn't release it on rubygems.org yet. Download or clone this git
22
+
23
+ ## Usage
24
+
25
+ - cd to a folder with a podfile
26
+ - $ podspecdolly clone
27
+ - All currently missing version of podspec will be download to a Specs folder
28
+
29
+ ## Development
30
+
31
+ Features that are missing and are planned for next release, arrange from most to least prioritized :
32
+ - Automatically download pod dependencies
33
+ - Allow clone from other sources
34
+ - Writing tests
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/doraeminemon/podspecdolly. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/podspecdolly ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby -U
2
+ require 'podspecdolly'
3
+
4
+ Podspecdolly::Interface.start(ARGV)
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,5 @@
1
+ require "podspecdolly/version"
2
+ require 'podspecdolly/interface'
3
+
4
+ module Podspecdolly
5
+ end
@@ -0,0 +1,16 @@
1
+ module Podspecdolly
2
+ class Dependencies
3
+ def initialize(podfile)
4
+ @podfile = podfile
5
+ end
6
+
7
+ def validate
8
+ pods = Array.new
9
+ File.open(@podfile).each do |line|
10
+ pods << line[/'([^']+)/,0].sub(/'/,'')
11
+ end
12
+ pods
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ require 'thor'
2
+ require 'podspecdolly/shard'
3
+ require 'podspecdolly/dependencies'
4
+ require 'podspecdolly/podspec_getter'
5
+
6
+ module Podspecdolly
7
+ class Interface < Thor
8
+ package_name 'podspecdolly'
9
+ desc "clone PODFILE SHARD_LENGTH", "clone the pods from PODFILE with SHARD_LENGTH"
10
+ def clone(podfile = 'podfile', shard_length = [1,1,1])
11
+ @podfile = Dir::glob(podfile).first
12
+ pods = Dependencies.new(@podfile).validate
13
+ if pods.count == 0
14
+ p "Couldn't find any valid pod declaration in #{@podfile.to_s}"
15
+ abort
16
+ else
17
+ pods.each do |pod|
18
+ p 'Checking up for pod ' << pod
19
+ podpath = Shard.new(pod, shard_length).podpath
20
+ requester = Podspec_getter.new(pod,podpath)
21
+ requester.request
22
+ end
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,51 @@
1
+ #https://api.github.com/repos/CocoaPods/Specs/contents/Specs/#{pod}
2
+ require 'unirest'
3
+ require 'json'
4
+ require 'fileutils'
5
+ module Podspecdolly
6
+ class Podspec_getter
7
+ def initialize(podname, pod_path)
8
+ @podname = podname
9
+ @pod_path = pod_path
10
+ end
11
+
12
+ def request
13
+ url = "https://api.github.com/repos/CocoaPods/Specs/contents/Specs/#{@pod_path}#{@podname}"
14
+ pod_response = Unirest.get( url , headers: {"Accept" => "application/json"})
15
+ check_responsecode_success(pod_response,"URL to Cocoapod spec with #{@podname} is invalid. Check pod name again ?")
16
+ pod_object = pod_response.body
17
+ if pod_object.kind_of?(Array)
18
+ FileUtils::mkdir_p "./Specs/#{@podname}"
19
+ pod_object.each do |version|
20
+ version_name = version['name']
21
+ url = version['url']
22
+ unless File.directory?("./Specs/#{@podname}/#{version_name}")
23
+ FileUtils::mkdir_p "./Specs/#{@podname}/#{version_name}"
24
+ version_response = Unirest.get url
25
+ check_responsecode_success(version_response, "Request for version #{version_name} failed.")
26
+ version_object = version_response.body
27
+ if version_object.kind_of?(Array)
28
+ version_object.each do |object|
29
+ object_name = object['name']
30
+ object_downloadurl = object['download_url']
31
+ podspec_response = Unirest.get object_downloadurl
32
+ File.open("./Specs/#{@podname}/#{version_name}/#{object_name}", 'w') do |f|
33
+ f.puts podspec_response
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def check_responsecode_success(response, message)
43
+ unless response.code.between?(200,299)
44
+ p message
45
+ p response.body
46
+ abort
47
+ end
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ require 'digest/md5'
2
+ module Podspecdolly
3
+ class Shard
4
+ def initialize(name, length)
5
+ @name = name
6
+ @lengths = length
7
+ end
8
+
9
+ def shard
10
+ hashed = Digest::MD5.hexdigest(@name)
11
+ prefix_lengths = Array.new
12
+ @lengths.each_with_index { |length, index|
13
+ prefix_lengths << hashed.slice(index, length)
14
+ }
15
+ prefix_lengths
16
+ end
17
+
18
+ def podpath
19
+ path = ''
20
+ shard.map { |hex|
21
+ path << hex.to_s << '/'
22
+ }
23
+ path
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module Podspecdolly
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'podspecdolly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "podspecdolly"
8
+ spec.version = Podspecdolly::VERSION
9
+ spec.authors = ["Do Son"]
10
+ spec.email = ["dodinhthyson@gmail.com"]
11
+
12
+ spec.summary = %q{Cloning required pod to a local podspec}
13
+ spec.description = %q{Cloning required pod to a local podspec}
14
+ spec.homepage = "http://doraeminemon.github.io/podspecdolly"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = "bin"
23
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.13"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_dependency "thor"
29
+ spec.add_dependency "unirest"
30
+
31
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: podspecdolly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Do Son
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-15 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
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: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
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: unirest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Cloning required pod to a local podspec
70
+ email:
71
+ - dodinhthyson@gmail.com
72
+ executables:
73
+ - podspecdolly
74
+ - setup
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - CODE_OF_CONDUCT.md
79
+ - Gemfile
80
+ - README.md
81
+ - Rakefile
82
+ - bin/podspecdolly
83
+ - bin/setup
84
+ - lib/podspecdolly.rb
85
+ - lib/podspecdolly/dependencies.rb
86
+ - lib/podspecdolly/interface.rb
87
+ - lib/podspecdolly/podspec_getter.rb
88
+ - lib/podspecdolly/shard.rb
89
+ - lib/podspecdolly/version.rb
90
+ - podspecdolly.gemspec
91
+ homepage: http://doraeminemon.github.io/podspecdolly
92
+ licenses: []
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.4.8
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Cloning required pod to a local podspec
114
+ test_files: []