Initial commit

This commit is contained in:
leavez 2018-03-19 15:17:55 +08:00
commit ac54a19cef
13 changed files with 198 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_Store
pkg
.idea/

13
Gemfile Normal file
View File

@ -0,0 +1,13 @@
source 'https://rubygems.org'
# Specify your gem's dependencies in cocoapods-prebuild-framework.gemspec
gemspec
group :development do
gem 'cocoapods'
gem 'mocha'
gem 'bacon'
gem 'mocha-on-bacon'
gem 'prettybacon'
end

22
LICENSE.txt Normal file
View File

@ -0,0 +1,22 @@
Copyright (c) 2018 GaoJi <gaoji@mobike.com>
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# cocoapods-prebuild-framework
A description of cocoapods-prebuild-framework.
## Installation
$ gem install cocoapods-prebuild-framework
## Usage
$ pod spec framework POD_NAME

13
Rakefile Normal file
View File

@ -0,0 +1,13 @@
require 'bundler/gem_tasks'
def specs(dir)
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
end
desc 'Runs all the specs'
task :specs do
sh "bundle exec bacon #{specs('**')}"
end
task :default => :specs

View File

@ -0,0 +1,24 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cocoapods-prebuild-framework/gem_version.rb'
Gem::Specification.new do |spec|
spec.name = 'cocoapods-prebuild-framework'
spec.version = CocoapodsPrebuildFramework::VERSION
spec.authors = ['leavez']
spec.email = ['gaojiji@gmail.com']
spec.description = %q{A short description of cocoapods-prebuild-framework.}
spec.summary = %q{A longer description of cocoapods-prebuild-framework.}
spec.homepage = 'https://github.com/EXAMPLE/cocoapods-prebuild-framework'
spec.license = 'MIT'
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.add_dependency "cocoapods", ">= 1.4.0", "< 2.0"
spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'rake'
end

View File

@ -0,0 +1 @@
require 'cocoapods-prebuild-framework/gem_version'

View File

@ -0,0 +1 @@
require 'cocoapods-prebuild-framework/command/framework'

View File

@ -0,0 +1,44 @@
module Pod
class Command
# This is an example of a cocoapods plugin adding a top-level subcommand
# to the 'pod' command.
#
# You can also create subcommands of existing or new commands. Say you
# wanted to add a subcommand to `list` to show newly deprecated pods,
# (e.g. `pod list deprecated`), there are a few things that would need
# to change.
#
# - move this file to `lib/pod/command/list/deprecated.rb` and update
# the class to exist in the the Pod::Command::List namespace
# - change this class to extend from `List` instead of `Command`. This
# tells the plugin system that it is a subcommand of `list`.
# - edit `lib/cocoapods_plugins.rb` to require this file
#
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
# in the `plugins.json` file, once your plugin is released.
#
class Framework < Command
self.summary = 'Short description of cocoapods-prebuild-framework.'
self.description = <<-DESC
Longer description of cocoapods-prebuild-framework.
DESC
self.arguments = 'NAME'
def initialize(argv)
@name = argv.shift_argument
super
end
def validate!
super
help! 'A Pod name is required.' unless @name
end
def run
UI.puts "Add your implementation for the cocoapods-prebuild-framework plugin in #{__FILE__}"
end
end
end
end

View File

@ -0,0 +1,3 @@
module CocoapodsPrebuildFramework
VERSION = "0.0.1"
end

1
lib/cocoapods_plugin.rb Normal file
View File

@ -0,0 +1 @@
require 'cocoapods-prebuild-framework/command'

View File

@ -0,0 +1,12 @@
require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command::Framework do
describe 'CLAide' do
it 'registers it self' do
Command.parse(%w{ framework }).should.be.instance_of Command::Framework
end
end
end
end

50
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,50 @@
require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$:.unshift((ROOT + 'lib').to_s)
$:.unshift((ROOT + 'spec').to_s)
require 'bundler/setup'
require 'bacon'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'pathname'
require 'cocoapods'
Mocha::Configuration.prevent(:stubbing_non_existent_method)
require 'cocoapods_plugin'
#-----------------------------------------------------------------------------#
module Pod
# Disable the wrapping so the output is deterministic in the tests.
#
UI.disable_wrap = true
# Redirects the messages to an internal store.
#
module UI
@output = ''
@warnings = ''
class << self
attr_accessor :output
attr_accessor :warnings
def puts(message = '')
@output << "#{message}\n"
end
def warn(message = '', actions = [])
@warnings << "#{message}\n"
end
def print(message)
@output << message
end
end
end
end
#-----------------------------------------------------------------------------#