cocoapods-templates 0.0.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
+ SHA256:
3
+ metadata.gz: 4f576285bb39b93242d8c32db74b3f684b6502f2f51a6fe7e9665cf03e6306b3
4
+ data.tar.gz: a1b4febdf5499d1415e8cbc40f426e947b09439ea575a5625fbe0a416591fb32
5
+ SHA512:
6
+ metadata.gz: 80ed9b0c93aba5d902a2ad6a00cbef28409a63abee3b73c80ac954a3196ebdef46e252cab5382dd6f89078518d4ddb9f73c161d3ceaf6d20e32413f7ef87eca7
7
+ data.tar.gz: b0e7267a7b2d8655cd61975c8e3d3bafd6834034ce8468e4a0e74286dfa9c721abe47d9ae59b5535dea4fd47e1b7b942e8cb5c78684e10b90d8fabd995099b10
data/.gitignore ADDED
@@ -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-templates.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
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2018 Oliver Letterer <oliver.letterer@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.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # cocoapods-templates
2
+
3
+ A description of cocoapods-templates.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-templates
8
+
9
+ ## Usage
10
+
11
+ $ pod spec templates POD_NAME
data/Rakefile ADDED
@@ -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,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-templates/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-templates'
8
+ spec.version = CocoapodsTemplates::VERSION
9
+ spec.authors = ['Oliver Letterer']
10
+ spec.email = ['oliver.letterer@gmail.com']
11
+ spec.description = %q{Cocoapods plugin to install Xcode templates from a remote source}
12
+ spec.summary = %q{Cocoapods plugin to install Xcode templates from a remote source}
13
+ spec.homepage = 'https://github.com/objc-pieces/cocoapods-templates'
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_dependency 'git', '~> 1.5'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-templates/gem_version'
@@ -0,0 +1 @@
1
+ require 'cocoapods-templates/command/templates'
@@ -0,0 +1,77 @@
1
+ require 'git'
2
+
3
+ module Pod
4
+ class Command
5
+ # This is an example of a cocoapods plugin adding a top-level subcommand
6
+ # to the 'pod' command.
7
+ #
8
+ # You can also create subcommands of existing or new commands. Say you
9
+ # wanted to add a subcommand to `list` to show newly deprecated pods,
10
+ # (e.g. `pod list deprecated`), there are a few things that would need
11
+ # to change.
12
+ #
13
+ # - move this file to `lib/pod/command/list/deprecated.rb` and update
14
+ # the class to exist in the the Pod::Command::List namespace
15
+ # - change this class to extend from `List` instead of `Command`. This
16
+ # tells the plugin system that it is a subcommand of `list`.
17
+ # - edit `lib/cocoapods_plugins.rb` to require this file
18
+ #
19
+ # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
20
+ # in the `plugins.json` file, once your plugin is released.
21
+ #
22
+ class Templates < Command
23
+ self.summary = 'Cocoapods plugin to install Xcode templates from a remote source'
24
+
25
+ self.description = <<-DESC
26
+ Cocoapods plugin to install Xcode templates from a remote source
27
+
28
+ https://github.com/objc-pieces/cocoapods-templates
29
+ DESC
30
+
31
+ self.arguments = 'URL'
32
+
33
+ def initialize(argv)
34
+ @url = argv.shift_argument
35
+ @name = File.basename @url.split("/").last
36
+ @owner = @url.split("/")[-2]
37
+ super
38
+ end
39
+
40
+ def validate!
41
+ super
42
+ help! 'An URL is required' unless @url
43
+ help! 'URL is invalid, expected something like https://example.com/repo.git' unless @url.start_with? "https://"
44
+ help! 'URL is invalid, expected something like https://example.com/repo.git' unless @url.end_with? ".git"
45
+ end
46
+
47
+ def run
48
+ UI.puts "Add your implementation for the cocoapods-templates plugin in #{__FILE__}"
49
+
50
+ tmp_directory = Dir.mktmpdir
51
+ Dir.chdir(tmp_directory) do
52
+ UI.puts "Cloning #{@url}"
53
+ Git.clone @url, @name
54
+
55
+ templates = Dir["**/*.xctemplate"]
56
+
57
+ if templates.count == 0
58
+ UI.puts "#{@url} does not contain any Xcode templates"
59
+ else
60
+ UI.puts "Installing #{templates.count} template(s) to ~/Library/Developer/Xcode/Templates/File Template for #{@owner}"
61
+ base = File.absolute_path "#{ENV["HOME"]}/Library/Developer/Xcode/Templates/File Template"
62
+
63
+ FileUtils.mkdir_p base
64
+ FileUtils.rm_rf "#{base}/#{@owner}"
65
+ FileUtils.mkdir_p "#{base}/#{@owner}"
66
+
67
+ templates.each do |path|
68
+ FileUtils.cp_r path, "#{base}/#{@owner}"
69
+ end
70
+
71
+ UI.puts "Please restart Xcode for the changes to take affect"
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,3 @@
1
+ module CocoapodsTemplates
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'git'
2
+ require 'fileutils'
3
+
4
+ require 'cocoapods-templates/command'
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Templates do
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w{ templates }).should.be.instance_of Command::Templates
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,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-templates
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Oliver Letterer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: git
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
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
+ description: Cocoapods plugin to install Xcode templates from a remote source
56
+ email:
57
+ - oliver.letterer@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - cocoapods-templates.gemspec
68
+ - lib/cocoapods-templates.rb
69
+ - lib/cocoapods-templates/command.rb
70
+ - lib/cocoapods-templates/command/templates.rb
71
+ - lib/cocoapods-templates/gem_version.rb
72
+ - lib/cocoapods_plugin.rb
73
+ - spec/command/templates_spec.rb
74
+ - spec/spec_helper.rb
75
+ homepage: https://github.com/objc-pieces/cocoapods-templates
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.7.6
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Cocoapods plugin to install Xcode templates from a remote source
99
+ test_files:
100
+ - spec/command/templates_spec.rb
101
+ - spec/spec_helper.rb