cocoapods-publisher 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2I0YTU1MGVkYmJkMzJkNTdlNjI2MzE4ZGIxNDViYWRhNzcyNmU3MA==
5
+ data.tar.gz: !binary |-
6
+ YmZjZjZmY2ZhOGQwYzIyZmQ2MTExNTVmMmFiY2IwNGQ3ZmU5OWJmYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZTczZDQ3YTdhMDIwNDZmN2FkNDAyMjQ0NjRhNGZiNmExZTlhODRhNmY4NTJj
10
+ NGZkNzYwNmIyNjViZDA3MWZiOGUxNTgxNDllMDYyNTg4N2NjMGI2ZWJlMjFj
11
+ YjMzZDZkZTk5NTU5ZGNhZjI2MjkwZTFjNTJiNTdmZGE1NDUwODE=
12
+ data.tar.gz: !binary |-
13
+ ZWYzYWNhMzZjOTA0MDcwODg1YThlOWE1NjVjMmEwNGRjM2I4MjRkNTc2N2U0
14
+ MjE1NTI5MjRhNmJhZjIwYzY0OTRlMTRjOWY3ZWUzZTRmYzllNjNlZDUxNDc0
15
+ NmE2ZDkzZjQ3ZWE1OWFlOGQ4NDgxYTVhODI2YjU3ZGJmYTdiNjk=
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "thor", "0.16.0"
7
+ gem "git", "1.2.5"
8
+ gem "cocoapods-core", "0.22.1"
9
+
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "fakefs", "~> 0.4.2"
14
+ gem "rspec", "2.14.0"
15
+ gem "rdoc", "~> 3.12"
16
+ gem "bundler", "~> 1.3.5"
17
+ gem "jeweler", "~> 1.8.4"
18
+ gem "simplecov", ">= 0"
19
+ end
@@ -0,0 +1,83 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.13)
5
+ i18n (= 0.6.1)
6
+ multi_json (~> 1.0)
7
+ addressable (2.3.5)
8
+ builder (3.2.2)
9
+ cocoapods-core (0.22.1)
10
+ activesupport (~> 3.2.13)
11
+ json (~> 1.8.0)
12
+ nap (~> 0.5.1)
13
+ diff-lcs (1.2.4)
14
+ fakefs (0.4.2)
15
+ faraday (0.8.8)
16
+ multipart-post (~> 1.2.0)
17
+ git (1.2.5)
18
+ github_api (0.10.1)
19
+ addressable
20
+ faraday (~> 0.8.1)
21
+ hashie (>= 1.2)
22
+ multi_json (~> 1.4)
23
+ nokogiri (~> 1.5.2)
24
+ oauth2
25
+ hashie (2.0.5)
26
+ highline (1.6.19)
27
+ httpauth (0.2.0)
28
+ i18n (0.6.1)
29
+ jeweler (1.8.6)
30
+ builder
31
+ bundler (~> 1.0)
32
+ git (>= 1.2.5)
33
+ github_api (= 0.10.1)
34
+ highline (>= 1.6.15)
35
+ nokogiri (= 1.5.10)
36
+ rake
37
+ rdoc
38
+ json (1.8.0)
39
+ jwt (0.1.8)
40
+ multi_json (>= 1.5)
41
+ multi_json (1.7.7)
42
+ multi_xml (0.5.4)
43
+ multipart-post (1.2.0)
44
+ nap (0.5.1)
45
+ nokogiri (1.5.10)
46
+ oauth2 (0.9.2)
47
+ faraday (~> 0.8)
48
+ httpauth (~> 0.2)
49
+ jwt (~> 0.1.4)
50
+ multi_json (~> 1.0)
51
+ multi_xml (~> 0.5)
52
+ rack (~> 1.2)
53
+ rack (1.5.2)
54
+ rake (10.1.0)
55
+ rdoc (3.12.2)
56
+ json (~> 1.4)
57
+ rspec (2.14.0)
58
+ rspec-core (~> 2.14.0)
59
+ rspec-expectations (~> 2.14.0)
60
+ rspec-mocks (~> 2.14.0)
61
+ rspec-core (2.14.0)
62
+ rspec-expectations (2.14.0)
63
+ diff-lcs (>= 1.1.3, < 2.0)
64
+ rspec-mocks (2.14.1)
65
+ simplecov (0.7.1)
66
+ multi_json (~> 1.0)
67
+ simplecov-html (~> 0.7.1)
68
+ simplecov-html (0.7.1)
69
+ thor (0.16.0)
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ bundler (~> 1.3.5)
76
+ cocoapods-core (= 0.22.1)
77
+ fakefs (~> 0.4.2)
78
+ git (= 1.2.5)
79
+ jeweler (~> 1.8.4)
80
+ rdoc (~> 3.12)
81
+ rspec (= 2.14.0)
82
+ simplecov
83
+ thor (= 0.16.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 devboy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ = cocoapods-publisher
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to cocoapods-publisher
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 devboy. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "cocoapods-publisher"
18
+ gem.homepage = "http://github.com/devboy/cocoapods-publisher"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Pushes a podspec to a cocoapods repository}
21
+ gem.description = %Q{Pushes a podspec to a cocoapods repository}
22
+ gem.email = "dominic.graefen@gmail.com"
23
+ gem.authors = %w(devboy)
24
+ gem.bindir = 'bin'
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rdoc/task'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "cocoapods-publisher #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'cocoapods-publisher'
4
+ Pod::Publisher::CLI.start
@@ -0,0 +1,19 @@
1
+ require 'thor'
2
+ require 'spec_repository'
3
+ require 'cocoapods-core'
4
+
5
+ module Pod
6
+ module Publisher
7
+ class CLI < Thor
8
+
9
+ desc "publish PODSPEC SPECREPOSITORY", "pushes PODSPEC to SPECREPOSITORY"
10
+ def publish(podspec,repository)
11
+ repo = SpecRepository.new(repository)
12
+ repo.add_podspec Pod::Specification.from_file(podspec)
13
+ repo.upload
14
+ repo.wipe
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,50 @@
1
+ require 'cocoapods-core'
2
+ require 'git'
3
+
4
+ module Pod
5
+ module Publisher
6
+ class SpecRepository
7
+
8
+ attr_reader :url, :local_path
9
+
10
+ def initialize(url)
11
+ @url = url
12
+ @local_path = find_local_path url
13
+ end
14
+
15
+ def download
16
+ wipe
17
+ FileUtils.mkdir_p(@local_path)
18
+ Git.clone(@url, '', :path => @local_path)
19
+ end
20
+
21
+ def upload
22
+ repo.push
23
+ end
24
+
25
+ def wipe
26
+ FileUtils.rm_rf @local_path if File.directory? @local_path
27
+ end
28
+
29
+ def add_podspec(podspec)
30
+ repo
31
+ target_file = File.join(@local_path, podspec.name, podspec.version.to_s, "#{podspec.name}.podspec")
32
+ FileUtils.mkdir_p(File.dirname(target_file))
33
+ FileUtils.cp podspec.defined_in_file, target_file
34
+ repo.add(target_file)
35
+ repo.commit_all("Adding #{podspec.name} #{podspec.version}")
36
+ end
37
+
38
+ private
39
+
40
+ def repo
41
+ @repo ||= download
42
+ end
43
+
44
+ def find_local_path(url)
45
+ File.join(File.expand_path('~'), '.pod-publish', url.gsub(/[^a-zA-Z]/,"_").gsub(/_{2,}/,'_').downcase)
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'cocoapods-publisher'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
@@ -0,0 +1,89 @@
1
+ require 'rspec'
2
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
+ require 'git'
4
+ require 'fakefs'
5
+ require 'cocoapods-core'
6
+
7
+ describe Pod::Publisher::SpecRepository, :fakefs => true do
8
+
9
+ def cleanup
10
+ FileUtils.rm_rf @local_path if File.directory? @local_path
11
+ end
12
+
13
+ before :each do
14
+ @repo_url = 'https://github.com/CocoaPods/Specs.git'
15
+ @local_path = File.join(File.expand_path('~'), '.pod-publish', 'https_github_com_cocoapods_specs_git')
16
+ @repo = Pod::Publisher::SpecRepository.new(@repo_url)
17
+ cleanup
18
+ end
19
+
20
+ after :all do
21
+ cleanup
22
+ end
23
+
24
+ it 'should be initialized with a repository url' do
25
+ @repo.url.should == @repo_url
26
+ end
27
+
28
+ it 'should point to a local directory' do
29
+ @repo.local_path.should end_with(@local_path)
30
+ end
31
+
32
+ it 'should clone the repository into local path on download' do
33
+ allow(Git).to receive(:clone).and_return(nil)
34
+ @repo.download
35
+ expect(Git).to have_received(:clone).with(@repo_url, '', :path => @local_path)
36
+ end
37
+
38
+ it 'should delete the local path on wipe' do
39
+ FileUtils.mkdir_p(@local_path)
40
+ @repo.wipe
41
+ File.directory?(@local_path).should be_false
42
+ end
43
+
44
+ it 'should push the repository on upload' do
45
+ git = double('git')
46
+ allow(Git).to receive(:clone).and_return(git)
47
+ allow(git).to receive(:push)
48
+ @repo.upload
49
+ git.should have_received :push
50
+ end
51
+
52
+ describe '#add_podspec' do
53
+
54
+ before :each do
55
+ File.open("Test.podspec", 'w') {|f| f.write(<<-file
56
+ Pod::Spec.new do |s|
57
+ s.name = "Test"
58
+ s.version = "1.0.0"
59
+ s.summary = "Test"
60
+ s.homepage = "http://test.com"
61
+ s.license = 'MIT'
62
+ s.author = { "a" => "a.b@gmail.com" }
63
+ s.source = { :git => "https://github.com/test/test.git", :tag => "\#{s.version}" }
64
+ s.platform = :ios
65
+ s.source_files = 'Test/*.{h,m}'
66
+ s.requires_arc = true
67
+ end
68
+ file
69
+ ) }
70
+ git = double('git')
71
+ allow(Git).to receive(:clone).and_return(git)
72
+ allow(git).to receive(:commit_all)
73
+ allow(git).to receive(:add)
74
+ FileUtils.mkdir_p(File.join(@local_path,'.git'))
75
+ end
76
+
77
+ it 'should add a spec file to the repository' do
78
+ @repo.add_podspec(Pod::Specification.from_file('Test.podspec'))
79
+ File.exist?(File.join(@local_path, 'Test', '1.0.0', 'Test.podspec')).should be_true
80
+ end
81
+
82
+ it 'should commit the spec file' do
83
+ @repo.add_podspec(Pod::Specification.from_file('Test.podspec'))
84
+ File.exist?(File.join(@local_path, 'Test', '1.0.0', 'Test.podspec')).should be_true
85
+ end
86
+
87
+ end
88
+
89
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-publisher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - devboy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.16.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.16.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: cocoapods-core
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.22.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.22.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: fakefs
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rdoc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '3.12'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '3.12'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.5
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.5
111
+ - !ruby/object:Gem::Dependency
112
+ name: jeweler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.8.4
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 1.8.4
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Pushes a podspec to a cocoapods repository
140
+ email: dominic.graefen@gmail.com
141
+ executables:
142
+ - pod-publish
143
+ extensions: []
144
+ extra_rdoc_files:
145
+ - LICENSE.txt
146
+ - README.rdoc
147
+ files:
148
+ - .document
149
+ - Gemfile
150
+ - Gemfile.lock
151
+ - LICENSE.txt
152
+ - README.rdoc
153
+ - Rakefile
154
+ - VERSION
155
+ - bin/pod-publish
156
+ - lib/cocoapods-publisher.rb
157
+ - lib/spec_repository.rb
158
+ - spec/spec_helper.rb
159
+ - spec/spec_repository_spec.rb
160
+ homepage: http://github.com/devboy/cocoapods-publisher
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ! '>='
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.0.3
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: Pushes a podspec to a cocoapods repository
184
+ test_files: []