├── gems
└── ruby
│ └── 2.0.0
│ ├── gems
│ ├── dnssd-3.0.1
│ │ ├── .gemtest
│ │ ├── ext
│ │ │ └── dnssd
│ │ │ │ ├── .RUBYARCHDIR.time
│ │ │ │ ├── dnssd.o
│ │ │ │ ├── errors.o
│ │ │ │ ├── flags.o
│ │ │ │ ├── record.o
│ │ │ │ ├── service.o
│ │ │ │ ├── dnssd.bundle
│ │ │ │ ├── dnssd.h
│ │ │ │ ├── dnssd.c
│ │ │ │ └── extconf.rb
│ │ ├── lib
│ │ │ ├── dnssd
│ │ │ │ ├── dnssd.bundle
│ │ │ │ ├── reply
│ │ │ │ │ ├── domain.rb
│ │ │ │ │ ├── register.rb
│ │ │ │ │ ├── addr_info.rb
│ │ │ │ │ ├── browse.rb
│ │ │ │ │ ├── resolve.rb
│ │ │ │ │ └── query_record.rb
│ │ │ │ ├── text_record.rb
│ │ │ │ ├── flags.rb
│ │ │ │ ├── reply.rb
│ │ │ │ └── record.rb
│ │ │ └── dnssd.rb
│ │ ├── sample
│ │ │ ├── query_record.rb
│ │ │ ├── enumerate_domains.rb
│ │ │ ├── growl.rb
│ │ │ ├── socket.rb
│ │ │ ├── server.rb
│ │ │ ├── getaddrinfo.rb
│ │ │ ├── browse.rb
│ │ │ ├── register.rb
│ │ │ ├── resolve.rb
│ │ │ └── resolve_ichat.rb
│ │ ├── .autotest
│ │ ├── Rakefile
│ │ ├── Manifest.txt
│ │ ├── test
│ │ │ ├── test_dnssd_reply_browse.rb
│ │ │ ├── test_dnssd_reply_resolve.rb
│ │ │ ├── test_dnssd_text_record.rb
│ │ │ ├── test_dnssd_reply.rb
│ │ │ ├── test_dnssd_reply_query_record.rb
│ │ │ ├── test_dnssd.rb
│ │ │ ├── test_dnssd_record.rb
│ │ │ ├── test_dnssd_flags.rb
│ │ │ └── test_dnssd_service.rb
│ │ ├── README.txt
│ │ └── History.txt
│ ├── plist-3.1.0
│ │ ├── test
│ │ │ ├── assets
│ │ │ │ ├── example_data.bin
│ │ │ │ ├── example_data.jpg
│ │ │ │ ├── commented.plist
│ │ │ │ ├── test_empty_key.plist
│ │ │ │ ├── test_data_elements.plist
│ │ │ │ ├── Cookies.plist
│ │ │ │ └── AlbumData.xml
│ │ │ ├── test_generator.rb
│ │ │ ├── test_generator_collections.rb
│ │ │ ├── test_generator_basic_types.rb
│ │ │ ├── test_parser.rb
│ │ │ └── test_data_elements.rb
│ │ ├── lib
│ │ │ ├── plist.rb
│ │ │ └── plist
│ │ │ │ └── parser.rb
│ │ ├── LICENSE
│ │ ├── CHANGELOG
│ │ └── Rakefile
│ └── colorize-0.7.7
│ │ ├── Rakefile
│ │ ├── lib
│ │ ├── colorize.rb
│ │ └── colorize
│ │ │ ├── class_methods.rb
│ │ │ └── instance_methods.rb
│ │ ├── colorize.gemspec
│ │ ├── CHANGELOG
│ │ └── README.md
│ ├── cache
│ ├── dnssd-3.0.1.gem
│ ├── plist-3.1.0.gem
│ └── colorize-0.7.7.gem
│ └── specifications
│ ├── plist-3.1.0.gemspec
│ ├── colorize-0.7.7.gemspec
│ └── dnssd-3.0.1.gemspec
├── Gemfile
├── plugin
└── SparklingHelper.xcplugin
│ └── Contents
│ ├── MacOS
│ └── SparklingHelper
│ ├── Frameworks
│ ├── libswiftAppKit.dylib
│ ├── libswiftCore.dylib
│ ├── libswiftDarwin.dylib
│ ├── libswiftCoreData.dylib
│ ├── libswiftDispatch.dylib
│ ├── libswiftCoreImage.dylib
│ ├── libswiftFoundation.dylib
│ ├── libswiftObjectiveC.dylib
│ └── libswiftCoreGraphics.dylib
│ ├── Info.plist
│ └── Resources
│ └── SparklingHelper.xcscheme
├── lib
├── vendor
│ └── homebrew-fork
│ │ ├── README.md
│ │ ├── monkeypatch_pathname.rb
│ │ ├── exceptions.rb
│ │ ├── testing_env.rb
│ │ ├── global.rb
│ │ ├── LICENSE.txt
│ │ ├── utils.rb
│ │ └── download_strategy.rb
├── brew_sparkling
│ ├── handler
│ │ ├── help.rb
│ │ ├── base.rb
│ │ ├── recipe.rb
│ │ ├── xcode.rb
│ │ └── install.rb
│ ├── action
│ │ ├── install
│ │ │ ├── fetch.rb
│ │ │ ├── build.rb
│ │ │ ├── request_provisioning.rb
│ │ │ ├── patch.rb
│ │ │ ├── install_app.rb
│ │ │ ├── unpack.rb
│ │ │ ├── base.rb
│ │ │ └── change_id.rb
│ │ ├── xcode
│ │ │ ├── accounts.rb
│ │ │ ├── base.rb
│ │ │ ├── discover.rb
│ │ │ ├── certificates.rb
│ │ │ └── devices.rb
│ │ └── recipe
│ │ │ ├── search.rb
│ │ │ └── base.rb
│ ├── location.rb
│ ├── recipe
│ │ ├── extension
│ │ │ ├── info.rb
│ │ │ ├── path.rb
│ │ │ └── build.rb
│ │ ├── recipes.rb
│ │ └── builder.rb
│ ├── homebrew
│ │ ├── download.rb
│ │ └── adapter.rb
│ ├── logger.rb
│ ├── cli.rb
│ ├── handler.rb
│ ├── user.rb
│ └── gateway
│ │ └── xcode.rb
└── brew-sparkling-cmd.rb
├── Gemfile.lock
├── recipe
├── SparklingSample.rb
├── Shinchoku.rb
├── Provenance.rb
├── Cling.rb
├── StickHero.rb
├── Calc.rb
├── bridges2.rb
└── SpoolDays.rb
├── brew-sparkling.rb
├── LICENSE
├── README.md
└── bin
└── brew-sparkling
/gems/ruby/2.0.0/gems/dnssd-3.0.1/.gemtest:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/.RUBYARCHDIR.time:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | gem 'dnssd'
4 | gem 'plist'
5 | gem 'colorize'
6 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/cache/dnssd-3.0.1.gem:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/cache/dnssd-3.0.1.gem
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/cache/plist-3.1.0.gem:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/cache/plist-3.1.0.gem
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/cache/colorize-0.7.7.gem:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/cache/colorize-0.7.7.gem
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/example_data.bin:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/dnssd.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/dnssd.o
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/errors.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/errors.o
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/flags.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/flags.o
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/record.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/record.o
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/service.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/service.o
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/dnssd.bundle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/dnssd.bundle
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/dnssd.bundle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/dnssd.bundle
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/example_data.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/example_data.jpg
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/MacOS/SparklingHelper:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/MacOS/SparklingHelper
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/colorize-0.7.7/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rake/testtask'
2 |
3 | Rake::TestTask.new do |t|
4 | t.libs << 'test'
5 | end
6 |
7 | desc 'Run tests'
8 | task :default => :test
9 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/README.md:
--------------------------------------------------------------------------------
1 | A temporary minimal fork of the Homebrew codebase.
2 |
3 | This is a transitional measure while we separate the Homebrew-cask backend
4 | from Homebrew.
5 |
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftAppKit.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftAppKit.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCore.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCore.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftDarwin.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftDarwin.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCoreData.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCoreData.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftDispatch.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftDispatch.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCoreImage.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCoreImage.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftFoundation.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftFoundation.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftObjectiveC.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftObjectiveC.dylib
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCoreGraphics.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codefirst/homebrew-sparkling/HEAD/plugin/SparklingHelper.xcplugin/Contents/Frameworks/libswiftCoreGraphics.dylib
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/monkeypatch_pathname.rb:
--------------------------------------------------------------------------------
1 | require 'pathname'
2 |
3 | class Pathname
4 |
5 | # FIXME eliminate the places where we rely on this method
6 | alias_method :to_str, :to_s unless method_defined?(:to_str)
7 | end
8 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | colorize (0.7.7)
5 | dnssd (3.0.1)
6 | plist (3.1.0)
7 |
8 | PLATFORMS
9 | ruby
10 |
11 | DEPENDENCIES
12 | colorize
13 | dnssd
14 | plist
15 |
16 | BUNDLED WITH
17 | 1.10.6
18 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/handler/help.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Handler
3 | class Help < Base
4 | command def help
5 | Handler.commands.each do |command|
6 | puts "brew sparkling #{command}"
7 | end
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/fetch.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/homebrew/download'
2 |
3 | module BrewSparkling
4 | module Action
5 | module Install
6 | class Fetch < Base
7 | def call
8 | tarball_path
9 | end
10 | end
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/build.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Install
4 | class Build < Base
5 | def call
6 | logger.start "Build to: #{recipe.archive_path}"
7 | at_build_path { recipe.build }
8 | end
9 | end
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/xcode/accounts.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Xcode
4 | class Accounts < Base
5 | def call
6 | gateway.accounts.each do |account|
7 | puts account.username
8 | end
9 | end
10 | end
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/recipe/search.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Recipe
4 | class Search < Base
5 | def call(name)
6 | recipes.each do |recipe|
7 | puts recipe if recipe.name =~ /#{name}/
8 | end
9 | end
10 | end
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/xcode/base.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Xcode
4 | class Base
5 | private
6 |
7 | def user
8 | @user ||= User.new
9 | end
10 |
11 | def gateway
12 | user.gateway
13 | end
14 | end
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/xcode/discover.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Xcode
4 | class Discover < Base
5 | def call
6 | Gateway::Xcode.availables do |host, port|
7 | puts "http://#{host}::#{port}"
8 | end
9 | end
10 | end
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/commented.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/xcode/certificates.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Xcode
4 | class Certificates < Base
5 | def call
6 | gateway.certificates.each do |certificate|
7 | puts certificate.commonName
8 | end
9 | end
10 | end
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/lib/brew-sparkling-cmd.rb:
--------------------------------------------------------------------------------
1 | require 'pathname'
2 | require 'net/http'
3 |
4 | # setup path
5 | cwd = File.expand_path('..', Pathname.new(__FILE__).realpath)
6 | $LOAD_PATH.unshift(cwd)
7 | Gem.path << cwd + "/../gems/ruby/2.0.0"
8 |
9 | # run cli
10 | require 'brew_sparkling/cli'
11 | BrewSparkling::Cli.new(ARGV).call
12 |
13 | # bye bye
14 | exit 0
15 |
--------------------------------------------------------------------------------
/recipe/SparklingSample.rb:
--------------------------------------------------------------------------------
1 | class SparklingSample < BrewSparkling::Recipe::Builder
2 | github 'codefirst/SparklingSample', branch: '1.0.3'
3 | description 'sample for Sparkling'
4 | version '1.0.3'
5 | bundle_identifier 'org.codefirst.SparklingSample'
6 |
7 | def build
8 | xcodebuild_archive(scheme: 'SparklingSample')
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/recipe/base.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/recipe/recipes'
2 |
3 | module BrewSparkling
4 | module Action
5 | module Recipe
6 | class Base
7 | private
8 |
9 | def recipes
10 | @recipes ||= ::BrewSparkling::Recipe::Recipes.default
11 | end
12 | end
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/query_record.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 | trap 'INT' do exit end
5 | trap 'TERM' do exit end
6 |
7 | query = DNSSD::Service.new
8 |
9 | abort "#{$0} fullname" if ARGV.empty?
10 | fullname = ARGV.shift
11 |
12 | query.query_record fullname, DNSSD::Record::SRV do |record|
13 | puts record
14 | end
15 |
16 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/location.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Location
3 | class << self
4 | def sparkling_path
5 | Pathname('/usr/local/BrewSparkling/')
6 | end
7 |
8 | def build_path
9 | sparkling_path.join('build')
10 | end
11 |
12 | def archive_path
13 | sparkling_path.join('archive')
14 | end
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/colorize-0.7.7/lib/colorize.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('colorize/class_methods', File.dirname(__FILE__))
2 | require File.expand_path('colorize/instance_methods', File.dirname(__FILE__))
3 | #
4 | # Colorize String class extension.
5 | #
6 | class String
7 | extend Colorize::ClassMethods
8 | include Colorize::InstanceMethods
9 |
10 | color_methods
11 | modes_methods
12 | end
13 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/handler/base.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Handler
3 | class Base
4 | class << self
5 | def command(*names)
6 | names.each do |name|
7 | ::BrewSparkling::Handler.register name, self
8 | end
9 | end
10 | end
11 |
12 | attr_reader :args
13 | def initialize(args)
14 | @args = args
15 | end
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/exceptions.rb:
--------------------------------------------------------------------------------
1 | module Hbc; end
2 |
3 | # raised by safe_system in utils.rb
4 | class Hbc::ErrorDuringExecution < RuntimeError
5 | def initialize(cmd, args=[])
6 | args = args.map { |a| a.to_s.gsub " ", "\\ " }.join(" ")
7 | super "Failure while executing: #{cmd} #{args}"
8 | end
9 | end
10 |
11 | # raised in Hbc::HbCurlDownloadStrategy.fetch
12 | class Hbc::CurlDownloadStrategyError < RuntimeError; end
13 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/test_empty_key.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | key
6 |
7 |
8 | 1
9 | subkey
10 | 2
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/enumerate_domains.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 |
5 | domains = []
6 |
7 | enumerator = DNSSD.enumerate_domains do |reply|
8 | domains << reply.domain
9 | next if reply.flags.more_coming?
10 |
11 | puts "Found domains:\n#{domains.join "\n"}"
12 | exit
13 | end
14 |
15 | trap 'INT' do enumerator.stop; exit end
16 | trap 'TERM' do enumerator.stop; exit end
17 |
18 | sleep
19 |
20 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/recipe/extension/info.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Recipe
3 | module Extension
4 | module Info
5 | def short_description
6 | if respond_to? :description
7 | description.lines.first
8 | else
9 | ''
10 | end
11 | end
12 |
13 | def to_s
14 | "#{name} - #{short_description}"
15 | end
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/xcode/devices.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Xcode
4 | class Devices < Base
5 | def call
6 | devices = gateway.devices
7 |
8 | if devices.empty?
9 | puts 'No deviecs'
10 | else
11 | devices.each do |device|
12 | puts "#{device.name}"
13 | end
14 | end
15 | end
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/growl.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 |
5 | browser = DNSSD.browse '_growl._tcp' do |b|
6 | DNSSD.resolve b.name, b.type, b.domain do |r|
7 | puts "#{b.name} of #{b.type} in #{b.domain} => #{r.target}:#{r.port} on #{b.interface} txt #{r.text_record.inspect}"
8 | break
9 | end
10 | end
11 |
12 | trap 'INT' do browser.stop; exit end
13 | trap 'TERM' do browser.stop; exit end
14 |
15 | sleep
16 |
17 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/homebrew/download.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/homebrew/adapter'
2 |
3 | module BrewSparkling
4 | module Homebrew
5 | class Download
6 | attr_reader :strategy
7 |
8 | def initialize(recipe)
9 | @strategy = Hbc::CurlDownloadStrategy.new(recipe)
10 | end
11 |
12 | def call
13 | tarball
14 | end
15 |
16 | def tarball
17 | @tarball ||= strategy.fetch
18 | end
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/logger.rb:
--------------------------------------------------------------------------------
1 | require 'colorize'
2 |
3 | module BrewSparkling
4 | class Logger
5 | class << self
6 | def default
7 | @logger ||= new
8 | end
9 | end
10 |
11 | def start(message)
12 | puts "==> #{message}".colorize(:blue)
13 | end
14 |
15 | def error(message)
16 | puts message.colorize(:red)
17 | end
18 |
19 | def info(message)
20 | puts message.colorize(:green)
21 | end
22 | end
23 | end
24 |
25 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/lib/plist.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | #
3 | # = plist
4 | #
5 | # This is the main file for plist. Everything interesting happens in
6 | # Plist and Plist::Emit.
7 | #
8 | # Copyright 2006-2010 Ben Bleything and Patrick May
9 | # Distributed under the MIT License
10 | #
11 |
12 | require 'base64'
13 | require 'cgi'
14 | require 'stringio'
15 |
16 | require 'plist/generator'
17 | require 'plist/parser'
18 |
19 | module Plist
20 | VERSION = '3.1.0'
21 | end
22 |
--------------------------------------------------------------------------------
/recipe/Shinchoku.rb:
--------------------------------------------------------------------------------
1 | class Shinchoku < BrewSparkling::Recipe::Builder
2 | github 'mzp/Shinchoku', branch: '1.0'
3 | description 'ask shinchou once a hour'
4 | version '1.0'
5 | bundle_identifiers %w(jp.mzp.Shinchoku jp.mzp.Shinchoku.watchkitapp jp.mzp.Shinchoku.watchkitapp.watchkitextension)
6 |
7 | def build
8 | if ENV['SHINCHOKU_IMAGE']
9 | system './make_app_icon.sh', ENV['SHINCHOKU_IMAGE']
10 | end
11 |
12 | xcodebuild_archive(scheme: 'Shinchoku')
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/handler/recipe.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/action/recipe/base'
2 | require 'brew_sparkling/action/recipe/search'
3 |
4 | module BrewSparkling
5 | module Handler
6 | class Recipe < Base
7 | command :search, :list
8 |
9 | def search
10 | args.each do |name|
11 | Action::Recipe::Search.new.call(name)
12 | end
13 | end
14 |
15 | def list
16 | Action::Recipe::Search.new.call('')
17 | end
18 | end
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/testing_env.rb:
--------------------------------------------------------------------------------
1 | # Require this file to build a testing environment.
2 |
3 | require 'vendor/homebrew-fork/monkeypatch_pathname'
4 | require 'vendor/homebrew-fork/utils'
5 | require 'tmpdir'
6 |
7 | TEST_TMPDIR = Dir.mktmpdir("homebrew_tests")
8 | at_exit { FileUtils.remove_entry(TEST_TMPDIR) }
9 |
10 | # Constants normally defined in global.rb
11 | HOMEBREW_CACHE = Pathname.new(TEST_TMPDIR).join('cache')
12 | HOMEBREW_USER_AGENT = 'Homebrew'
13 | HOMEBREW_CURL_ARGS = '-fsLA'
14 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply/domain.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Returned by DNSSD::Service#enumerate_domains
3 |
4 | class DNSSD::Reply::Domain < DNSSD::Reply
5 |
6 | ##
7 | # A domain for registration or browsing
8 |
9 | attr_reader :domain
10 |
11 | ##
12 | # Creates a new Browse, called internally by
13 | # DNSSD::Service#enumerate_domains
14 |
15 | def initialize(service, flags, interface, domain)
16 | super service, flags, interface
17 |
18 | @domain = domain
19 | end
20 |
21 | end
22 |
23 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/socket.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 | trap 'INT' do exit end
5 | trap 'TERM' do exit end
6 |
7 | puts 'run sample/server.rb'
8 |
9 | service = nil
10 |
11 | DNSSD.browse! '_blackjack._tcp', 'local.' do |reply|
12 | service = reply
13 | break
14 | end
15 |
16 | puts "found service #{service.name}"
17 |
18 | socket = service.connect
19 |
20 | puts "Connected to %s:%d" % socket.peeraddr.values_at(2, 1)
21 | puts " from %s:%d" % socket.addr.values_at(2, 1)
22 |
23 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/request_provisioning.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Install
4 | class RequestProvisioning < Base
5 | def call
6 | logger.start "Request provisioning"
7 | recipe.bundle_identifiers.each do |id|
8 | bundle_id = "#{user.prefix}.#{id}"
9 | logger.info bundle_id
10 | user.gateway.request_provisioning(user.account, user.certificate, user.device, bundle_id)
11 | end
12 | end
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/patch.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Install
4 | class Patch < Base
5 | def call
6 | return unless recipe.respond_to?(:patch)
7 |
8 | logger.start "Patch to: #{recipe.build_path}"
9 |
10 | at_build_path do
11 | IO.popen('patch -p1 -l', 'r+') do |io|
12 | io.puts recipe.patch
13 | io.close_write
14 | logger.info io.read
15 | end
16 | end
17 | end
18 | end
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/cli.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/handler'
2 |
3 | module BrewSparkling
4 | class Cli
5 | attr_reader :args
6 |
7 | def initialize(argv)
8 | @command, *@args = *argv
9 | end
10 |
11 | def call
12 | unless Handler.exist? command_name
13 | STDERR.puts "unknown command: #{command_name}"
14 | # TODO: show help
15 | return
16 | end
17 |
18 | Handler.invoke command_name, args
19 | end
20 |
21 | private
22 |
23 | def command_name
24 | @command.to_sym
25 | end
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/server.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 |
5 | port = Socket.getservbyname 'blackjack'
6 | blackjack = TCPServer.new nil, port
7 |
8 | DNSSD.announce blackjack, 'blackjack server'
9 |
10 | trap 'INT' do exit; end
11 | trap 'TERM' do exit; end
12 |
13 | puts "Running 'blackjack server' on port %d" % blackjack.addr[1]
14 | puts 'Now run sample/socket.rb'
15 |
16 | loop do
17 | socket = blackjack.accept
18 | peeraddr = socket.peeraddr
19 | puts "Connection from %s:%d" % socket.peeraddr.values_at(2, 1)
20 | end
21 |
22 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/install_app.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Action
3 | module Install
4 | class InstallApp < Base
5 | def call
6 | logger.start "Installing app"
7 | if install_app
8 | logger.info "⚡️ #{recipe.name} is installed"
9 | else
10 | logger.error "🙅 #{recipe.name} install is failed"
11 | end
12 | end
13 |
14 | private
15 |
16 | def install_app
17 | system 'mobiledevice', 'install_app', recipe.app_path
18 | end
19 | end
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/getaddrinfo.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 |
5 | abort "#{$0} \"http service name\"" if ARGV.empty?
6 |
7 | resolver = DNSSD.resolve ARGV.shift, '_http._tcp', 'local' do |reply|
8 | addresses = []
9 |
10 | service = DNSSD::Service.new
11 |
12 | service.getaddrinfo reply.target do |addrinfo|
13 | addresses << addrinfo.address
14 | break unless addrinfo.flags.more_coming?
15 | end
16 |
17 | puts "Addresses for #{reply.target}:\n#{addresses.join "\n"}"
18 | exit
19 | end
20 |
21 | trap 'INT' do resolver.stop; exit end
22 | trap 'TERM' do resolver.stop; exit end
23 |
24 | sleep
25 |
26 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/unpack.rb:
--------------------------------------------------------------------------------
1 | require 'tmpdir'
2 |
3 | module BrewSparkling
4 | module Action
5 | module Install
6 | class Unpack < Base
7 | def call
8 | # snip from homebrew-cask
9 | logger.start "Unpackking #{tarball_path.basename} to: #{recipe.build_path}"
10 |
11 | # cleanup
12 | recipe.build_path.rmtree rescue nil
13 |
14 | # unpack
15 | Dir.mktmpdir do |unpack_dir|
16 | system('/usr/bin/tar', 'xf', tarball_path, '-C', unpack_dir)
17 | system('/usr/bin/ditto', '--', unpack_dir, recipe.build_path)
18 | end
19 | end
20 | end
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/handler.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Handler
3 | class << self
4 | def register(name, klass)
5 | @@command ||= {}
6 | @@command[name] = klass
7 | end
8 |
9 | def invoke(name, args)
10 | command = @@command[name].new(args)
11 | command.send name
12 | end
13 |
14 | def exist?(name)
15 | @@command.key? name
16 | end
17 |
18 | def commands
19 | @@command.keys.sort
20 | end
21 | end
22 | end
23 | end
24 |
25 | require 'brew_sparkling/handler/base'
26 | require 'brew_sparkling/handler/help'
27 | require 'brew_sparkling/handler/xcode'
28 | require 'brew_sparkling/handler/install'
29 | require 'brew_sparkling/handler/recipe'
30 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/browse.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 | trap 'INT' do exit end
5 | trap 'TERM' do exit end
6 |
7 | browser = DNSSD::Service.new
8 | services = {}
9 |
10 | puts "Browsing for TCP blackjack service"
11 | puts "(run sample/register.rb)"
12 | puts
13 |
14 | browser.browse '_blackjack._tcp' do |reply|
15 | services[reply.fullname] = reply
16 | next if reply.flags.more_coming?
17 |
18 | services.sort_by do |_, service|
19 | [(service.flags.add? ? 0 : 1), service.fullname]
20 | end.each do |_, service|
21 | add = service.flags.add? ? 'Add' : 'Remove'
22 | puts "#{add} #{service.name} on #{service.domain}"
23 | end
24 |
25 | services.clear
26 |
27 | puts
28 | end
29 |
30 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/.autotest:
--------------------------------------------------------------------------------
1 | require 'autotest/restart'
2 | begin
3 | require 'autotest/fsevent'
4 | rescue LoadError
5 | end
6 |
7 | Autotest.add_hook :initialize do |at|
8 | at.testlib = 'minitest/unit'
9 |
10 | def at.path_to_classname(s)
11 | sep = File::SEPARATOR
12 | f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
13 | f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
14 | f = f.map { |path| path =~ /^Test/ ? path : "Test#{path}" }
15 | f.join('::').sub 'Dnssd', 'DNSSD'
16 | end
17 | end
18 |
19 | Autotest.add_hook :run_command do |at|
20 | at.unit_diff = 'cat'
21 |
22 | if ENV['ONENINE']
23 | system "rake1.9 compile"
24 | else
25 | system "rake compile"
26 | end
27 | end
28 |
29 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/specifications/plist-3.1.0.gemspec:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 |
3 | Gem::Specification.new do |s|
4 | s.name = "plist"
5 | s.version = "3.1.0"
6 |
7 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8 | s.authors = ["Ben Bleything and Patrick May"]
9 | s.autorequire = "plist"
10 | s.date = "2010-02-23"
11 | s.description = "Plist is a library to manipulate Property List files, also known as plists. It can parse plist files into native Ruby data structures as well as generating new plist files from your Ruby objects.\n"
12 | s.homepage = "http://plist.rubyforge.org"
13 | s.require_paths = ["lib"]
14 | s.rubyforge_project = "plist"
15 | s.rubygems_version = "2.0.14"
16 | s.summary = "All-purpose Property List manipulation library."
17 | end
18 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/Rakefile:
--------------------------------------------------------------------------------
1 | # -*- ruby -*-
2 |
3 | require 'rubygems'
4 | require 'hoe'
5 |
6 | Hoe.plugin :minitest
7 | Hoe.plugin :email
8 | Hoe.plugin :git
9 | Hoe.plugin :compiler
10 |
11 | HOE = Hoe.spec 'dnssd' do
12 | developer 'Eric Hodel', 'drbrain@segment.net'
13 | developer 'Aaron Patterson', 'aaron.patterson@gmail.com'
14 | developer 'Phil Hagelberg', 'phil@hagelb.org'
15 | developer 'Chad Fowler', 'chad@chadfowler.com'
16 | developer 'Charles Mills', ''
17 | developer 'Rich Kilmer', ''
18 |
19 | rdoc_locations << 'docs.seattlerb.org:/data/www/docs.seattlerb.org/dnssd/'
20 |
21 | clean_globs << 'lib/dnssd/*.{so,bundle,dll}'
22 |
23 | self.spec_extras = {
24 | :extensions => ["ext/dnssd/extconf.rb"],
25 | :required_ruby_version => '>= 2.0.0'
26 | }
27 | end
28 |
29 | # vim: syntax=Ruby
30 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/register.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 | trap 'INT' do exit end
5 | trap 'TERM' do exit end
6 |
7 | puts "Registering some blackjack services"
8 | puts "(run sample/browse.rb or sample/resolve.rb)"
9 | puts
10 |
11 | DNSSD.register 'blockless', '_blackjack._tcp', nil, 1025
12 | puts "registered blockless (no callback)"
13 |
14 | DNSSD.register 'block', '_blackjack._tcp', nil, 1026 do |r|
15 | puts "registered #{r.fullname}" if r.flags.add?
16 | end
17 |
18 | registrar = DNSSD::Service.new
19 |
20 | service = nil
21 |
22 | tr = DNSSD::TextRecord.new
23 | tr['foo'] = 'bar'
24 | registrar.register 'add_record', '_blackjack._tcp', nil, 1027, nil, tr do |r|
25 | puts "registered #{r.fullname}" if r.flags.add?
26 | record = registrar.add_record DNSSD::Record::RP, 'nobody.local. .'
27 | puts "added RP record"
28 | end
29 |
30 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply/register.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Returned by DNSSD::Service#register
3 |
4 | class DNSSD::Reply::Register < DNSSD::Reply
5 |
6 | ##
7 | # A domain for registration or browsing
8 |
9 | attr_reader :domain
10 |
11 | ##
12 | # The service name
13 |
14 | attr_reader :name
15 |
16 | ##
17 | # The service type
18 |
19 | attr_reader :type
20 |
21 | ##
22 | # Creates a Register, called internally by DNSSD::Service#register
23 |
24 | def initialize(service, flags, name, type, domain)
25 | super service, flags, nil
26 |
27 | set_names name, type, domain
28 | end
29 |
30 | def resolve
31 | service = DNSSD::Service.resolve name, type, domain
32 | service.first
33 | end
34 |
35 | def inspect # :nodoc:
36 | "#<%s:0x%x %p flags: %p>" % [
37 | self.class, object_id, fullname, @flags
38 | ]
39 | end
40 |
41 | end
42 |
43 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/resolve.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 | trap 'INT' do exit end
5 | trap 'TERM' do exit end
6 |
7 | puts "Resolving TCP blackjack services"
8 | puts "(run sample/register.rb)"
9 | puts
10 |
11 | browser = DNSSD::Service.new
12 | services = {}
13 |
14 | browser.browse '_blackjack._tcp' do |reply|
15 | services[reply.fullname] = reply
16 | next if reply.flags.more_coming?
17 |
18 | services.sort_by do |_, service|
19 | [(service.flags.add? ? 0 : 1), service.fullname]
20 | end.each do |_, service|
21 | next unless service.flags.add?
22 |
23 | DNSSD::Service.new.resolve service do |r|
24 | puts "#{r.name} on #{r.target}:#{r.port}"
25 | puts "\t#{r.text_record.inspect}" unless r.text_record.empty?
26 | break unless r.flags.more_coming?
27 | end
28 | end
29 |
30 | services.clear
31 |
32 | puts
33 | end
34 |
35 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/handler/xcode.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/action/xcode/base'
2 | require 'brew_sparkling/action/xcode/discover'
3 | require 'brew_sparkling/action/xcode/devices'
4 | require 'brew_sparkling/action/xcode/accounts'
5 | require 'brew_sparkling/action/xcode/certificates'
6 |
7 | # Show xcode info
8 | module BrewSparkling
9 | module Handler
10 | # show xcode info
11 | class Xcode < Base
12 | command :devices, :discover, :accounts, :certificates
13 |
14 | def discover
15 | Action::Xcode::Discover.new.call
16 | end
17 |
18 | def devices
19 | Action::Xcode::Devices.new.call
20 | end
21 |
22 | def accounts
23 | Action::Xcode::Accounts.new.call
24 | end
25 |
26 | def certificates
27 | Action::Xcode::Certificates.new.call
28 | end
29 |
30 | def gateway
31 | Gateway::Xcode.default
32 | end
33 | end
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/sample/resolve_ichat.rb:
--------------------------------------------------------------------------------
1 | require 'dnssd'
2 |
3 | Thread.abort_on_exception = true
4 | trap 'INT' do exit end
5 | trap 'TERM' do exit end
6 |
7 | class ChatNameResolver
8 | def self.resolve_add(reply)
9 | Thread.new reply do |reply|
10 | DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply|
11 | puts "Adding: #{resolve_reply.inspect}"
12 | break
13 | end
14 | end
15 | end
16 | def self.resolve_remove(reply)
17 | Thread.new reply do |reply|
18 | DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply|
19 | puts "Removing: #{resolve_reply.inspect}"
20 | break
21 | end
22 | end
23 | end
24 | end
25 |
26 | DNSSD.browse '_presence._tcp' do |reply|
27 | if reply.flags.add? then
28 | ChatNameResolver.resolve_add reply
29 | else
30 | ChatNameResolver.resolve_remove reply
31 | end
32 | end
33 |
34 | sleep
35 |
36 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply/addr_info.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Created by DNSSD::Service#getaddrinfo
3 |
4 | class DNSSD::Reply::AddrInfo < DNSSD::Reply
5 |
6 | ##
7 | # IP address of host
8 |
9 | attr_reader :address
10 |
11 | ##
12 | # Host name
13 |
14 | attr_reader :hostname
15 |
16 | ##
17 | # Port name
18 |
19 | attr_reader :port
20 |
21 | ##
22 | # Time to live see #expired?
23 |
24 | attr_reader :ttl
25 |
26 | ##
27 | # Creates a new AddrInfo, called internally by DNSSD::Service#getaddrinfo
28 |
29 | def initialize(service, flags, interface, hostname, sockaddr, ttl)
30 | super service, flags, interface
31 |
32 | @hostname = hostname
33 | @port, @address = Socket.unpack_sockaddr_in sockaddr
34 |
35 | @created = Time.now
36 | @ttl = ttl
37 | end
38 |
39 | ##
40 | # Has this AddrInfo passed its TTL?
41 |
42 | def expired?
43 | Time.now > @created + ttl
44 | end
45 |
46 | end
47 |
48 |
--------------------------------------------------------------------------------
/brew-sparkling.rb:
--------------------------------------------------------------------------------
1 | class BrewSparkling < Formula
2 | homepage "https://github.com/codefirst/homebrew-sparkling/"
3 | url "https://github.com/codefirst/homebrew-sparkling.git", tag: "v0.1.0"
4 | head "https://github.com/codefirst/homebrew-sparkling.git", branch: "master"
5 |
6 | skip_clean "bin"
7 |
8 | depends_on "mobiledevice" => :build
9 | depends_on "cocoapods" => :ruby
10 |
11 | # save home path
12 | @@home = Pathname(ENV['HOME'])
13 |
14 | def install
15 | # install xcode plugin
16 | plugin.join('SparklingHelper.xcplugin').rmtree rescue nil
17 | plugin.install 'plugin/SparklingHelper.xcplugin'
18 |
19 | # install sparkling command
20 | prefix.install 'bin', 'recipe', 'lib', 'gems'
21 | (bin+"brew-sparkling").chmod 0755
22 | end
23 |
24 | def home
25 | @@home
26 | end
27 |
28 | def plugin
29 | @plugin ||= home.join('Library', 'Application Support', 'Developer', 'Shared', 'Xcode', 'Plug-ins')
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/global.rb:
--------------------------------------------------------------------------------
1 | require 'vendor/homebrew-fork/monkeypatch_pathname'
2 | require 'vendor/homebrew-fork/exceptions'
3 | require 'vendor/homebrew-fork/utils'
4 |
5 | def cache
6 | if ENV['HOMEBREW_CACHE']
7 | Pathname.new(ENV['HOMEBREW_CACHE'])
8 | else
9 | # we do this for historic reasons, however the cache *should* be the same
10 | # directory whichever user is used and whatever instance of brew is executed
11 | home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path
12 | if home_cache.directory? and home_cache.writable_real?
13 | home_cache
14 | else
15 | Pathname.new("/Library/Caches/Homebrew").extend Module.new {
16 | def mkpath
17 | unless exist?
18 | super
19 | chmod 0775
20 | end
21 | end
22 | }
23 | end
24 | end
25 | end
26 |
27 | HOMEBREW_CACHE = cache
28 | undef cache
29 |
30 | HOMEBREW_USER_AGENT = "Homebrew-cask v0.51+ (Ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL})"
31 | HOMEBREW_CURL_ARGS = '-f#LA'
32 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/test_data_elements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | stringio
6 | dGhpcyBpcyBhIHN0cmluZ2lvIG9iamVjdA==
7 |
8 | file
9 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
10 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
11 | AAAAAAAAAAAAAA==
12 |
13 | io
14 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
15 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
16 | AAAAAAAAAAAAAA==
17 |
18 | marshal
19 |
20 | BAhvOhZNYXJzaGFsYWJsZU9iamVjdAY6CUBmb28iHnRoaXMgb2JqZWN0IHdh
21 | cyBtYXJzaGFsZWQ=
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/dnssd.h:
--------------------------------------------------------------------------------
1 | #ifndef RDNSSD_INCLUDED
2 | #define RDNSSD_INCLUDED
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include /* htons ntohs */
9 | #include /* struct sockaddr_in */
10 | #include /* getservbyport */
11 |
12 | /* if_indextoname and if_nametoindex */
13 | #ifdef HAVE_IPHLPAPI_H
14 | #include /* Vista and newer */
15 | #else
16 | #include
17 | #include
18 | #endif
19 |
20 | #ifdef HAVE_ST_SIN_LEN
21 | #define SIN_LEN(si) (si)->sin_len
22 | #else
23 | #define SIN_LEN(si) sizeof(struct sockaddr_in)
24 | #endif
25 |
26 | #include
27 | #define dnssd_utf8_cstr(str, to) \
28 | do {\
29 | VALUE utf8;\
30 | utf8 = rb_str_encode(str, rb_enc_from_encoding(rb_utf8_encoding()),\
31 | 0, Qnil);\
32 | to = StringValueCStr(utf8);\
33 | } while (0)
34 |
35 | extern VALUE eDNSSDError;
36 |
37 | void dnssd_check_error_code(DNSServiceErrorType e);
38 |
39 | #endif /* RDNSSD_INCLUDED */
40 |
41 |
--------------------------------------------------------------------------------
/recipe/Provenance.rb:
--------------------------------------------------------------------------------
1 | class Provenance < BrewSparkling::Recipe::Builder
2 | github 'jasarien/Provenance', branch: '1.1.5'
3 | description < 10.0'
18 | s.add_development_dependency 'minitest', '~> 5.0'
19 | s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
20 |
21 | s.files = [
22 | 'LICENSE',
23 | 'CHANGELOG',
24 | 'README.md',
25 | 'Rakefile',
26 | 'colorize.gemspec',
27 | 'lib/colorize.rb',
28 | 'lib/colorize/class_methods.rb',
29 | 'lib/colorize/instance_methods.rb',
30 | 'test/test_colorize.rb',
31 | ]
32 | s.test_files = [
33 | 'test/test_colorize.rb'
34 | ]
35 | end
36 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006-2010, Ben Bleything and Patrick May
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 included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
15 | KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
16 | WARRANTIES OF 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.
21 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/colorize-0.7.7/CHANGELOG:
--------------------------------------------------------------------------------
1 | == 0.7.7 / 2015-04-19
2 | * update gems
3 |
4 | == 0.7.6 / 2015-04-18
5 | * fix bugs
6 |
7 | == 0.7.5 / 2014-12-11
8 | * big code refactoring
9 | * disable_colorization feature added
10 |
11 | == 0.7.4 / 2014-12-10
12 | * code cleanups
13 |
14 | == 0.7.3 / 2014-05-19
15 | * fix new line maching
16 |
17 | == 0.7.2 / 2014-04-08
18 | * tests cleanups
19 | * gem release date fixed
20 |
21 | == 0.7.1 / 2014-04-02
22 | * handling wrong color values
23 |
24 | == 0.7.0 / 2014-03-12
25 | * refactored to use regexp pattern matching
26 | * works with frozen strings
27 | * works with concatenated string
28 |
29 | == 0.6.0 / 2013-09-25
30 | * code cleanups
31 | * bold mode fixed
32 | * STDOUT.isatty condition removed
33 | * doc updated
34 | * jeweler tasks removed
35 | * Rakefile updated
36 |
37 | == 0.5.8 / 2009-12-02
38 | * code cleanups
39 | * removed 'ruby -w' warnings
40 |
41 | == 0.5.7 / 2009-11-24
42 | * moved to github/gemcutter
43 | * 1.9 compatible
44 |
45 | == 0.5.6 / 2007-08-27
46 | * rdocs Allison template
47 | * cleanups
48 |
49 | == 0.5.5 / 2007-08-11
50 | * added effects methods
51 | * README files
52 | * new rake file
53 |
54 | == 0.5.0 / 2007-04-22
55 | * initial rewritten version
56 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply/browse.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Returned by DNSSD::Service#browse
3 |
4 | class DNSSD::Reply::Browse < DNSSD::Reply
5 |
6 | ##
7 | # A domain for registration or browsing
8 |
9 | attr_reader :domain
10 |
11 | ##
12 | # The service name
13 |
14 | attr_reader :name
15 |
16 | ##
17 | # The service type
18 |
19 | attr_reader :type
20 |
21 | ##
22 | # Creates a new Browse, called internally by DNSSD::Service#browse
23 |
24 | def initialize(service, flags, interface, name, type, domain)
25 | super service, flags, interface
26 |
27 | set_names name, type, domain
28 | end
29 |
30 | ##
31 | # Resolves this service's target using DNSSD::Reply::Resolve#connect which
32 | # connects, returning a TCP or UDP socket.
33 |
34 | def connect(family = Socket::AF_UNSPEC, addrinfo_flags = 0)
35 | value = nil
36 |
37 | DNSSD.resolve! name, type, domain do |reply|
38 | value = reply
39 | break
40 | end
41 |
42 | value.connect family, addrinfo_flags
43 | end
44 |
45 | def resolve
46 | service = DNSSD::Service.resolve name, type, domain
47 | service.first
48 | end
49 |
50 | def inspect # :nodoc:
51 | "#<%s:0x%x %p interface: %s flags: %p>" % [
52 | self.class, object_id, fullname, interface_name, @flags
53 | ]
54 | end
55 | end
56 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2009-2014 Max Howell and other contributors.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions
5 | are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | 2. Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/base.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/user'
2 | require 'brew_sparkling/recipe/recipes'
3 |
4 | module BrewSparkling
5 | module Action
6 | module Install
7 | class Base
8 | attr_reader :name
9 | def initialize(name)
10 | @name = name
11 | end
12 |
13 | def logger
14 | @logger ||= Logger.default
15 | end
16 |
17 | def recipe
18 | recipes.find { |recipe| recipe.name == name }.tap do |recipe|
19 | unless recipe
20 | logger.error "cannot find: #{name}"
21 | exit 1
22 | end
23 | end
24 | end
25 |
26 | def user
27 | User.default
28 | end
29 |
30 | def recipes
31 | @@recipes ||= BrewSparkling::Recipe::Recipes.default
32 | end
33 |
34 | def tarball_path
35 | @tarball_path ||= Homebrew::Download.new(recipe).call
36 | end
37 |
38 | def at_build_path(&f)
39 | subdir = recipe.build_path.children
40 |
41 | case subdir.size
42 | when 0
43 | fail 'Empty Archive'
44 | when 1
45 | Dir.chdir(subdir.first, &f)
46 | else
47 | Dir.chdir(recipe.build_path, &f)
48 | end
49 | end
50 | end
51 | end
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/utils.rb:
--------------------------------------------------------------------------------
1 | require 'pathname'
2 | require 'vendor/homebrew-fork/exceptions'
3 |
4 | def homebrew_fork_system cmd, *args
5 | puts "#{cmd} #{args*' '}" if Hbc.verbose
6 | pid = fork do
7 | yield if block_given?
8 | args.collect!{|arg| arg.to_s}
9 | exec(cmd, *args) rescue nil
10 | exit! 1 # never gets here unless exec failed
11 | end
12 | Process.wait(pid)
13 | $?.success?
14 | end
15 |
16 | # Kernel.system but with exceptions
17 | def safe_system cmd, *args
18 | homebrew_fork_system(cmd, *args) or raise Hbc::ErrorDuringExecution.new(cmd, args)
19 | end
20 |
21 | # prints no output
22 | def quiet_system cmd, *args
23 | homebrew_fork_system(cmd, *args) do
24 | # Redirect output streams to `/dev/null` instead of closing as some programs
25 | # will fail to execute if they can't write to an open stream.
26 | $stdout.reopen('/dev/null')
27 | $stderr.reopen('/dev/null')
28 | end
29 | end
30 |
31 | def curl *args
32 | curl = Pathname.new '/usr/bin/curl'
33 | raise "#{curl} is not executable" unless curl.exist? and curl.executable?
34 |
35 | flags = HOMEBREW_CURL_ARGS
36 | flags = flags.delete("#") if Hbc.verbose
37 |
38 | args = [flags, HOMEBREW_USER_AGENT, *args]
39 | args << "--verbose" if ENV['HOMEBREW_CURL_VERBOSE']
40 | args << "--silent" unless $stdout.tty?
41 |
42 | safe_system curl, *args
43 | end
44 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/recipe/extension/path.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/location'
2 |
3 | module BrewSparkling
4 | module Recipe
5 | module Extension
6 | module Path
7 | def build_path
8 | Location.build_path.join(name, version)
9 | end
10 |
11 | def archive_path
12 | Location.archive_path.join(name, version)
13 | end
14 |
15 | def info_plists
16 | xs = []
17 | traversal build_path do |entry|
18 | xs << entry if plist?(entry)
19 | end
20 | xs
21 | end
22 |
23 | def app_path
24 | Location.archive_path.join(name, "#{version}.xcarchive", 'Products', 'Applications', app_name)
25 | end
26 |
27 | def app_name
28 | if respond_to? :executable_name
29 | executable_name
30 | else
31 | "#{name}.app"
32 | end
33 | end
34 |
35 | private
36 |
37 | def traversal(path, &f)
38 | directories = [ path ]
39 |
40 | until directories.empty? do
41 | d = directories.shift
42 | d.each_child do |entry|
43 | if entry.directory?
44 | directories << entry
45 | else
46 | f.call entry
47 | end
48 | end
49 | end
50 | end
51 | end
52 | end
53 | end
54 | end
55 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/test_generator.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'test/unit'
4 | require 'plist'
5 |
6 | class SerializableObject
7 | attr_accessor :foo
8 |
9 | def initialize(str)
10 | @foo = str
11 | end
12 |
13 | def to_plist_node
14 | return "#{CGI::escapeHTML @foo}"
15 | end
16 | end
17 |
18 | class TestGenerator < Test::Unit::TestCase
19 | def test_to_plist_vs_plist_emit_dump_no_envelope
20 | source = [1, :b, true]
21 |
22 | to_plist = source.to_plist(false)
23 | plist_emit_dump = Plist::Emit.dump(source, false)
24 |
25 | assert_equal to_plist, plist_emit_dump
26 | end
27 |
28 | def test_to_plist_vs_plist_emit_dump_with_envelope
29 | source = [1, :b, true]
30 |
31 | to_plist = source.to_plist
32 | plist_emit_dump = Plist::Emit.dump(source)
33 |
34 | assert_equal to_plist, plist_emit_dump
35 | end
36 |
37 | def test_dumping_serializable_object
38 | str = 'this object implements #to_plist_node'
39 | so = SerializableObject.new(str)
40 |
41 | assert_equal "#{str}", Plist::Emit.dump(so, false)
42 | end
43 |
44 | def test_write_plist
45 | data = [1, :two, {:c => 'dee'}]
46 |
47 | data.save_plist('test.plist')
48 | file = File.open('test.plist') {|f| f.read}
49 |
50 | assert_equal file, data.to_plist
51 |
52 | File.unlink('test.plist')
53 | end
54 | end
55 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/recipe/recipes.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/recipe/builder'
2 | require 'brew_sparkling/recipe/extension/path'
3 | require 'brew_sparkling/recipe/extension/build'
4 | require 'brew_sparkling/recipe/extension/info'
5 |
6 | module BrewSparkling
7 | module Recipe
8 | class Recipes
9 | include Enumerable
10 |
11 | class << self
12 | def default
13 | new File.expand_path('../../../../recipe', Pathname.new(__FILE__).realpath)
14 | end
15 | end
16 |
17 | attr_reader :path
18 | def initialize(path)
19 | @path = Pathname.new(path)
20 | end
21 |
22 | def each(&f)
23 | entries.each(&f)
24 | end
25 |
26 | private
27 |
28 | def dsl
29 | @dsl ||= Dsl.new
30 | end
31 |
32 | def entries
33 | @entries ||= begin
34 | paths = path.children
35 | .select { |path| path.basename.fnmatch?('*.rb') }
36 | .each { |path| load path; path }
37 | Builder.all.zip(paths).map do |klass, path|
38 | klass.new(path).tap do |obj|
39 | obj.extend Extension::Path
40 | obj.extend Extension::Build
41 | obj.extend Extension::Info
42 | end
43 | end
44 | end
45 | end
46 | end
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/handler/install.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/action/install/base'
2 | require 'brew_sparkling/action/install/fetch'
3 | require 'brew_sparkling/action/install/unpack'
4 | require 'brew_sparkling/action/install/patch'
5 | require 'brew_sparkling/action/install/build'
6 | require 'brew_sparkling/action/install/install_app'
7 | require 'brew_sparkling/action/install/change_id'
8 | require 'brew_sparkling/action/install/request_provisioning'
9 |
10 | module BrewSparkling
11 | module Handler
12 | class Install < Base
13 | command :install
14 |
15 | def fetch(name)
16 | Action::Install::Fetch.new(name).call
17 | end
18 |
19 | def unpack(name)
20 | Action::Install::Unpack.new(name).call
21 | end
22 |
23 | def build(name)
24 | Action::Install::Build.new(name).call
25 | end
26 |
27 | def install_app(name)
28 | Action::Install::InstallApp.new(name).call
29 | end
30 |
31 | def change_id(name)
32 | Action::Install::ChangeId.new(name).call
33 | end
34 |
35 | def request_provisioning(name)
36 | Action::Install::RequestProvisioning.new(name).call
37 | end
38 |
39 | def install
40 | args.each do |name|
41 | unpack name
42 |
43 | change_id name
44 | request_provisioning name
45 |
46 | Action::Install::Patch.new(name).call
47 | build name
48 |
49 | install_app name
50 | end
51 | end
52 | end
53 | end
54 | end
55 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/specifications/colorize-0.7.7.gemspec:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 |
3 | Gem::Specification.new do |s|
4 | s.name = "colorize"
5 | s.version = "0.7.7"
6 |
7 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8 | s.authors = ["Micha\u{142} Kalbarczyk"]
9 | s.date = "2015-04-19"
10 | s.description = "Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences."
11 | s.email = "fazibear@gmail.com"
12 | s.homepage = "http://github.com/fazibear/colorize"
13 | s.licenses = ["GPL-2"]
14 | s.require_paths = ["lib"]
15 | s.rubygems_version = "2.0.14"
16 | s.summary = "Add color methods to String class"
17 |
18 | if s.respond_to? :specification_version then
19 | s.specification_version = 4
20 |
21 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
22 | s.add_development_dependency(%q, ["~> 10.0"])
23 | s.add_development_dependency(%q, ["~> 5.0"])
24 | s.add_development_dependency(%q, ["~> 0.4"])
25 | else
26 | s.add_dependency(%q, ["~> 10.0"])
27 | s.add_dependency(%q, ["~> 5.0"])
28 | s.add_dependency(%q, ["~> 0.4"])
29 | end
30 | else
31 | s.add_dependency(%q, ["~> 10.0"])
32 | s.add_dependency(%q, ["~> 5.0"])
33 | s.add_dependency(%q, ["~> 0.4"])
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/homebrew/adapter.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/logger'
2 |
3 | # Adapter for homebrew-fork
4 | module Hbc
5 | module SystemCommand
6 | end
7 |
8 | module Utils
9 | # originally from Homebrew
10 | def self.ignore_interrupts(opt = nil)
11 | std_trap = trap('INT') do
12 | puts 'One sec, just cleaning up' unless opt == :quietly
13 | end
14 | yield
15 | ensure
16 | trap('INT', std_trap)
17 | end
18 | end
19 |
20 | def self.verbose
21 | true
22 | end
23 |
24 | class AbstractDownloadStrategy
25 | attr_reader :name, :url, :uri_object, :version
26 |
27 | def ohai(*args)
28 | logger.start args.join(' ')
29 | end
30 |
31 | def initialize(recipe, _ = nil)
32 | @name = recipe.name
33 | @url = recipe.url.to_s
34 | @uri_object = recipe.url
35 | @version = recipe.version
36 | end
37 |
38 | # All download strategies are expected to implement these methods
39 | def fetch; end
40 | def cached_location; end
41 | def clear_cache; end
42 |
43 | def logger
44 | @logger ||= ::BrewSparkling::Logger.default
45 | end
46 | end
47 | end
48 |
49 | require 'vendor/homebrew-fork/exceptions'
50 | require 'vendor/homebrew-fork/global'
51 | require 'vendor/homebrew-fork/download_strategy'
52 |
53 | class Hbc::CurlDownloadStrategy < Hbc::HbCurlDownloadStrategy
54 | def _fetch
55 | curl(*curl_args)
56 | end
57 |
58 | def fetch
59 | super
60 | tarball_path
61 | end
62 |
63 | private
64 |
65 | def curl_args
66 | [url, '-C', downloaded_size, '-o', temporary_path]
67 | end
68 | end
69 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Homebrew sparkling
2 |
3 | `brew sparkling install` to install iOS apps over Lightning.
4 |
5 | ## Features
6 |
7 | * Search sparkling recipe.
8 | * Install iOS app to your device via lingtning cable.
9 | * Manage iOS app installed by brew sparkling. (not yet)
10 |
11 | ## Install
12 |
13 | ```
14 | brew install codefirst/sparkling/brew-sparkling --HEAD
15 | ```
16 |
17 | ## Development
18 |
19 | ### Requirements
20 |
21 | * Xcode 7.0 (7A220)
22 | * [SparklingHelper](https://github.com/codefirst/SparklingHelper)
23 |
24 | ### Build
25 |
26 | ```
27 | bundle
28 | bundle exec ./bin/brew-sparkling help
29 | ```
30 |
31 | ### Usage
32 | #### Show xcode information
33 |
34 | ```sh
35 | # Discover SparklingHelper
36 | brew sparkling discover
37 |
38 | # show all accounts
39 | brew sparkling accounts
40 |
41 | # show all certificates
42 | brew sparkling certificates
43 |
44 | # show all iOS devices
45 | brew sparkling devices
46 | ```
47 |
48 | #### Build iOS App
49 |
50 | ```sh
51 | # install recipe
52 | brew sparkling install
53 | ```
54 |
55 | #### Manage Recipe
56 |
57 | ```sh
58 | # list all recipes
59 | brew sparkling list
60 |
61 | # search recipes
62 | brew sparkling search
63 | ```
64 |
65 | ## Limitations
66 | Because Sparkling uses [free provisioning](https://developer.apple.com/library/prerelease/ios/documentation/IDEs/Conceptual/AppDistributionGuide/LaunchingYourApponDevices/LaunchingYourApponDevices.html#//apple_ref/doc/uid/TP40012582-CH27) to instal app, there are some limitations.
67 |
68 | * Cannot use any capability(e.g. AppGroup, In-App Purchase, ...)
69 | * Reinstall each apps per 3 months.
70 |
71 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/recipe/extension/build.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Recipe
3 | module Extension
4 | module Build
5 | def command(*args)
6 | unless system(*args)
7 | fail "command failed: #{args.join(' ')}"
8 | end
9 | end
10 |
11 | def xcodebuild_archive(workspace: nil, scheme: nil)
12 | extra_args = ""
13 |
14 | if workspace
15 | extra_args << " -workspace '#{workspace}'"
16 | end
17 |
18 | if scheme
19 | extra_args << " -scheme '#{scheme}'"
20 | end
21 |
22 | command "xcodebuild #{extra_args} -archivePath #{archive_path} archive #{xcpretty}"
23 | end
24 |
25 | def bundle(*args)
26 | gem_command 'bundle', gem_name: 'bundle', args: args
27 | end
28 |
29 | def pod(*args)
30 | gem_command 'pod', gem_name: 'cocoapods', args: args
31 | end
32 |
33 | def which?(command)
34 | system("which #{command} > /dev/null 2>&1")
35 | end
36 |
37 | private
38 |
39 | def gem_command(name, gem_name: nil, args: [])
40 | unless which?(name)
41 | fail <<-END
42 | Cannot find command: #{name}
43 | Please install with: gem install #{gem_name}
44 | END
45 | end
46 | command name, *args
47 | end
48 |
49 | def xcpretty
50 | @xcpretty ||= if which?('xcpretty')
51 | '| xcpretty --color'
52 | else
53 | ''
54 | end
55 | end
56 | end
57 | end
58 | end
59 | end
60 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_reply_browse.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDReplyBrowse < DNSSD::Test
4 |
5 | def test_connect
6 | reply = DNSSD::Reply::Browse.new nil, 0, 0, 'blackjack no port',
7 | '_blackjack._tcp', 'local'
8 |
9 | port = stub Socket, :getservbyname, 1025 do
10 | Socket.getservbyname('blackjack')
11 | end
12 |
13 | server = TCPServer.new nil, port
14 | Thread.start do server.accept end
15 |
16 | stub Socket, :getservbyport, "blackjack" do
17 | DNSSD.announce server, 'blackjack no port'
18 | end
19 |
20 | socket = reply.connect
21 |
22 | assert_instance_of TCPSocket, socket
23 | assert_equal port, socket.peeraddr[1]
24 | ensure
25 | socket.close if socket
26 | server.close if server
27 | end
28 |
29 | def test_connect_encoding
30 | skip 'Encoding not defined' unless Object.const_defined? :Encoding
31 |
32 | reply = DNSSD::Reply::Browse.new nil, 0, 0, "\u00E9",
33 | '_blackjack._tcp', 'local'
34 |
35 |
36 | port = stub Socket, :getservbyname, 1025 do
37 | Socket.getservbyname 'blackjack'
38 | end
39 | server = TCPServer.new nil, port
40 | Thread.start do server.accept end
41 |
42 | name = "\u00E9"
43 | name.encode! Encoding::ISO_8859_1
44 |
45 | stub Socket, :getservbyport, 'blackjack' do
46 | DNSSD.announce server, name
47 | end
48 |
49 | socket = reply.connect
50 |
51 | assert_instance_of TCPSocket, socket
52 | assert_equal port, socket.peeraddr[1]
53 | ensure
54 | socket.close if socket
55 | server.close if server
56 | end
57 | end
58 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/recipe/builder.rb:
--------------------------------------------------------------------------------
1 | module BrewSparkling
2 | module Recipe
3 | class Builder
4 | class << self
5 | def inherited(klass)
6 | (@all ||= []) << klass
7 | end
8 |
9 | def all
10 | @all
11 | end
12 |
13 | def github(path, branch: 'master')
14 | url "https://github.com/#{path}/archive/#{branch}.tar.gz"
15 | end
16 |
17 | # simple getter definition
18 | %i(bundle_identifiers url version executable_name description).each do |name|
19 | define_method name do |value|
20 | define_method(name) { value }
21 | end
22 | end
23 |
24 | def patch(value)
25 | if value == :DATA
26 | # read after __END__
27 | define_method(:patch) do
28 | data = ""
29 | path.open("rb") do |f|
30 | begin
31 | line = f.gets
32 | end until line.nil? || /^__END__$/ === line
33 | data << line while line = f.gets
34 | end
35 | data
36 | end
37 | else
38 | # inline string
39 | define_method(:patch) { value }
40 | end
41 | end
42 |
43 | def bundle_identifier(name)
44 | bundle_identifiers [name]
45 | end
46 | end
47 |
48 | attr_reader :path
49 |
50 | def initialize(path)
51 | @path = path
52 | end
53 |
54 | def name
55 | self.class.to_s
56 | end
57 |
58 | def local_file(name)
59 | path.join('..', name).read
60 | end
61 |
62 | def plist?(name)
63 | name.basename.fnmatch? 'Info.plist'
64 | end
65 | end
66 | end
67 | end
68 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_reply_resolve.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDReplyResolve < DNSSD::Test
4 |
5 | def setup
6 | @port = stub Socket, :getservbyname, 1025 do
7 | Socket.getservbyname 'blackjack'
8 | end
9 | @interface = DNSSD::InterfaceAny
10 | super
11 | end
12 |
13 | def test_connect_tcp
14 | fullname = "blackjack\\032no\\032port._blackjack._tcp.local."
15 | reply = DNSSD::Reply::Resolve.new nil, 0, @interface, fullname,
16 | 'localhost', @port, nil
17 |
18 | server = TCPServer.new nil, @port
19 |
20 | socket = reply.connect
21 |
22 | assert_instance_of TCPSocket, socket
23 | assert_equal @port, socket.peeraddr[1]
24 |
25 | if socket.method(:peeraddr).arity.zero? then
26 | assert_equal 'localhost', socket.peeraddr[2]
27 | else
28 | assert_equal 'localhost', socket.peeraddr(true)[2]
29 | end
30 | ensure
31 | socket.close if socket
32 | server.close if server
33 | end
34 |
35 | def test_connect_udp
36 | fullname = "blackjack\\032no\\032port._blackjack._udp.local."
37 | reply = DNSSD::Reply::Resolve.new nil, 0, @interface, fullname,
38 | 'localhost', @port, nil
39 |
40 | server = UDPSocket.new
41 | server.bind 'localhost', @port
42 |
43 | socket = reply.connect
44 |
45 | assert_instance_of UDPSocket, socket
46 | assert_equal @port, socket.peeraddr[1]
47 |
48 | if socket.method(:peeraddr).arity.zero? then
49 | assert_equal 'localhost', socket.peeraddr[2]
50 | else
51 | assert_equal 'localhost', socket.peeraddr(true)[2]
52 | end
53 | ensure
54 | socket.close if socket
55 | server.close if server
56 | end
57 |
58 | end
59 |
60 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/test_generator_collections.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'test/unit'
4 | require 'plist'
5 |
6 | class TestGeneratorCollections < Test::Unit::TestCase
7 | def test_array
8 | expected = <
10 | 1
11 | 2
12 | 3
13 |
14 | END
15 |
16 | assert_equal expected, [1,2,3].to_plist(false)
17 | end
18 |
19 | def test_empty_array
20 | expected = <
22 | END
23 |
24 | assert_equal expected, [].to_plist(false)
25 | end
26 |
27 | def test_hash
28 | expected = <
30 | abc
31 | 123
32 | foo
33 | bar
34 |
35 | END
36 | # thanks to recent changes in the generator code, hash keys are sorted before emission,
37 | # so multi-element hash tests should be reliable. We're testing that here too.
38 | assert_equal expected, {:foo => :bar, :abc => 123}.to_plist(false)
39 | end
40 |
41 | def test_empty_hash
42 | expected = <
44 | END
45 |
46 | assert_equal expected, {}.to_plist(false)
47 | end
48 |
49 | def test_hash_with_array_element
50 | expected = <
52 | ary
53 |
54 | 1
55 | b
56 | 3
57 |
58 |
59 | END
60 | assert_equal expected, {:ary => [1,:b,'3']}.to_plist(false)
61 | end
62 |
63 | def test_array_with_hash_element
64 | expected = <
66 |
67 | foo
68 | bar
69 |
70 | b
71 | 3
72 |
73 | END
74 |
75 | assert_equal expected, [{:foo => 'bar'}, :b, 3].to_plist(false)
76 | end
77 | end
78 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/test_generator_basic_types.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'test/unit'
4 | require 'plist'
5 |
6 | class TestGeneratorBasicTypes < Test::Unit::TestCase
7 | def wrap(tag, content)
8 | return "<#{tag}>#{content}#{tag}>"
9 | end
10 |
11 | def test_strings
12 | expected = wrap('string', 'testdata')
13 |
14 | assert_equal expected, Plist::Emit.dump('testdata', false).chomp
15 | assert_equal expected, Plist::Emit.dump(:testdata, false).chomp
16 | end
17 |
18 | def test_strings_with_escaping
19 | expected = wrap('string', "<Fish & Chips>")
20 |
21 | assert_equal expected, Plist::Emit.dump('', false).chomp
22 | end
23 |
24 | def test_integers
25 | [42, 2376239847623987623, -8192].each do |i|
26 | assert_equal wrap('integer', i), Plist::Emit.dump(i, false).chomp
27 | end
28 | end
29 |
30 | def test_floats
31 | [3.14159, -38.3897, 2398476293847.9823749872349980].each do |i|
32 | assert_equal wrap('real', i), Plist::Emit.dump(i, false).chomp
33 | end
34 | end
35 |
36 | def test_booleans
37 | assert_equal "", Plist::Emit.dump(true, false).chomp
38 | assert_equal "", Plist::Emit.dump(false, false).chomp
39 | end
40 |
41 | def test_time
42 | test_time = Time.now
43 | assert_equal wrap('date', test_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ')), Plist::Emit.dump(test_time, false).chomp
44 | end
45 |
46 | def test_dates
47 | test_date = Date.today
48 | test_datetime = DateTime.now
49 |
50 | assert_equal wrap('date', test_date.strftime('%Y-%m-%dT%H:%M:%SZ')), Plist::Emit.dump(test_date, false).chomp
51 | assert_equal wrap('date', test_datetime.strftime('%Y-%m-%dT%H:%M:%SZ')), Plist::Emit.dump(test_datetime, false).chomp
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 14F27
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | SparklingHelper
11 | CFBundleIdentifier
12 | org.codefirst.sparkling.SparklingHelper
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | SparklingHelper
17 | CFBundlePackageType
18 | BNDL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleSupportedPlatforms
24 |
25 | MacOSX
26 |
27 | CFBundleVersion
28 | 1
29 | DTCompiler
30 | com.apple.compilers.llvm.clang.1_0
31 | DTPlatformBuild
32 | 7A218
33 | DTPlatformVersion
34 | GM
35 | DTSDKBuild
36 | 15A278
37 | DTSDKName
38 | macosx10.11
39 | DTXcode
40 | 0700
41 | DTXcodeBuild
42 | 7A218
43 | DVTPlugInCompatibilityUUIDs
44 |
45 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3
46 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13
47 |
48 | LSMinimumSystemVersion
49 | 10.10
50 | NSPrincipalClass
51 | SparklingHelper
52 | XC4Compatible
53 |
54 | XCPluginHasUI
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/action/install/change_id.rb:
--------------------------------------------------------------------------------
1 | require 'plist'
2 |
3 | module BrewSparkling
4 | module Action
5 | module Install
6 | # Free provisioning plan does not provide wildcard provisioning.
7 | # So you should use expliict app id.
8 | #
9 | # But app id require world-wide uniqueness. So we must create
10 | # a unique bundle identifier per user.
11 | #
12 | # Ordinally, bundle identifier is stored at Info.plist. So,
13 | # we traversal project directory and rewrite it.
14 | class ChangeId < Base
15 |
16 | def call
17 | logger.start "Add prefix to bundle identifier: #{user.prefix}"
18 |
19 | update_info_plist do |plist|
20 | update! plist, %w(CFBundleIdentifier WKCompanionAppBundleIdentifier WKAppBundleIdentifier) do |key, original|
21 | "#{user.prefix}.#{original}".tap { |id|
22 | logger.info "#{key}: #{original} => #{id}"
23 | }
24 | end
25 | plist
26 | end
27 | end
28 |
29 | private
30 |
31 | def update_info_plist(&f)
32 | recipe.info_plists.each do |info|
33 | # convert to xml
34 | system 'plutil', '-convert', 'xml1', info
35 |
36 | # parse
37 | original = Plist::parse_xml(info)
38 |
39 | updated = f.call(original)
40 |
41 | File.write info, updated.to_plist
42 | end
43 | end
44 |
45 | def update_hash(hash, key, &f)
46 | if hash.key? key
47 | hash[key] = f.call hash[key]
48 | end
49 |
50 | hash
51 | end
52 |
53 | def update!(hash, keys, &f)
54 | hash.each do |key, value|
55 | if keys.include?(key)
56 | hash[key] = f.call(key, value)
57 | elsif value.is_a?(Hash)
58 | update!(value, keys, &f)
59 | end
60 | end
61 | end
62 | end
63 | end
64 | end
65 | end
66 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/dnssd.c:
--------------------------------------------------------------------------------
1 | #include "dnssd.h"
2 |
3 | void Init_DNSSD_Errors(void);
4 | void Init_DNSSD_Flags(void);
5 | void Init_DNSSD_Record(void);
6 | void Init_DNSSD_Service(void);
7 |
8 | /*
9 | * call-seq:
10 | * DNSSD.interface_name(interface_index) # => interface_name
11 | *
12 | * Returns the interface name for interface +interface_index+.
13 | *
14 | * DNSSD.interface_name 1 # => 'lo0'
15 | */
16 |
17 | static VALUE
18 | dnssd_if_nametoindex(VALUE self, VALUE name) {
19 | return UINT2NUM(if_nametoindex(StringValueCStr(name)));
20 | }
21 |
22 | /*
23 | * call-seq:
24 | * DNSSD.interface_index(interface_name) # => interface_index
25 | *
26 | * Returns the interface index for interface +interface_name+.
27 | *
28 | * DNSSD.interface_index 'lo0' # => 1
29 | */
30 |
31 | static VALUE
32 | dnssd_if_indextoname(VALUE self, VALUE index) {
33 | char buffer[IF_NAMESIZE];
34 |
35 | if (if_indextoname(NUM2UINT(index), buffer))
36 | return rb_str_new2(buffer);
37 |
38 | rb_raise(rb_eArgError, "invalid interface %d", NUM2UINT(index));
39 |
40 | return Qnil;
41 | }
42 |
43 | void
44 | Init_dnssd(void) {
45 | VALUE mDNSSD = rb_define_module("DNSSD");
46 |
47 | /* All interfaces */
48 | rb_define_const(mDNSSD, "InterfaceAny",
49 | ULONG2NUM(kDNSServiceInterfaceIndexAny));
50 |
51 | /* Local interfaces, for services running only on the same machine */
52 | rb_define_const(mDNSSD, "InterfaceLocalOnly",
53 | ULONG2NUM(kDNSServiceInterfaceIndexLocalOnly));
54 |
55 | #ifdef kDNSServiceInterfaceIndexUnicast
56 | /* Unicast interfaces */
57 | rb_define_const(mDNSSD, "InterfaceUnicast",
58 | ULONG2NUM(kDNSServiceInterfaceIndexUnicast));
59 | #endif
60 |
61 | rb_define_singleton_method(mDNSSD, "interface_index", dnssd_if_nametoindex, 1);
62 | rb_define_singleton_method(mDNSSD, "interface_name", dnssd_if_indextoname, 1);
63 |
64 | Init_DNSSD_Errors();
65 | Init_DNSSD_Flags();
66 | Init_DNSSD_Record();
67 | Init_DNSSD_Service();
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/text_record.rb:
--------------------------------------------------------------------------------
1 | require 'delegate'
2 |
3 | ##
4 | # DNSSD::TextRecord is a Hash delegate that can encode its contents for DNSSD.
5 |
6 | class DNSSD::TextRecord < DelegateClass(Hash)
7 | def self.decode text_record
8 | record = {}
9 |
10 | tr = text_record.unpack 'C*'
11 |
12 | until tr.empty? do
13 | size = tr.shift
14 |
15 | next if size.zero?
16 |
17 | raise ArgumentError, 'ran out of data in text record' if tr.length < size
18 |
19 | entry = tr.shift(size).pack('C*')
20 |
21 | raise ArgumentError, 'key not found' unless entry =~ /^[^=]/
22 |
23 | key, value = entry.split '=', 2
24 |
25 | next unless key
26 |
27 | record[key] = value
28 | end
29 |
30 | new record
31 | end
32 |
33 | ##
34 | # Creates a new TextRecord decoding an encoded +text_record+ if given or
35 | # from a given Hash.
36 | #
37 | # DNSSD::TextRecord.new "\003k=v"
38 | #
39 | # or
40 | #
41 | # DNSSD::TextRecord.new 'k' => 'v'
42 |
43 | def initialize(text_record = nil)
44 | super case text_record
45 | when Hash then
46 | text_record.dup
47 | when String then
48 | decode(text_record.dup)
49 | else
50 | Hash.new
51 | end
52 | end
53 |
54 | ##
55 | # Decodes +text_record+ and returns a Hash
56 |
57 | def decode(text_record)
58 | self.class.decode text_record
59 | end
60 |
61 | ##
62 | # Encodes this TextRecord. A key value pair must be less than 255 bytes in
63 | # length. Keys longer than 14 bytes may not be compatible with all
64 | # clients.
65 |
66 | def encode
67 | sort.map do |key, value|
68 | key = key.to_s
69 |
70 | raise DNSSD::Error, "empty key" if key.empty?
71 | raise DNSSD::Error, "key '#{key}' contains =" if key =~ /=/
72 |
73 | record = value ? [key, value.to_s].join('=') : key
74 |
75 | raise DNSSD::Error, "key value pair at '#{key}' too large to encode" if
76 | record.length > 255
77 |
78 | "#{record.length.chr}#{record}"
79 | end.join ''
80 | end
81 |
82 | end
83 |
84 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/README.txt:
--------------------------------------------------------------------------------
1 | = dnssd
2 |
3 | * https://github.com/tenderlove/dnssd
4 | * http://docs.seattlerb.org/dnssd
5 | * http://developer.apple.com/documentation/Networking/Conceptual/dns_discovery_api/Introduction.html
6 |
7 | == DESCRIPTION:
8 |
9 | DNS Service Discovery (aka Bonjour, MDNS) API for Ruby. Implements browsing,
10 | resolving, registration and domain enumeration. Supports avahi's DNSSD
11 | compatibility layer for avahi 0.6.25 or newer.
12 |
13 | == FEATURES/PROBLEMS:
14 |
15 | * Needs more pie.
16 | * Not all of the DNSSD API is implemented
17 | * Sometimes tests fail
18 |
19 | == SYNOPSIS:
20 |
21 | See the sample directory (Hint: gem contents --prefix dnssd)
22 |
23 | Registering a service:
24 |
25 | http = TCPServer.new nil, 80
26 |
27 | DNSSD.announce http, 'my awesome HTTP server'
28 |
29 | Browsing services:
30 |
31 | require 'dnssd'
32 |
33 | DNSSD.browse '_http._tcp.' do |reply|
34 | p reply
35 | end
36 |
37 | == REQUIREMENTS:
38 |
39 | * OS X
40 | * The dns-sd library on other operating systems
41 | * avahi 0.6.25+ (plus libavahi-compat-libdnssd-dev on debian)
42 |
43 | == INSTALL:
44 |
45 | sudo gem install dnssd
46 |
47 | If you have dnssd installed in a non-standard location you can use the build
48 | options --with-dnssd-dir and --with-dnssd-lib:
49 |
50 | sudo gem install dnssd -- \
51 | --with-dnssd-dir=/path/to/dnssd \
52 | --with-dnssd-lib=/path/to/lib/dnssd
53 |
54 | Using the default Bonjour SDK install for Windows, the command to build
55 | the Ruby dnssd extension will look like this:
56 |
57 | # Windows 2000 or Windows XP
58 | sudo gem install dnssd -- \
59 | --with-dnssd-dir=c:/progra~1/bonjou~1 \
60 | --with-dnssd-lib=c:/progra~1/bonjou~1/lib/win32
61 |
62 | # Windows Vista and later
63 | sudo gem install dnssd -- \
64 | --with-dnssd-dir=c:/progra~2/bonjou~1 \
65 | --with-dnssd-lib=c:/progra~2/bonjou~1/lib/win32
66 |
67 | == LICENSE:
68 |
69 | Copyright (c) 2004 Chad Fowler, Charles Mills, Rich Kilmer
70 |
71 | Copyright (c) 2009 Phil Hagelberg, Aaron Patterson, Eric Hodel
72 |
73 | Licensed under the ruby license
74 |
75 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/specifications/dnssd-3.0.1.gemspec:
--------------------------------------------------------------------------------
1 | # -*- encoding: utf-8 -*-
2 |
3 | Gem::Specification.new do |s|
4 | s.name = "dnssd"
5 | s.version = "3.0.1"
6 |
7 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8 | s.authors = ["Eric Hodel", "Aaron Patterson", "Phil Hagelberg", "Chad Fowler", "Charles Mills", "Rich Kilmer"]
9 | s.date = "2015-04-03"
10 | s.description = "DNS Service Discovery (aka Bonjour, MDNS) API for Ruby. Implements browsing,\nresolving, registration and domain enumeration. Supports avahi's DNSSD\ncompatibility layer for avahi 0.6.25 or newer."
11 | s.email = ["drbrain@segment.net", "aaron.patterson@gmail.com", "phil@hagelb.org", "chad@chadfowler.com", "", ""]
12 | s.extensions = ["ext/dnssd/extconf.rb"]
13 | s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
14 | s.files = ["History.txt", "Manifest.txt", "README.txt", "ext/dnssd/extconf.rb"]
15 | s.homepage = "https://github.com/tenderlove/dnssd"
16 | s.licenses = ["MIT"]
17 | s.rdoc_options = ["--main", "README.txt"]
18 | s.require_paths = ["lib"]
19 | s.required_ruby_version = Gem::Requirement.new(">= 2.0.0")
20 | s.rubygems_version = "2.0.14"
21 | s.summary = "DNS Service Discovery (aka Bonjour, MDNS) API for Ruby"
22 |
23 | if s.respond_to? :specification_version then
24 | s.specification_version = 4
25 |
26 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27 | s.add_development_dependency(%q, ["~> 5.5"])
28 | s.add_development_dependency(%q, ["~> 4.0"])
29 | s.add_development_dependency(%q, ["~> 0.7"])
30 | s.add_development_dependency(%q, ["~> 3.13"])
31 | else
32 | s.add_dependency(%q, ["~> 5.5"])
33 | s.add_dependency(%q, ["~> 4.0"])
34 | s.add_dependency(%q, ["~> 0.7"])
35 | s.add_dependency(%q, ["~> 3.13"])
36 | end
37 | else
38 | s.add_dependency(%q, ["~> 5.5"])
39 | s.add_dependency(%q, ["~> 4.0"])
40 | s.add_dependency(%q, ["~> 0.7"])
41 | s.add_dependency(%q, ["~> 3.13"])
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_text_record.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDTextRecord < DNSSD::Test
4 | TR = DNSSD::TextRecord
5 |
6 | def test_encode
7 | tr = TR.new
8 |
9 | tr['key1'] = nil
10 | tr['key2'] = ''
11 | tr['key3'] = 'value'
12 |
13 | assert_equal "\004key1\005key2=\012key3=value", tr.encode
14 | end
15 |
16 | def test_encode_long
17 | tr = TR.new
18 |
19 | tr['key'] = 'X' * 252
20 |
21 | e = assert_raises DNSSD::Error do
22 | tr.encode
23 | end
24 |
25 | assert_equal 'key value pair at \'key\' too large to encode', e.message
26 | end
27 |
28 | def test_decode
29 | text_record = "\fstatus=avail\006email=\004jid=\005node=\tversion=1\ttxtvers=1\016port.p2pj=5298\0161st=Eric Hodel\005nick=\004AIM=\005last=-phsh=59272d0c3ed947b4660fabc0dad9d67647507299\004ext="
30 |
31 | expected = {
32 | 'status' => 'avail',
33 | 'ext' => '',
34 | 'node' => '',
35 | 'nick' => '',
36 | 'last' => '',
37 | 'txtvers' => '1',
38 | 'AIM' => '',
39 | 'jid' => '',
40 | 'phsh' => '59272d0c3ed947b4660fabc0dad9d67647507299',
41 | 'version' => '1',
42 | '1st' => 'Eric Hodel',
43 | 'port.p2pj' => '5298',
44 | 'email' => ''
45 | }
46 |
47 | assert_equal expected, TR.new(text_record).to_hash
48 | end
49 |
50 | def test_decode_bad
51 | assert_raises ArgumentError do
52 | TR.new("\x01") # length past end-of-record
53 | end
54 |
55 | assert_raises ArgumentError do
56 | # no key
57 | TR.new("\x01=")
58 | end
59 |
60 | assert_raises ArgumentError do
61 | # 0-length key
62 | TR.new("\x02=v")
63 | end
64 | end
65 |
66 | def test_decode_empty
67 | assert_equal({}, TR.new(""))
68 | assert_equal({}, TR.new("\x00"))
69 | assert_equal({}, TR.new("\x00\x00"))
70 | end
71 |
72 | def test_decode_value
73 | assert_equal({ 'k' => nil }, TR.new("\x01k").to_hash)
74 | assert_equal({ 'k' => '' }, TR.new("\x02k=").to_hash)
75 | assert_equal({ 'k' => 'v' }, TR.new("\x03k=v").to_hash)
76 | end
77 |
78 | end
79 |
80 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_reply.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDReply < DNSSD::Test
4 |
5 | def setup
6 | @reply = DNSSD::Reply.new nil, 0, 0
7 | @fullname = "Eric\\032Hodel._http._tcp.local."
8 | end
9 |
10 | def test_fullname
11 | @reply.set_fullname @fullname
12 |
13 | assert_equal "Eric\\032Hodel._http._tcp.local.", @reply.fullname
14 |
15 | @reply.instance_variable_set :@name, 'Dr. Pepper'
16 |
17 | assert_equal "Dr\\.\\032Pepper._http._tcp.local.", @reply.fullname
18 | end
19 |
20 | def test_inspect
21 | flags = DNSSD::Flags.new DNSSD::Flags::MoreComing
22 | @reply.instance_variable_set :@interface, 'lo0'
23 | @reply.instance_variable_set :@flags, flags
24 |
25 | expected = "#"
26 | assert_equal expected, @reply.inspect
27 | end
28 |
29 | def test_protocol
30 | @reply.set_fullname @fullname
31 |
32 | assert_equal 'tcp', @reply.protocol
33 | end
34 |
35 | def test_service_name
36 | @reply.set_fullname @fullname
37 |
38 | assert_equal 'http', @reply.service_name
39 | end
40 |
41 | def test_set_fullname
42 | @reply.set_fullname @fullname
43 |
44 | assert_equal "Eric Hodel", @reply.instance_variable_get(:@name)
45 | assert_equal '_http._tcp', @reply.instance_variable_get(:@type)
46 | assert_equal 'local.', @reply.instance_variable_get(:@domain)
47 |
48 | @reply.set_fullname "Dr\\.\\032Pepper._http._tcp.local."
49 |
50 | assert_equal "Dr. Pepper", @reply.instance_variable_get(:@name)
51 | assert_equal '_http._tcp', @reply.instance_variable_get(:@type)
52 | assert_equal 'local.', @reply.instance_variable_get(:@domain)
53 |
54 | @reply.set_fullname "Dr\\.\\032Pepper\\032\\0352._http._tcp.local."
55 | assert_equal "Dr. Pepper #2", @reply.instance_variable_get(:@name)
56 | end
57 |
58 | def test_set_names
59 | @reply.set_names "Dr\\.\032Pepper", '_http._tcp', 'local.'
60 |
61 | assert_equal "Dr.\032Pepper", @reply.instance_variable_get(:@name)
62 | assert_equal '_http._tcp', @reply.instance_variable_get(:@type)
63 | assert_equal 'local.', @reply.instance_variable_get(:@domain)
64 | end
65 |
66 | end
67 |
68 |
--------------------------------------------------------------------------------
/lib/brew_sparkling/user.rb:
--------------------------------------------------------------------------------
1 | require 'brew_sparkling/logger'
2 | require 'brew_sparkling/gateway/xcode'
3 | require 'digest/sha1'
4 |
5 | module BrewSparkling
6 | class User
7 | class <"
66 | end
67 |
68 | ##
69 | # Sets +flag+
70 |
71 | def set_flag(flag)
72 | @flags |= flag
73 |
74 | verify
75 | end
76 |
77 | ##
78 | # Returns an Array of flag names
79 |
80 | def to_a
81 | FLAGS.map do |name, value|
82 | (@flags & value == value) ? name : nil
83 | end.compact
84 | end
85 |
86 | ##
87 | # Flags as a bitfield
88 |
89 | def to_i
90 | @flags
91 | end
92 |
93 | ##
94 | # Trims the flag list down to valid flags
95 |
96 | def verify
97 | @flags &= ALL_FLAGS
98 |
99 | self
100 | end
101 |
102 | ##
103 | # Returns the union of flags in +self+ and +flags+
104 |
105 | def |(flags)
106 | self.class.new(to_i | flags.to_i)
107 | end
108 |
109 | ##
110 | # Returns the complement of the flags in +self+
111 |
112 | def ~
113 | self.class.new ~to_i
114 | end
115 |
116 | end
117 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_reply_query_record.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDReplyQueryRecord < DNSSD::Test
4 |
5 | def setup
6 | @fullname = 'blackjack._blackjack._tcp.test.'
7 | @IN = DNSSD::Record::IN
8 | @ipv4 = "\300\000\002\001"
9 | @ipv6 = " \001\r\270\000\000\000\000\000\000\000\000\000\000\000\001"
10 | @nowhere = "\007nowhere\007example\000"
11 | end
12 |
13 | def test_record_data_A
14 | qr = util_qr DNSSD::Record::A, @ipv4
15 |
16 | assert_equal IPAddr.new_ntoh(@ipv4), qr.record_data
17 | end
18 |
19 | def test_record_data_AAAA
20 | qr = util_qr DNSSD::Record::A, @ipv6
21 |
22 | assert_equal IPAddr.new_ntoh(@ipv6), qr.record_data
23 | end
24 |
25 | def test_record_data_CNAME
26 | qr = util_qr DNSSD::Record::CNAME, @nowhere
27 |
28 | assert_equal 'nowhere.example.', qr.record_data
29 | end
30 |
31 | def test_record_data_MX
32 | qr = util_qr DNSSD::Record::MX, "\000\010#{@nowhere}"
33 |
34 | assert_equal [8, 'nowhere.example.'], qr.record_data
35 | end
36 |
37 | def test_record_data_NS
38 | qr = util_qr DNSSD::Record::NS, @nowhere
39 |
40 | assert_equal 'nowhere.example.', qr.record_data
41 | end
42 |
43 | def test_record_data_PTR
44 | qr = util_qr DNSSD::Record::PTR, @nowhere
45 |
46 | assert_equal 'nowhere.example.', qr.record_data
47 | end
48 |
49 | def test_record_data_SOA
50 | serial = 1
51 | refresh = 86400
52 | rtry = 3600
53 | expire = 86400 * 2
54 | minimum = 3600 * 12
55 |
56 | data = "#{@nowhere}\002me#{@nowhere}#{[serial, refresh, rtry, expire, minimum].pack 'NNNNN'}"
57 |
58 | qr = util_qr DNSSD::Record::SOA, data
59 |
60 | expected = [
61 | 'nowhere.example.', 'me.nowhere.example.',
62 | serial, refresh, rtry, expire, minimum
63 | ]
64 |
65 | assert_equal expected, qr.record_data
66 | end
67 |
68 | def test_record_data_SRV
69 | priority = 1
70 | weight = 5
71 | port = 1025
72 |
73 | data = "#{[priority, weight, port].pack 'nnn'}#{@nowhere}"
74 |
75 | qr = util_qr DNSSD::Record::SRV, data
76 |
77 | assert_equal [1, 5, 1025, 'nowhere.example.'], qr.record_data
78 | end
79 |
80 | def test_record_data_TXT
81 | qr = util_qr DNSSD::Record::TXT, "\005Hello\006World!"
82 |
83 | assert_equal %w[Hello World!], qr.record_data
84 | end
85 |
86 | def util_qr(rtype, rdata)
87 | DNSSD::Reply::QueryRecord.new nil, 0, 0, @fullname, rtype, @IN, rdata, 120
88 | end
89 |
90 | end
91 |
92 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/ext/dnssd/extconf.rb:
--------------------------------------------------------------------------------
1 | require 'mkmf'
2 |
3 | $CFLAGS << ' -Wall' if with_config 'warnings'
4 |
5 | dir_config 'dnssd'
6 |
7 | abort 'unable to find dnssd header' unless have_header 'dns_sd.h'
8 |
9 | have_library('dnssd') ||
10 | have_library('dns_sd') ||
11 | have_library('mdns') ||
12 | have_library('System') ||
13 | abort('unable to find dnssd library')
14 |
15 | have_macro('htons', 'arpa/inet.h') ||
16 | have_func('htons', 'arpa/inet.h') ||
17 | abort("couldn't find htons")
18 |
19 | have_macro('ntohs', 'arpa/inet.h') ||
20 | have_func('ntohs', 'arpa/inet.h') ||
21 | abort("couldn't find ntohs")
22 |
23 | # These functions live in netioapi.h on Windows, not net/if.h. The MSDN
24 | # documentation says to include iphlpapi.h, not netioapi.h directly.
25 | #
26 | # Note, however, that these functions only exist on Vista/Server 2008 or later.
27 | # On Windows XP and earlier you will have to define a custom version of each
28 | # function using native functions, such as ConvertInterfaceIndexToLuid() and
29 | # ConvertInterfaceLuidToNameA().
30 | #
31 | if have_header 'iphlpapi.h' then
32 | have_func('if_indextoname', %w[iphlpapi.h netioapi.h]) &&
33 | have_func('if_nametoindex', %w[iphlpapi.h netioapi.h]) ||
34 | abort('unable to find if_indextoname or if_nametoindex')
35 | else
36 | if RUBY_PLATFORM =~ /solaris/ then
37 | have_library('xnet') ||
38 | abort('unable to find xnet library for if_indextoname/if_nametoindex')
39 |
40 | $CFLAGS << ' -lxnet'
41 | end
42 |
43 | have_func('if_indextoname', %w[sys/types.h sys/socket.h net/if.h]) &&
44 | have_func('if_nametoindex', %w[sys/types.h sys/socket.h net/if.h]) ||
45 | abort('unable to find if_indextoname or if_nametoindex')
46 | end
47 |
48 | have_type('struct sockaddr_in', 'netinet/in.h') ||
49 | abort('unable to find struct sockaddr_in')
50 |
51 | have_struct_member 'struct sockaddr_in', 'sin_len', 'netinet/in.h'
52 | # otherwise, use sizeof()
53 |
54 | puts
55 | puts 'checking for missing avahi features'
56 | # avahi 0.6.25 is missing these functions
57 | have_func 'DNSServiceGetProperty', 'dns_sd.h'
58 | have_func 'DNSServiceGetAddrInfo', 'dns_sd.h'
59 |
60 | # avahi 0.6.25 is missing these flags
61 | have_func 'kDNSServiceFlagsForce', 'dns_sd.h'
62 | have_func 'kDNSServiceFlagsNonBrowsable', 'dns_sd.h'
63 | have_func 'kDNSServiceFlagsReturnIntermediates', 'dns_sd.h'
64 | have_func 'kDNSServiceFlagsShareConnection', 'dns_sd.h'
65 |
66 | # avahi 0.6.25 is missing errors after BadTime
67 | have_func 'kDNSServiceErr_BadSig', 'dns_sd.h'
68 |
69 | puts
70 | puts 'checking for ruby features'
71 | have_header 'ruby/encoding.h'
72 |
73 | puts
74 | create_makefile 'dnssd/dnssd'
75 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply/resolve.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # Created by DNSSD::Service#resolve
3 |
4 | class DNSSD::Reply::Resolve < DNSSD::Reply
5 |
6 | ##
7 | # A domain for registration or browsing
8 |
9 | attr_reader :domain
10 |
11 | ##
12 | # The service name
13 |
14 | attr_reader :name
15 |
16 | ##
17 | # The port for this service
18 |
19 | attr_reader :port
20 |
21 | ##
22 | # The hostname of the host provide the service
23 |
24 | attr_reader :target
25 |
26 | ##
27 | # The service's primary text record
28 |
29 | attr_reader :text_record
30 |
31 | ##
32 | # The service type
33 |
34 | attr_reader :type
35 |
36 | ##
37 | # Creates a new Resolve, called internally by DNSSD::Service#resolve
38 |
39 | def initialize(service, flags, interface, fullname, target, port,
40 | text_record)
41 | super service, flags, interface
42 |
43 | set_fullname fullname
44 |
45 | @target = target
46 | @port = port
47 | @text_record = DNSSD::TextRecord.new text_record
48 | end
49 |
50 | ##
51 | # Connects to this Reply. If #target and #port are missing, DNSSD.resolve
52 | # is automatically called.
53 | #
54 | # +family+ can be used to select a particular address family (IPv6 vs IPv4).
55 | #
56 | # +addrinfo_flags+ are passed to DNSSD::Service#getaddrinfo as flags.
57 |
58 | def connect(family = Socket::AF_UNSPEC, addrinfo_flags = 0)
59 | addrinfo_protocol = case family
60 | when Socket::AF_INET then DNSSD::Service::IPv4
61 | when Socket::AF_INET6 then DNSSD::Service::IPv6
62 | when Socket::AF_UNSPEC then 0
63 | else raise ArgumentError, "invalid family #{family}"
64 | end
65 |
66 | service = DNSSD::Service.getaddrinfo target, addrinfo_protocol,
67 | addrinfo_flags, @interface
68 |
69 | service.each do |addrinfo|
70 | address = addrinfo.address
71 |
72 | begin
73 | socket = nil
74 |
75 | case protocol
76 | when 'tcp' then
77 | socket = TCPSocket.new address, port
78 | when 'udp' then
79 | socket = UDPSocket.new
80 | socket.connect address, port
81 | end
82 |
83 | service.stop
84 | return socket
85 | rescue
86 | next if addrinfo.flags.more_coming?
87 | raise
88 | end
89 | end
90 | end
91 |
92 | def inspect # :nodoc:
93 | "#<%s:0x%x %s at %s:%d text_record: %p interface: %s flags: %p>" % [
94 | self.class, object_id,
95 | fullname, @target, @port, @text_record, interface_name, @flags
96 | ]
97 | end
98 |
99 | end
100 |
101 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # DNSSD::Reply is used to return information
3 |
4 | class DNSSD::Reply
5 |
6 | ##
7 | # Flags for this reply, see DNSSD::Flags
8 |
9 | attr_reader :flags
10 |
11 | ##
12 | # The interface name for this reply
13 |
14 | attr_reader :interface
15 |
16 | ##
17 | # The DNSSD::Service that created this reply
18 |
19 | attr_reader :service
20 |
21 | ##
22 | # Creates a new reply attached to +service+ with +flags+ on interface index
23 | # +interface+
24 |
25 | def initialize(service, flags, interface)
26 | @service = service
27 | @flags = DNSSD::Flags.new flags
28 | @interface = if interface then
29 | interface > 0 ? DNSSD.interface_name(interface) : interface
30 | end
31 | end
32 |
33 | ##
34 | # The full service domain name, see DNSS::Service#fullname
35 |
36 | def fullname
37 | fullname = DNSSD::Service.fullname @name.gsub("\032", ' '), @type, @domain
38 | fullname << '.' unless fullname =~ /\.$/
39 | fullname
40 | end
41 |
42 | def inspect # :nodoc:
43 | "#<%s:0x%x interface: %s flags: %p>" % [
44 | self.class, object_id, interface_name, @flags
45 | ]
46 | end
47 |
48 | ##
49 | # Expands the name of the interface including constants
50 |
51 | def interface_name
52 | case @interface
53 | when nil then 'nil'
54 | when DNSSD::InterfaceAny then 'any'
55 | when DNSSD::InterfaceLocalOnly then 'local'
56 | when DNSSD::InterfaceUnicast then 'unicast'
57 | else @interface
58 | end
59 | end
60 |
61 | ##
62 | # Protocol of this service
63 |
64 | def protocol
65 | raise TypeError, 'no type on this reply' unless
66 | instance_variable_defined? :@type
67 |
68 | @type.split('.').last.sub '_', ''
69 | end
70 |
71 | ##
72 | # Service name as in Socket.getservbyname
73 |
74 | def service_name
75 | raise TypeError, 'no type on this reply' unless
76 | instance_variable_defined? :@type
77 |
78 | @type.split('.').first.sub '_', ''
79 | end
80 |
81 | ##
82 | # Sets #name, #type and #domain from +fullname+
83 |
84 | def set_fullname(fullname)
85 | fullname = fullname.gsub(/\\([0-9]{1,3})/) do $1.to_i.chr end
86 | fullname = fullname.scan(/(?:[^\\.]|\\\.)+/).map do |part|
87 | part.gsub "\\.", '.'
88 | end
89 |
90 | @name = fullname[0]
91 | @type = fullname[1, 2].join '.'
92 | @domain = fullname[3..-1].map { |part| part.sub '.', '\\.' }.join('.') + '.'
93 | end
94 |
95 | ##
96 | # Sets #name, #type and #domain
97 |
98 | def set_names(name, type, domain)
99 | set_fullname [name, type, domain].join('.')
100 | end
101 |
102 | end
103 |
104 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSD < DNSSD::Test
4 | def setup
5 | @abort = Thread.abort_on_exception
6 | Thread.abort_on_exception = true
7 |
8 | begin
9 | @port = Socket.getservbyname 'blackjack'
10 | rescue
11 | @port = 1025
12 | end
13 | end
14 |
15 | def teardown
16 | Thread.abort_on_exception = @abort
17 | end
18 |
19 | def test_synchronous_register
20 | reply = DNSSD.register! name, "_http._tcp", nil, 8080 do |r|
21 | break r
22 | end
23 | assert reply
24 | end
25 |
26 | def test_synchronous_enumerate
27 | Timeout.timeout(2, Minitest::Skip) do
28 | reply = DNSSD.enumerate_domains! do |r|
29 | break r
30 | end
31 | assert reply
32 | end
33 | end
34 |
35 | def test_asynchronous_enumerate
36 | latch = Latch.new
37 | reply = DNSSD.enumerate_domains do |r|
38 | latch.await
39 | end
40 | latch.release
41 | assert reply
42 | end
43 |
44 | def test_synchronous_browse
45 | register = DNSSD::Service.register name, "_http._tcp", nil, 8080
46 | thing = nil
47 | DNSSD.browse!('_http._tcp') do |r|
48 | thing = true
49 | break
50 | end
51 | assert thing
52 | register.stop
53 | end
54 |
55 | def test_class_announce_tcp_server
56 | t = nil
57 | latch = Latch.new
58 |
59 | browse = DNSSD.browse '_blackjack._tcp' do |reply|
60 | next unless 'blackjack tcp server' == reply.name
61 | t = reply
62 | latch.release
63 | end
64 |
65 | s = TCPServer.new 'localhost', @port
66 |
67 | stub Socket, :getservbyport, 'blackjack' do
68 | DNSSD.announce s, 'blackjack tcp server'
69 | end
70 |
71 | latch.await
72 |
73 | assert_equal 'blackjack tcp server', t.name
74 | ensure
75 | browse.stop
76 | s.close
77 | end
78 |
79 | def test_class_announce_tcp_server_service
80 | t = nil
81 | latch = Latch.new
82 |
83 | rs = DNSSD.resolve 'blackjack resolve', '_blackjack._tcp', 'local.' do |reply|
84 | t = reply
85 | latch.release
86 | end
87 |
88 | s = TCPServer.new 'localhost', @port + 1
89 |
90 | DNSSD.announce s, 'blackjack resolve', 'blackjack'
91 |
92 | latch.await
93 |
94 | assert_equal 'blackjack resolve', t.name
95 | assert_equal @port + 1, t.port
96 | ensure
97 | rs.stop
98 | s.close if s
99 | end
100 |
101 | def test_class_interface_index
102 | index = DNSSD.interface_index 'lo0'
103 | index = DNSSD.interface_index 'lo' if index.zero?
104 | refute_equal 0, index, 'what? no lo0? no lo?'
105 | end
106 |
107 | def test_class_interface_name
108 | index = DNSSD.interface_index 'lo0'
109 | index = DNSSD.interface_index 'lo' if index.zero?
110 |
111 | assert_match %r%^lo0?$%, DNSSD.interface_name(index)
112 | end
113 | end
114 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_record.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDRecord < DNSSD::Test
4 |
5 | def setup
6 | @fullname = 'blackjack._blackjack._tcp.test.'
7 | @IN = DNSSD::Record::IN
8 | @ipv4 = "\300\000\002\001".force_encoding("ascii-8bit")
9 | @ipv6 = " \001\r\270\000\000\000\000\000\000\000\000\000\000\000\001".force_encoding("ascii-8bit")
10 | @nowhere = "\007nowhere\007example\000".force_encoding("ascii-8bit")
11 |
12 | @R = DNSSD::Record
13 | end
14 |
15 | def test_class_to_data_invalid
16 | assert_raises ArgumentError do
17 | @R.to_data(-1)
18 | end
19 | end
20 |
21 | def test_class_to_data_A
22 | assert_equal @ipv4, @R.to_data(DNSSD::Record::A, '192.0.2.1')
23 | assert_equal @ipv4, @R.to_data(DNSSD::Record::A, IPAddr.new('192.0.2.1'))
24 |
25 | assert_raises ArgumentError do
26 | @R.to_data DNSSD::Record::A, '2001:db8::1'
27 | end
28 | end
29 |
30 | def test_idk
31 | a_variable = IPAddr.new '2001:db8::1'
32 | assert_equal @ipv6, a_variable.hton
33 | end
34 |
35 | def test_class_to_data_AAAA
36 | assert_equal @ipv6, @R.to_data(DNSSD::Record::AAAA, '2001:db8::1')
37 | assert_equal @ipv6,
38 | @R.to_data(DNSSD::Record::AAAA, IPAddr.new('2001:db8::1'))
39 |
40 | assert_raises ArgumentError do
41 | @R.to_data DNSSD::Record::AAAA, '192.0.2.1'
42 | end
43 | end
44 |
45 | def test_class_to_data_CNAME
46 | assert_equal @nowhere, @R.to_data(DNSSD::Record::CNAME, 'nowhere.example.')
47 | end
48 |
49 | def test_class_to_data_MX
50 | assert_equal "\000\010#{@nowhere}",
51 | @R.to_data(DNSSD::Record::MX, 8, 'nowhere.example.')
52 | end
53 |
54 | def test_class_to_data_NS
55 | assert_equal @nowhere, @R.to_data(DNSSD::Record::NS, 'nowhere.example.')
56 | end
57 |
58 | def test_class_to_data_PTR
59 | assert_equal @nowhere, @R.to_data(DNSSD::Record::PTR, 'nowhere.example.')
60 | end
61 |
62 | def test_class_to_data_SOA
63 | serial = 1
64 | refresh = 86400
65 | rtry = 3600
66 | expire = 86400 * 2
67 | minimum = 3600 * 12
68 |
69 | expected = "#{@nowhere}\002me#{@nowhere}#{[serial, refresh, rtry, expire, minimum].pack 'NNNNN'}"
70 |
71 | data = @R.to_data(DNSSD::Record::SOA, 'nowhere.example.',
72 | 'me.nowhere.example.', serial, refresh, rtry, expire,
73 | minimum)
74 |
75 | assert_equal expected, data
76 | end
77 |
78 | def test_class_to_data_SRV
79 | priority = 1
80 | weight = 5
81 | port = 1025
82 |
83 | expected = "#{[priority, weight, port].pack 'nnn'}#{@nowhere}"
84 |
85 | assert_equal expected,
86 | @R.to_data(DNSSD::Record::SRV, priority, weight, port,
87 | 'nowhere.example.')
88 | end
89 |
90 | def test_class_to_data_TXT
91 | assert_equal "\005Hello\006World!",
92 | @R.to_data(DNSSD::Record::TXT, 'Hello', 'World!')
93 | end
94 |
95 | end
96 |
97 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/test_parser.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'test/unit'
4 | require 'plist'
5 |
6 | class TestParser < Test::Unit::TestCase
7 | def test_Plist_parse_xml
8 | result = Plist::parse_xml("test/assets/AlbumData.xml")
9 |
10 | # dict
11 | assert_kind_of( Hash, result )
12 |
13 | expected = [
14 | "List of Albums",
15 | "Minor Version",
16 | "Master Image List",
17 | "Major Version",
18 | "List of Keywords",
19 | "Archive Path",
20 | "List of Rolls",
21 | "Application Version"
22 | ]
23 | assert_equal( expected.sort, result.keys.sort )
24 |
25 | # array
26 | assert_kind_of( Array, result["List of Rolls"] )
27 | assert_equal( [ {"PhotoCount"=>1,
28 | "KeyList"=>["7"],
29 | "Parent"=>999000,
30 | "Album Type"=>"Regular",
31 | "AlbumName"=>"Roll 1",
32 | "AlbumId"=>6}],
33 | result["List of Rolls"] )
34 |
35 | # string
36 | assert_kind_of( String, result["Application Version"] )
37 | assert_equal( "5.0.4 (263)", result["Application Version"] )
38 |
39 | # integer
40 | assert_kind_of( Integer, result["Major Version"] )
41 | assert_equal( 2, result["Major Version"] )
42 |
43 | # true
44 | assert_kind_of( TrueClass, result["List of Albums"][0]["Master"] )
45 | assert( result["List of Albums"][0]["Master"] )
46 |
47 | # false
48 | assert_kind_of( FalseClass, result["List of Albums"][1]["SlideShowUseTitles"] )
49 | assert( ! result["List of Albums"][1]["SlideShowUseTitles"] )
50 |
51 | end
52 |
53 | # uncomment this test to work on speed optimization
54 | #def test_load_something_big
55 | # plist = Plist::parse_xml( "~/Pictures/iPhoto Library/AlbumData.xml" )
56 | #end
57 |
58 | # date fields are credited to
59 | def test_date_fields
60 | result = Plist::parse_xml("test/assets/Cookies.plist")
61 | assert_kind_of( DateTime, result.first['Expires'] )
62 | assert_equal DateTime.parse( "2007-10-25T12:36:35Z" ), result.first['Expires']
63 | end
64 |
65 | # bug fix for empty
66 | # reported by Matthias Peick
67 | # reported and fixed by Frederik Seiffert
68 | def test_empty_dict_key
69 | data = Plist::parse_xml("test/assets/test_empty_key.plist");
70 | assert_equal("2", data['key']['subkey'])
71 | end
72 |
73 | # bug fix for decoding entities
74 | # reported by Matthias Peick
75 | def test_decode_entities
76 | data = Plist::parse_xml('Fish & Chips')
77 | assert_equal('Fish & Chips', data)
78 | end
79 |
80 | def test_comment_handling_and_empty_plist
81 | assert_nothing_raised do
82 | assert_nil( Plist::parse_xml( File.read('test/assets/commented.plist') ) )
83 | end
84 | end
85 |
86 | def test_filename_or_xml_is_stringio
87 | require 'stringio'
88 |
89 | str = StringIO.new
90 | data = Plist::parse_xml(str)
91 |
92 | assert_nil data
93 | end
94 |
95 | end
96 |
97 | __END__
98 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/Cookies.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Created
7 | 151936595.697543
8 | Domain
9 | .cleveland.com
10 | Expires
11 | 2007-10-25T12:36:35Z
12 | Name
13 | CTC
14 | Path
15 | /
16 | Value
17 | :broadband:
18 |
19 |
20 | Created
21 | 151778895.063041
22 | Domain
23 | .gamefaqs.com
24 | Expires
25 | 2006-04-21T16:47:58Z
26 | Name
27 | ctk
28 | Path
29 | /
30 | Value
31 | NDM1YmJlYmU0NjZiOGYxZjc1NjgxODg0YmRkMA%3D%3D
32 |
33 |
34 | Created
35 | 183530456
36 | Domain
37 | arstechnica.com
38 | Expires
39 | 2006-10-26T13:56:36Z
40 | Name
41 | fontFace
42 | Path
43 | /
44 | Value
45 | 1
46 |
47 |
48 | Created
49 | 183004526
50 | Domain
51 | .sourceforge.net
52 | Expires
53 | 2006-10-20T02:35:26Z
54 | Name
55 | FRQSTR
56 | Path
57 | /
58 | Value
59 | 18829595x86799:1:1440x87033:1:1440x86799:1:1440x87248:1:1440|18829595|18829595|18829595|18829595
60 |
61 |
62 | Created
63 | 151053128.640531
64 | Domain
65 | .tvguide.com
66 | Expires
67 | 2025-10-10T07:12:17Z
68 | Name
69 | DMSEG
70 | Path
71 | /
72 | Value
73 | 1BDF3D1CC07FC70F&D04451&434EC763&4351FD51&0&
74 |
75 |
76 | Created
77 | 151304125.760261
78 | Domain
79 | .code.blogspot.com
80 | Expires
81 | 2038-01-18T00:00:00Z
82 | Name
83 | __utma
84 | Path
85 | /
86 | Value
87 | 11680422.1172819419.1129611326.1129611326.1129611326.1
88 |
89 |
90 | Created
91 | 599529600
92 | Domain
93 | .tvguide.com
94 | Expires
95 | 2020-01-01T00:00:00Z
96 | Name
97 | gfm
98 | Path
99 | /
100 | Value
101 | 0
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/record.rb:
--------------------------------------------------------------------------------
1 | require 'ipaddr'
2 |
3 | ##
4 | # Created when adding a DNS record using DNSSD::Service#add_record. Provides
5 | # convenience methods for creating the DNS record.
6 | #
7 | # See also {RFC 1035}[http://www.rfc-editor.org/rfc/rfc1035.txt]
8 |
9 | class DNSSD::Record
10 |
11 | value_to_name = constants.map do |name|
12 | next if name.intern == :IN
13 | [const_get(name), name.to_s]
14 | end.compact.flatten
15 |
16 | ##
17 | # Maps record constant values to the constant name
18 |
19 | VALUE_TO_NAME = Hash[*value_to_name]
20 |
21 | ##
22 | # Turns +string+ into an RFC-1035 character-string
23 |
24 | def self.string_to_character_string(string)
25 | length = string.length
26 | raise ArgumentError, "#{string.inspect} is too long (255 bytes max)" if
27 | length > 255
28 | "#{length.chr}#{string}"
29 | end
30 |
31 | ##
32 | # Turns +string+ into an RFC-1035 domain-name
33 |
34 | def self.string_to_domain_name(string)
35 | string.split('.').map do |part|
36 | string_to_character_string part
37 | end.join('') << "\0"
38 | end
39 |
40 | ##
41 | # Encodes resource +args+ into +type+. Handles:
42 | #
43 | # A AAAA CNAME MX NS PTR SOA SRV TXT
44 |
45 | def self.to_data(type, *args)
46 | raise ArgumentError, "unknown type #{type}" unless VALUE_TO_NAME.key? type
47 |
48 | data = case type
49 | when A then
50 | addr = args.shift
51 | addr = IPAddr.new addr unless IPAddr === addr
52 | raise ArgumentError, "#{addr} is not IPv4" unless addr.ipv4?
53 | addr.hton
54 | when AAAA then
55 | addr = args.shift
56 | addr = IPAddr.new addr unless IPAddr === addr
57 | raise ArgumentError, "#{addr} is not IPv6" unless addr.ipv6?
58 | addr.hton
59 | when CNAME, NS, PTR then
60 | string_to_domain_name args.shift
61 | when MX then
62 | [args.shift, string_to_domain_name(args.shift)].pack 'na*'
63 | when SOA then
64 | [
65 | string_to_domain_name(args.shift),
66 | string_to_domain_name(args.shift),
67 | args.shift, args.shift, args.shift, args.shift, args.shift
68 | ].pack 'a*a*NNNNN'
69 | when SRV then
70 | [
71 | args.shift, args.shift, args.shift,
72 | string_to_domain_name(args.shift)
73 | ].pack 'nnna*'
74 | when TXT then
75 | data = args.map do |string|
76 | string_to_character_string string
77 | end.join ''
78 |
79 | raise ArgumentError,
80 | "TXT record too long (#{data.length} bytes)" if
81 | data.length > 65535
82 |
83 | args.clear
84 |
85 | data
86 | else
87 | raise ArgumentError, "unhandled record type #{VALUE_TO_NAME[type]}"
88 | end
89 |
90 | raise ArgumentError, "Too many arguments for #{VALUE_TO_NAME[type]}" unless
91 | args.empty?
92 |
93 | data
94 | end
95 |
96 | end
97 |
98 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/colorize-0.7.7/README.md:
--------------------------------------------------------------------------------
1 | colorize [](http://badge.fury.io/rb/colorize) [](https://travis-ci.org/fazibear/colorize) [](https://codeclimate.com/github/fazibear/colorize) [](https://codeclimate.com/github/fazibear/colorize)
2 | ========
3 |
4 | Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences.
5 |
6 | features
7 | --------
8 |
9 | * change string color
10 | * change string background
11 | * change string effect
12 |
13 | usage
14 | -----
15 |
16 | Some usage samples:
17 |
18 | ```ruby
19 | puts "This is blue".colorize(:blue)
20 | puts "This is light blue".colorize(:light_blue)
21 | puts "This is also blue".colorize(:color => :blue)
22 | puts "This is light blue with red background".colorize(:color => :light_blue, :background => :red)
23 | puts "This is light blue with red background".colorize(:light_blue ).colorize( :background => :red)
24 | puts "This is blue text on red".blue.on_red
25 | puts "This is red on blue".colorize(:red).on_blue
26 | puts "This is red on blue and underline".colorize(:red).on_blue.underline
27 | puts "This is blue text on red".blue.on_red.blink
28 | puts "This is uncolorized".blue.on_red.uncolorize
29 | ```
30 |
31 | Class methods:
32 |
33 | ```ruby
34 | String.colors # return array of all possible colors names
35 | String.modes # return array of all possible modes
36 | String.color_samples # displays color samples in all combinations
37 | String.disable_colorization # check if colorization is disabled
38 | String.disable_colorization = false # enable colorization
39 | String.disable_colorization false # enable colorization
40 | String.disable_colorization = true # disable colorization
41 | String.disable_colorization true # disable colorization
42 | ```
43 |
44 | requirements
45 | ------------
46 |
47 | * Win32/Console/ANSI (for Windows)
48 |
49 | install
50 | -------
51 |
52 | * gem install colorize
53 |
54 | *Note:* You may need to use sudo to install gems
55 |
56 | license
57 | -------
58 |
59 | Copyright (C) 2007-2015 Michał Kalbarczyk
60 |
61 | This program is free software; you can redistribute it and/or modify
62 | it under the terms of the GNU General Public License as published by
63 | the Free Software Foundation; either version 2 of the License, or
64 | (at your option) any later version.
65 |
66 | This program is distributed in the hope that it will be useful,
67 | but WITHOUT ANY WARRANTY; without even the implied warranty of
68 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69 | GNU General Public License for more details.
70 |
71 | You should have received a copy of the GNU General Public License along
72 | with this program; if not, write to the Free Software Foundation, Inc.,
73 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
74 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/colorize-0.7.7/lib/colorize/class_methods.rb:
--------------------------------------------------------------------------------
1 | module Colorize
2 | module ClassMethods
3 |
4 | #
5 | # Property to disable colorization
6 | #
7 | def disable_colorization(value = nil)
8 | if value.nil?
9 | @disable_colorization || false
10 | else
11 | @disable_colorization = (value || false)
12 | end
13 | end
14 |
15 | #
16 | # Setter for disable colorization
17 | #
18 | def disable_colorization=(value)
19 | @disable_colorization = (value || false)
20 | end
21 |
22 | #
23 | # Return array of available colors used by colorize
24 | #
25 | def colors
26 | color_codes.keys
27 | end
28 |
29 | #
30 | # Return array of available modes used by colorize
31 | #
32 | def modes
33 | mode_codes.keys
34 | end
35 |
36 | #
37 | # Display color samples
38 | #
39 | def color_samples
40 | colors.permutation(2).each do |background, color|
41 | sample_text = "#{color.inspect.rjust(15)} on #{background.inspect.ljust(15)}"
42 | puts "#{sample_text.colorize(:color => color, :background => background)} #{sample_text}"
43 | end
44 | end
45 |
46 | #
47 | # Method removed, raise NoMethodError
48 | #
49 | def color_matrix(txt = '')
50 | fail NoMethodError, '#color_matrix method was removed, try #color_samples instead'
51 | end
52 |
53 | # private
54 |
55 | #
56 | # Color codes hash
57 | #
58 | def color_codes
59 | {
60 | :black => 0, :light_black => 60,
61 | :red => 1, :light_red => 61,
62 | :green => 2, :light_green => 62,
63 | :yellow => 3, :light_yellow => 63,
64 | :blue => 4, :light_blue => 64,
65 | :magenta => 5, :light_magenta => 65,
66 | :cyan => 6, :light_cyan => 66,
67 | :white => 7, :light_white => 67,
68 | :default => 9
69 | }
70 | end
71 |
72 | #
73 | # Mode codes hash
74 | #
75 | def mode_codes
76 | {
77 | :default => 0, # Turn off all attributes
78 | :bold => 1, # Set bold mode
79 | :underline => 4, # Set underline mode
80 | :blink => 5, # Set blink mode
81 | :swap => 7, # Exchange foreground and background colors
82 | :hide => 8 # Hide text (foreground color would be the same as background)
83 | }
84 | end
85 |
86 | #
87 | # Generate color and on_color methods
88 | #
89 | def color_methods
90 | colors.each do |key|
91 | next if key == :default
92 |
93 | define_method key do
94 | colorize(:color => key)
95 | end
96 |
97 | define_method "on_#{key}" do
98 | colorize(:background => key)
99 | end
100 | end
101 | end
102 |
103 | #
104 | # Generate modes methods
105 | #
106 | def modes_methods
107 | modes.each do |key|
108 | next if key == :default
109 |
110 | define_method key do
111 | colorize(:mode => key)
112 | end
113 | end
114 | end
115 | end
116 | end
117 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_flags.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDFlags < DNSSD::Test
4 |
5 | def setup
6 | @flags = DNSSD::Flags.new
7 | end
8 |
9 | def test_accessors
10 | DNSSD::Flags.constants.each do |name|
11 | next unless name =~ /[a-z]/
12 | attr = name.to_s.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
13 |
14 | assert_respond_to @flags, "#{attr}="
15 | assert_respond_to @flags, "#{attr}?"
16 | end
17 | end
18 |
19 | def test_add_eh
20 | refute @flags.add?
21 |
22 | @flags.add = true
23 |
24 | assert @flags.add?
25 | end
26 |
27 | def test_add_equals
28 | @flags.add = true
29 |
30 | assert_equal DNSSD::Flags::Add, @flags
31 |
32 | @flags.add = false
33 |
34 | assert_equal 0, @flags
35 | end
36 |
37 | def test_default_eh
38 | refute @flags.default?
39 |
40 | @flags.default = true
41 |
42 | assert @flags.default?
43 | end
44 |
45 | def test_default_equals
46 | @flags.default = true
47 |
48 | assert_equal DNSSD::Flags::Default, @flags
49 |
50 | @flags.default = false
51 |
52 | assert_equal 0, @flags
53 | end
54 |
55 | def test_clear_flag
56 | @flags.set_flag DNSSD::Flags::Add
57 | @flags.set_flag DNSSD::Flags::Default
58 |
59 | @flags.clear_flag DNSSD::Flags::Add
60 |
61 | assert_equal DNSSD::Flags::Default, @flags
62 | end
63 |
64 | def test_complement
65 | new_flags = ~@flags
66 |
67 | assert_equal DNSSD::Flags.new(*DNSSD::Flags::ALL_FLAGS), new_flags
68 | end
69 |
70 | def test_equals
71 | assert_equal @flags, DNSSD::Flags.new
72 | refute_equal @flags, DNSSD::Flags.new(DNSSD::Flags::Add)
73 |
74 | @flags.add = true
75 | @flags.default = true
76 |
77 | assert_equal @flags, (DNSSD::Flags::Add | DNSSD::Flags::Default)
78 | assert_equal @flags, (DNSSD::Flags::Add | DNSSD::Flags::Default)
79 | end
80 |
81 | def test_inspect
82 | assert_equal '#', @flags.inspect
83 |
84 | @flags.add = true
85 | @flags.default = true
86 |
87 | assert_equal '#', @flags.inspect
88 | end
89 |
90 | def test_intersection
91 | new_flags = @flags & DNSSD::Flags::Add
92 |
93 | assert_equal @flags, new_flags
94 |
95 | @flags.default = true
96 |
97 | new_flags = @flags & DNSSD::Flags::Default
98 |
99 | assert_equal @flags, new_flags
100 |
101 | assert_equal new_flags, (new_flags & new_flags)
102 | end
103 |
104 | def test_set_flag
105 | @flags.set_flag DNSSD::Flags::Add
106 |
107 | assert_equal DNSSD::Flags::Add, @flags
108 | end
109 |
110 | def test_to_a
111 | assert_equal [], @flags.to_a
112 |
113 | @flags.add = true
114 | @flags.default = true
115 |
116 | assert_equal %w[add default], @flags.to_a.sort
117 | end
118 |
119 | def test_to_i
120 | assert_equal 0, @flags.to_i
121 |
122 | @flags.add = true
123 | @flags.default = true
124 |
125 | assert_equal 6, @flags.to_i
126 | end
127 |
128 | def test_union
129 | new_flags = @flags | DNSSD::Flags::Add
130 |
131 | assert_equal DNSSD::Flags.new(DNSSD::Flags::Add), new_flags
132 |
133 | new_flags = new_flags | DNSSD::Flags::Default
134 |
135 | assert_equal DNSSD::Flags.new(DNSSD::Flags::Add, DNSSD::Flags::Default),
136 | new_flags
137 |
138 | assert_equal new_flags, (new_flags | new_flags)
139 | end
140 |
141 | end
142 |
143 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/History.txt:
--------------------------------------------------------------------------------
1 | === 2.0.1 / 2015-01-08
2 |
3 | * Bug fix:
4 | * Use rb_thread_fd_select() with a timeout instead of rb_thread_wait_fd()
5 | which allows DNSSD#service to stop in a timely manner. Fixes #10 by Mick
6 | Staugaard, #13 by Linux-cpp-lisp
7 | * Document necessary dependencies for dnssd on debian. Issue #14 by
8 | elmatou.
9 |
10 | === 2.0 / 2011-03-02
11 |
12 | * Major enhancment
13 | * DNSSD::Service#process now automatically stops the DNSSD::Service.
14 |
15 | === 1.4 / 2010-09-07
16 |
17 | * Minor enhancements
18 | * Where Encoding is available dnssd now converts to/from UTF-8.
19 |
20 | === 1.3.4 / 2010-08-29
21 |
22 | * Bug fixes
23 | * Fixed installation of dnssd shared object at gem build time
24 | * Fixed 64 -> 32 bit truncation warnings
25 |
26 | === 1.3.3 / 2010-08-29
27 |
28 | * Bug fixes
29 | * Fix LocalJumpError issue on 1.9. Patch by Tim Lucas.
30 | * Force reverse lookup on 1.9 for tests. Patch by Tim Lucas.
31 | * Fix default protocol for DNSSD::Service.getaddrinfo to prevent a crash.
32 | Patch by Adam Elliot.
33 | * Possibly fix solaris compilation by adding -lxnet. Issue #5 by Pedro
34 | Palazón Candel.
35 |
36 | === 1.3.2 / 2010-08-28
37 |
38 | * Bug fixes
39 | * 1.9 compatibility
40 |
41 | === 1.3.1 / 2009-10-13
42 |
43 | * Bug fixes
44 | * Fix regexp for parsing the fullname. Patch by James Sadler.
45 |
46 | === 1.3 / 2009-08-18
47 |
48 | * 4 major enhancements
49 | * Added DNSSD::Service.get_property
50 | * Added DNSSD::Service#getaddrinfo
51 | * Added DNSSD::Service#add_record
52 | * Added DNSSD::Service#query_record
53 |
54 | * 5 minor enhancements
55 | * DNSSD::Reply#connect now uses DNSSD::Service#getaddrinfo (faster)
56 | * DNSSD::Service#register behaves properly when blockless
57 | * Broke up DNSSD::Reply into specific subclasses
58 | * Added sample/query_record.rb
59 | * sample/*.rb work with each other now for clarity of implementation
60 |
61 | * 2 bug fixes
62 | * Fix hierarchical domains like \.mac\.name.members.mac.com.
63 | * Fix compilation against avahi 0.6.25
64 |
65 | === 1.2 / 2009-08-11
66 |
67 | * 4 major enhancements
68 | * DNSSD::Service is now directly instantiable
69 | * DNSSD.announce which registers a server socket you've created
70 | * DNSSD::Reply.connect which connects to a browsed service
71 | * Fix asynchronous service shutdown crash
72 |
73 | * 8 minor enhancements
74 | * DNSSD.resolve now optionally accepts a DNSSD::Reply from DNSSD.browse
75 | * Use rb_thread_wait_fd instead of custom rb_thread_select code
76 | * DNSSD::Reply#protocol and DNSSD::Reply#service_name
77 | * Added missing error classes
78 | * Added missing InterfaceUnicast constant
79 | * Improved Documentation
80 | * Use C constants in ext/dnssd/errors.c
81 | * Reduced C code in ext/dnssd/service.c for greater control. See
82 | DNSSD::Service
83 |
84 | * 4 bug fixes
85 | * Don't invoke block on callback if none was provided
86 | * Remove ext/dnssd/dns_sd.h so the correct header is used
87 | * DNSSD::NoMemoryError is now raised instead of NoMemError
88 | * DNSSD::ReferenceUsedError is now correctly named DNSSD::RefusedError
89 |
90 | === 1.1.0 / 2009-08-10
91 |
92 | * 2 major enhancements
93 | * Packaging files that need to be here
94 | * Increased the version number
95 |
96 | * 1 minor enhancement
97 | * Less C codes
98 |
99 | * 1 bug fix
100 | * Increased INTERNET!
101 |
102 | === 0.7.2 / 2009-08-05
103 |
104 | * 1 major enhancement
105 | * 1.9 compatibility
106 |
107 |
--------------------------------------------------------------------------------
/plugin/SparklingHelper.xcplugin/Contents/Resources/SparklingHelper.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
46 |
47 |
48 |
49 |
61 |
64 |
65 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/bin/brew-sparkling:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # brew-sparkling
4 | #
5 | # bash shim to invoke brew-sparkling-cmd.rb
6 | #
7 | # Copy from homebrew-cask
8 |
9 | ###
10 | ### settings
11 | ###
12 |
13 | set -e
14 | set -o pipefail
15 | set +o histexpand
16 | set -o nounset
17 | shopt -s nocasematch
18 | shopt -s nullglob
19 | shopt -s dotglob
20 |
21 | ###
22 | ### functions
23 | ###
24 |
25 | warn () {
26 | local message="$@"
27 | message="${message//\\t/$'\011'}"
28 | message="${message//\\n/$'\012'}"
29 | message="${message%"${message##*[![:space:]]}"}"
30 | printf "%s\n" "$message" 1>&2
31 | }
32 |
33 | die () {
34 | warn "$@"
35 | exit 1
36 | }
37 |
38 | resolve_dir () {
39 | local resolved="$(for dir; do cd "$dir"; done && /bin/pwd -P)"
40 | if [[ -d "$resolved" ]]; then
41 | printf "%s" "$resolved"
42 | else
43 | die "cannot resolve: '$@'"
44 | fi
45 | }
46 |
47 | ensure_dir () {
48 | local dir="$1"
49 | local message
50 | shift
51 |
52 | if [ "$#" -gt 0 ]; then
53 | message="$@"
54 | else
55 | message="brew-sparkling: no such directory: '$dir'"
56 | fi
57 | if ! [[ -d "$dir" ]]; then
58 | die "$message"
59 | fi
60 | }
61 |
62 | ensure_file () {
63 | local file="$1"
64 | local message
65 | shift
66 |
67 | if [ "$#" -gt 0 ]; then
68 | message="$@"
69 | else
70 | message="brew-sparkling: no such file: '$file'"
71 | fi
72 | if ! [[ -f "$file" ]]; then
73 | die "$message"
74 | fi
75 | }
76 |
77 | find_ruby_2_plus () {
78 | declare -a rubies
79 | local favorite_ruby="/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby"
80 | local version_str
81 |
82 | if [[ -x "$favorite_ruby" ]]; then
83 | printf "%s" "$favorite_ruby"
84 | else
85 | IFS=$'\n' rubies=( $(/usr/bin/type -aP ruby) \
86 | "/usr/local/bin/ruby" \
87 | "$(brew --prefix 2>/dev/null)/bin/ruby" )
88 | for ruby in "${rubies[@]}"; do
89 | version_str="$("$ruby" --version 2>/dev/null)"
90 | if [[ "$version_str" =~ ^ruby.2 ]]; then
91 | printf "%s" "$ruby"
92 | break
93 | fi
94 | done
95 | fi
96 | }
97 |
98 | ###
99 | ### main
100 | ###
101 |
102 | _brew_sparkling () {
103 | local script_dir
104 | local symlink_target
105 | local symlink_target_dir
106 | local brewsparkling_lib_dir
107 | local brewsparkling_command
108 | local interpreter
109 | declare -a ruby_opts
110 |
111 | ruby_opts=( "-W0" "-EUTF-8:UTF-8" )
112 |
113 | script_dir="$(resolve_dir "${0%/*}")"
114 | ensure_dir "$script_dir" \
115 | "brew-sparkling: could not resolve script directory"
116 |
117 | # return "." in case we are not a link
118 | symlink_target="$(/usr/bin/readlink "$0" || echo ".")"
119 |
120 | # redefine script_dir because we are likely to be a relative link
121 | symlink_target_dir="$(/usr/bin/dirname "$symlink_target")"
122 | script_dir="$(resolve_dir "$script_dir" "$symlink_target_dir")"
123 | ensure_dir "$script_dir" \
124 | "brew-sparkling: could not resolve script directory"
125 |
126 | # The Homebrew install process replaces the lib element below with rubylib
127 | brewsparkling_lib_dir="$(resolve_dir "$script_dir"/../lib)"
128 | ensure_dir "$brewsparkling_lib_dir" \
129 | "brew-sparkling: could not resolve homebrew-sparkling library directory"
130 |
131 | brewsparkling_command="$brewsparkling_lib_dir/brew-sparkling-cmd.rb"
132 | ensure_file "$brewsparkling_command" \
133 | "brew-sparkling: could not find brew-sparkling-cmd.rb in '$brewsparkling_lib_dir'"
134 |
135 | exec "ruby" "${ruby_opts[@]}" "$brewsparkling_command" "${@}"
136 | }
137 |
138 | ###
139 | ### initialization
140 | ###
141 |
142 | unset GEM_HOME
143 | unset GEM_PATH
144 |
145 | ###
146 | ### dispatch
147 | ###
148 |
149 | _brew_sparkling "${@:-}"
150 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/test_data_elements.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'test/unit'
4 | require 'plist'
5 | require 'stringio'
6 |
7 | class MarshalableObject
8 | attr_accessor :foo
9 |
10 | def initialize(str)
11 | @foo = str
12 | end
13 | end
14 |
15 | class TestDataElements < Test::Unit::TestCase
16 |
17 | def setup
18 | @result = Plist.parse_xml( 'test/assets/test_data_elements.plist' )
19 | end
20 |
21 | def test_data_object_header
22 | expected = < element below contains a Ruby object which has been serialized with Marshal.dump. -->
24 |
25 | BAhvOhZNYXJzaGFsYWJsZU9iamVjdAY6CUBmb28iHnRoaXMgb2JqZWN0IHdhcyBtYXJz
26 | aGFsZWQ=
27 |
28 | END
29 | expected_elements = expected.chomp.split( "\n" )
30 |
31 | actual = Plist::Emit.dump( Object.new, false )
32 | actual_elements = actual.chomp.split( "\n" )
33 |
34 | # check for header
35 | assert_equal expected_elements.shift, actual_elements.shift
36 |
37 | # check for opening and closing data tags
38 | assert_equal expected_elements.shift, actual_elements.shift
39 | assert_equal expected_elements.pop, actual_elements.pop
40 | end
41 |
42 | def test_marshal_round_trip
43 | expected = MarshalableObject.new('this object was marshaled')
44 | actual = Plist.parse_xml( Plist::Emit.dump(expected, false) )
45 |
46 | assert_kind_of expected.class, actual
47 | assert_equal expected.foo, actual.foo
48 | end
49 |
50 | def test_generator_io_and_file
51 | expected = <
53 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
54 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
55 |
56 | END
57 |
58 | expected.chomp!
59 |
60 | fd = IO.sysopen('test/assets/example_data.bin')
61 | io = IO.open(fd, 'r')
62 |
63 | # File is a subclass of IO, so catching IO in the dispatcher should work for File as well...
64 | f = File.open('test/assets/example_data.bin')
65 |
66 | assert_equal expected, Plist::Emit.dump(io, false).chomp
67 | assert_equal expected, Plist::Emit.dump(f, false).chomp
68 |
69 | assert_instance_of StringIO, @result['io']
70 | assert_instance_of StringIO, @result['file']
71 |
72 | io.rewind
73 | f.rewind
74 |
75 | assert_equal io.read, @result['io'].read
76 | assert_equal f.read, @result['file'].read
77 |
78 | io.close
79 | f.close
80 | end
81 |
82 | def test_generator_string_io
83 | expected = <
85 | dGhpcyBpcyBhIHN0cmluZ2lvIG9iamVjdA==
86 |
87 | END
88 |
89 | sio = StringIO.new('this is a stringio object')
90 |
91 | assert_equal expected.chomp, Plist::Emit.dump(sio, false).chomp
92 |
93 | assert_instance_of StringIO, @result['stringio']
94 |
95 | sio.rewind
96 | assert_equal sio.read, @result['stringio'].read
97 | end
98 |
99 | # this functionality is credited to Mat Schaffer,
100 | # who discovered the plist with the data tag
101 | # supplied the test data, and provided the parsing code.
102 | def test_data
103 | # test reading plist elements
104 | data = Plist::parse_xml("test/assets/example_data.plist");
105 | assert_equal( File.open("test/assets/example_data.jpg"){|f| f.read }, data['image'].read )
106 |
107 | # test writing data elements
108 | expected = File.read("test/assets/example_data.plist")
109 | result = data.to_plist
110 | #File.open('result.plist', 'w') {|f|f.write(result)} # debug
111 | assert_equal( expected, result )
112 |
113 | # Test changing the object in the plist to a StringIO and writing.
114 | # This appears extraneous given that plist currently returns a StringIO,
115 | # so the above writing test also flexes StringIO#to_plist_node.
116 | # However, the interface promise is to return an IO, not a particular class.
117 | # plist used to return Tempfiles, which was changed solely for performance reasons.
118 | data['image'] = StringIO.new( File.read("test/assets/example_data.jpg"))
119 |
120 | assert_equal(expected, data.to_plist )
121 |
122 | end
123 |
124 | end
125 |
--------------------------------------------------------------------------------
/recipe/Cling.rb:
--------------------------------------------------------------------------------
1 | class Cling < BrewSparkling::Recipe::Builder
2 | github 'suer/cling', branch: '3be2bf34ac19413e503ca1d9b83f71401915ac4c'
3 | description 'a web page viewer on iOS, that rotates sites every minutes.'
4 | version '1.0'
5 | bundle_identifiers %w(org.codefirst.cling org.codefirst.cling.AddToClingActionExtension)
6 |
7 | def build
8 | pod 'install'
9 | xcodebuild_archive(scheme: 'cling', workspace: 'cling.xcworkspace')
10 | end
11 |
12 | patch :DATA
13 | end
14 |
15 | __END__
16 | diff --git a/AddToClingActionExtension/AddToClingActionExtension.entitlements b/AddToClingActionExtension/AddToClingActionExtension.entitlements
17 | index ee6b1c8..0c67376 100644
18 | --- a/AddToClingActionExtension/AddToClingActionExtension.entitlements
19 | +++ b/AddToClingActionExtension/AddToClingActionExtension.entitlements
20 | @@ -1,10 +1,5 @@
21 |
22 |
23 |
24 | -
25 | - com.apple.security.application-groups
26 | -
27 | - group.org.codefirst.ClingExtension
28 | -
29 | -
30 | +
31 |
32 | diff --git a/cling.xcodeproj/project.pbxproj b/cling.xcodeproj/project.pbxproj
33 | index e645289..c9ccfe9 100644
34 | --- a/cling.xcodeproj/project.pbxproj
35 | +++ b/cling.xcodeproj/project.pbxproj
36 | @@ -382,7 +382,7 @@
37 | CreatedOnToolsVersion = 6.0;
38 | SystemCapabilities = {
39 | com.apple.ApplicationGroups.iOS = {
40 | - enabled = 1;
41 | + enabled = 0;
42 | };
43 | };
44 | };
45 | @@ -390,7 +390,7 @@
46 | CreatedOnToolsVersion = 6.0;
47 | SystemCapabilities = {
48 | com.apple.ApplicationGroups.iOS = {
49 | - enabled = 1;
50 | + enabled = 0;
51 | };
52 | };
53 | };
54 | @@ -580,7 +580,6 @@
55 | buildSettings = {
56 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
57 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
58 | - CODE_SIGN_ENTITLEMENTS = AddToClingActionExtension/AddToClingActionExtension.entitlements;
59 | CODE_SIGN_IDENTITY = "iPhone Developer";
60 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
61 | GCC_PREPROCESSOR_DEFINITIONS = (
62 | @@ -600,7 +599,6 @@
63 | buildSettings = {
64 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
65 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
66 | - CODE_SIGN_ENTITLEMENTS = AddToClingActionExtension/AddToClingActionExtension.entitlements;
67 | CODE_SIGN_IDENTITY = "iPhone Developer";
68 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
69 | INFOPLIST_FILE = AddToClingActionExtension/Info.plist;
70 | @@ -697,7 +695,6 @@
71 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
72 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
73 | CLANG_ENABLE_MODULES = YES;
74 | - CODE_SIGN_ENTITLEMENTS = cling/cling.entitlements;
75 | CODE_SIGN_IDENTITY = "iPhone Developer";
76 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
77 | INFOPLIST_FILE = cling/Info.plist;
78 | @@ -717,7 +714,6 @@
79 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
80 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
81 | CLANG_ENABLE_MODULES = YES;
82 | - CODE_SIGN_ENTITLEMENTS = cling/cling.entitlements;
83 | CODE_SIGN_IDENTITY = "iPhone Developer";
84 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
85 | INFOPLIST_FILE = cling/Info.plist;
86 | diff --git a/cling/cling.entitlements b/cling/cling.entitlements
87 | index ee6b1c8..0c67376 100644
88 | --- a/cling/cling.entitlements
89 | +++ b/cling/cling.entitlements
90 | @@ -1,10 +1,5 @@
91 |
92 |
93 |
94 | -
95 | - com.apple.security.application-groups
96 | -
97 | - group.org.codefirst.ClingExtension
98 | -
99 | -
100 | +
101 |
102 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/CHANGELOG:
--------------------------------------------------------------------------------
1 | = plist - All-purpose Property List manipulation library
2 |
3 | === Release version 3.0.0!
4 |
5 | 2010-02-23:
6 | * Ruby 1.9.x compatibility!
7 |
8 | 2010-02-16:
9 | * excise a bunch of unnecessary @@ variables
10 | * fix up some tests for cross-version compatibility
11 |
12 | 2010-02-14:
13 | * generalized cleanup:
14 | * fix old file headers
15 | * modernize rakefile
16 | * clean up rdoc
17 |
18 | 2010-01-08:
19 | * move from RubyForge Subversion to GitHub
20 |
21 | 2007-02-22 (r81):
22 | * make the plist parser accept strings contain XML or any object that responds to #read (File and StringIO being the intended targets here). Test and idea contributed by Chuck Remes.
23 |
24 | 2006-09-20 (r80):
25 | * tweak a comment in generator.rb to make it clear that we're not using Base64.b64encode because it's broken.
26 |
27 | === Release version 3.0.0!
28 |
29 | 2006-09-20 (r77 - r79):
30 | * move IndentedString inside Plist::Emit and :nodoc: it
31 | * Tag 3.0.0! (from rev 78)
32 |
33 | 2006-09-19 (r73 - r75):
34 | * Really fix the rakefile this time (apparently I deleted some code that I needed...)
35 | * alter the fix_whitespace rake task to ignore the assets directory
36 | * cleanup whitespace
37 |
38 | 2006-09-18 (r70 - r72):
39 | * Update this file ;)
40 | * Fix Rakefile
41 | * gem install -t now works correctly
42 | * Remove super-sekr1t rdoc staging area from rdoc publishing task
43 |
44 | 2006-09-15 (r64 - r69):
45 | * Change behavior of empty collection elements to match What Apple Does
46 | * Fix some gem packaging infrastructure
47 |
48 | 2006-09-13 (r61 - r63):
49 | * Merge generator injection removal branch into trunk!
50 |
51 | 2006-09-13 (r52 - r60):
52 | * Fix indentation/newlines in generator (finally!)
53 | * Refix indentation to be more faithful to the way Apple emits their plists
54 | * Remove horrific regex and replace it with proper comment parsing
55 | * Empty plists return nil when parsed
56 | * Sort hash keys before emitting (now we can test multi-element hashes!)
57 | * Inject #<=> into Symbol so that sorting Symbol-keyed hashes won't freak out
58 |
59 | 2006-09-12 (r47 - r51):
60 | * More test rejiggering
61 | * New tests to expose some bugs
62 |
63 | 2006-09-10 (r33 - r46):
64 | * Update tests for new generator code
65 | * Rejigger some tests
66 | * Make the generator try to call #to_plist_node on any object it tries to serialize, thus allowing class authors to define how their objects will be serialized
67 | * Marshal.dump unrecognized objects into elements
68 | * Make the parser strip out comments and Marshal.load elements if possible
69 | * Update some rdoc
70 |
71 | === Release version 2.1.1!
72 |
73 | 2006-09-10 (r31 - r32):
74 | * Added encoding / decoding for entities (& etc)
75 | * Changed parsing of elements to return StringIO objects
76 | * Fixed bug with empty tags
77 |
78 | 2006-08-24 (r25 - r30):
79 | * Invert ownership of methods in the generator, allowing us to remove the self.extend(self)
80 | * New branch to remove method inject from parser
81 |
82 | 2006-08-23 (r22 - r24):
83 | * Add rcov task to Rakefile
84 | * Add some tests
85 |
86 | 2006-08-20 (r9 - r21):
87 | * Add a bunch of rdoc and rdoc infrastructure
88 | * Add rake task to clean up errant whitespace
89 | * Spin off a branch to remove a bunch of method injection in the generator code
90 | * Rename some tests for clarity's sake
91 | * Replace NARF generation code with Ben's generation code
92 | * Update tests
93 | * This broke indentation (will be fixed later)
94 | * Add Plist::Emit.dump, so you can dump objects which don't include Plist::Emit, update tests to match
95 | * Fix a bug with the method that wraps output in the plist header/footer
96 |
97 | 2006-08-19 (r1 - r8):
98 | * The beginnings of merging the plist project into the NARF plist library (under the plist project's name)
99 | * fancier project infrastructure (more tests, Rakefile, the like)
100 | * Add/update copyright notices in the source files
101 | * Move a bunch of documentation out to README
102 | * Split library into chunks
103 | * Properly delete files when cleaning up from tests
104 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/colorize-0.7.7/lib/colorize/instance_methods.rb:
--------------------------------------------------------------------------------
1 | module Colorize
2 | module InstanceMethods
3 |
4 | #
5 | # Change color of string
6 | #
7 | # Examples:
8 | #
9 | # puts "This is blue".colorize(:blue)
10 | # puts "This is light blue".colorize(:light_blue)
11 | # puts "This is also blue".colorize(:color => :blue)
12 | # puts "This is light blue with red background".colorize(:color => :light_blue, :background => :red)
13 | # puts "This is light blue with red background".colorize(:light_blue ).colorize( :background => :red)
14 | # puts "This is blue text on red".blue.on_red
15 | # puts "This is red on blue".colorize(:red).on_blue
16 | # puts "This is red on blue and underline".colorize(:red).on_blue.underline
17 | # puts "This is blue text on red".blue.on_red.blink
18 | # puts "This is uncolorized".blue.on_red.uncolorize
19 | #
20 | def colorize(params)
21 | return self if self.class.disable_colorization
22 | require_windows_libs
23 | scan_for_colors.inject('') do |str, match|
24 | defaults_colors(match)
25 | colors_from_params(match, params)
26 | str << "\033[#{match[0]};#{match[1]};#{match[2]}m#{match[3]}\033[0m"
27 | end
28 | end
29 |
30 | #
31 | # Return uncolorized string
32 | #
33 | def uncolorize
34 | scan_for_colors.inject('') do |str, match|
35 | str << match[3]
36 | end
37 | end
38 |
39 | #
40 | # Return true if string is colorized
41 | #
42 | def colorized?
43 | scan_for_colors.inject([]) do |colors, match|
44 | colors << match.tap(&:pop)
45 | end.flatten.compact.any?
46 | end
47 |
48 | private
49 |
50 | #
51 | # Set default colors
52 | #
53 | def defaults_colors(match)
54 | match[0] ||= mode(:default)
55 | match[1] ||= color(:default)
56 | match[2] ||= background_color(:default)
57 | end
58 |
59 | #
60 | # Set color from params
61 | #
62 | def colors_from_params(match, params)
63 | case params
64 | when Hash then colors_from_hash(match, params)
65 | when Symbol then color_from_symbol(match, params)
66 | end
67 | end
68 |
69 | #
70 | # Set colors from params hash
71 | #
72 | def colors_from_hash(match, hash)
73 | match[0] = mode(hash[:mode]) if mode(hash[:mode])
74 | match[1] = color(hash[:color]) if color(hash[:color])
75 | match[2] = background_color(hash[:background]) if background_color(hash[:background])
76 | end
77 |
78 | #
79 | # Set color from params symbol
80 | #
81 | def color_from_symbol(match, symbol)
82 | match[1] = color(symbol) if color(symbol)
83 | end
84 |
85 | #
86 | # Color for foreground (offset 30)
87 | #
88 | def color(color)
89 | self.class.color_codes[color] + 30 if self.class.color_codes[color]
90 | end
91 |
92 | #
93 | # Color for background (offset 40)
94 | #
95 | def background_color(color)
96 | self.class.color_codes[color] + 40 if self.class.color_codes[color]
97 | end
98 |
99 | #
100 | # Mode
101 | #
102 | def mode(mode)
103 | self.class.mode_codes[mode]
104 | end
105 |
106 | #
107 | # Scan for colorized string
108 | #
109 | def scan_for_colors
110 | scan(/\033\[([0-9;]+)m(.+?)\033\[0m|([^\033]+)/m).map do |match|
111 | split_colors(match)
112 | end
113 | end
114 |
115 | def split_colors(match)
116 | colors = (match[0] || "").split(';')
117 | Array.new(4).tap do |array|
118 | array[0], array[1], array[2] = colors if colors.length == 3
119 | array[1] = colors if colors.length == 1
120 | array[3] = match[1] || match[2]
121 | end
122 | end
123 |
124 | #
125 | # Require windows libs
126 | #
127 | def require_windows_libs
128 | begin
129 | require 'Win32/Console/ANSI' if RUBY_VERSION < "2.0.0" && RUBY_PLATFORM =~ /win32/
130 | rescue LoadError
131 | raise 'You must gem install win32console to use colorize on Windows'
132 | end
133 | end
134 | end
135 | end
136 |
--------------------------------------------------------------------------------
/recipe/StickHero.rb:
--------------------------------------------------------------------------------
1 | class StickHero < BrewSparkling::Recipe::Builder
2 | github 'phpmaple/Stick-Hero-Swift', branch: '0935f4924854c84ee97262457b9e975b874846e8'
3 | description 'a universal iOS Game using Swift and iOS SpriteKit'
4 | version '1.0'
5 | bundle_identifier 'koofrank.ios.Stick-Hero'
6 | executable_name 'Stick-Hero.app'
7 |
8 | def build
9 | xcodebuild_archive(scheme: 'Stick-Hero')
10 | end
11 |
12 | patch :DATA
13 | end
14 |
15 | __END__
16 | diff --git a/Stick-Hero.xcodeproj/xcshareddata/xcschemes/Stick-Hero.xcscheme b/Stick-Hero.xcodeproj/xcshareddata/xcschemes/Stick-Hero.xcscheme
17 | new file mode 100644
18 | index 0000000..90bf9a8
19 | --- /dev/null
20 | +++ b/Stick-Hero.xcodeproj/xcshareddata/xcschemes/Stick-Hero.xcscheme
21 | @@ -0,0 +1,91 @@
22 | +
23 | +
26 | +
29 | +
30 | +
36 | +
42 | +
43 | +
44 | +
45 | +
46 | +
51 | +
52 | +
53 | +
54 | +
60 | +
61 | +
62 | +
63 | +
64 | +
65 | +
75 | +
77 | +
83 | +
84 | +
85 | +
86 | +
87 | +
88 | +
94 | +
96 | +
102 | +
103 | +
104 | +
105 | +
107 | +
108 | +
111 | +
112 | +
113 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/Rakefile:
--------------------------------------------------------------------------------
1 | #
2 | # Plist Rakefile
3 | #
4 | # Based heavily on Geoffrey Grosenbach's Rakefile for gruff.
5 | # Includes whitespace-fixing task based on code from Typo.
6 | #
7 | # Copyright 2006-2010 Ben Bleything and Patrick May
8 | # Distributed under the MIT License
9 | #
10 |
11 | require 'fileutils'
12 | require 'rubygems'
13 | require 'rake'
14 | require 'rake/testtask'
15 | require 'rake/packagetask'
16 | require 'rake/gempackagetask'
17 | require 'rake/contrib/rubyforgepublisher'
18 | require 'rdoc/task'
19 |
20 | $:.unshift(File.dirname(__FILE__) + "/lib")
21 | require 'plist'
22 |
23 | PKG_NAME = 'plist'
24 | PKG_VERSION = Plist::VERSION
25 | PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
26 |
27 | RELEASE_NAME = "REL #{PKG_VERSION}"
28 |
29 | RUBYFORGE_PROJECT = "plist"
30 | RUBYFORGE_USER = ENV['RUBYFORGE_USER']
31 |
32 | TEST_FILES = Dir.glob('test/test_*')
33 | TEST_ASSETS = Dir.glob('test/assets/*')
34 | LIB_FILES = Dir.glob('lib/**/*')
35 | RELEASE_FILES = [ "Rakefile", "README.rdoc", "CHANGELOG", "LICENSE" ] + LIB_FILES + TEST_FILES + TEST_ASSETS
36 |
37 | task :default => [ :test ]
38 | # Run the unit tests
39 | Rake::TestTask.new { |t|
40 | t.libs << "test"
41 | t.pattern = 'test/test_*.rb'
42 | t.verbose = true
43 | }
44 |
45 | desc "Clean pkg, coverage, and rdoc; remove .bak files"
46 | task :clean => [ :clobber_rdoc, :clobber_package, :clobber_coverage ] do
47 | puts cmd = "find . -type f -name *.bak -delete"
48 | `#{cmd}`
49 | end
50 |
51 | task :clobber_coverage do
52 | puts cmd = "rm -rf coverage"
53 | `#{cmd}`
54 | end
55 |
56 | desc "Generate coverage analysis with rcov (requires rcov to be installed)"
57 | task :rcov => [ :clobber_coverage ] do
58 | puts cmd = "rcov -Ilib --xrefs -T test/*.rb"
59 | puts `#{cmd}`
60 | end
61 |
62 | desc "Strip trailing whitespace and fix newlines for all release files"
63 | task :fix_whitespace => [ :clean ] do
64 | RELEASE_FILES.reject {|i| i =~ /assets/}.each do |filename|
65 | next if File.directory? filename
66 |
67 | File.open(filename) do |file|
68 | newfile = ''
69 | needs_love = false
70 |
71 | file.readlines.each_with_index do |line, lineno|
72 | if line =~ /[ \t]+$/
73 | needs_love = true
74 | puts "#{filename}: trailing whitespace on line #{lineno}"
75 | line.gsub!(/[ \t]*$/, '')
76 | end
77 |
78 | if line.chomp == line
79 | needs_love = true
80 | puts "#{filename}: no newline on line #{lineno}"
81 | line << "\n"
82 | end
83 |
84 | newfile << line
85 | end
86 |
87 | if needs_love
88 | tempname = "#{filename}.new"
89 |
90 | File.open(tempname, 'w').write(newfile)
91 | File.chmod(File.stat(filename).mode, tempname)
92 |
93 | FileUtils.ln filename, "#{filename}.bak"
94 | FileUtils.ln tempname, filename, :force => true
95 | File.unlink(tempname)
96 | end
97 | end
98 | end
99 | end
100 |
101 | desc "Copy documentation to rubyforge"
102 | task :update_rdoc => [ :rdoc ] do
103 | Rake::SshDirPublisher.new("#{RUBYFORGE_USER}@rubyforge.org", "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}", "rdoc").upload
104 | end
105 |
106 | # Genereate the RDoc documentation
107 | RDoc::Task.new do |rdoc|
108 | rdoc.title = "All-purpose Property List manipulation library"
109 | rdoc.main = "README.rdoc"
110 |
111 | rdoc.rdoc_dir = 'rdoc'
112 | rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'CHANGELOG')
113 | rdoc.rdoc_files.include('lib/**')
114 |
115 | rdoc.options = [
116 | '-H', # show hash marks on method names in comments
117 | '-N', # show line numbers
118 | ]
119 | end
120 |
121 | # Create compressed packages
122 | spec = Gem::Specification.new do |s|
123 | s.name = PKG_NAME
124 | s.version = PKG_VERSION
125 |
126 | s.summary = "All-purpose Property List manipulation library."
127 | s.description = <<-EOD
128 | Plist is a library to manipulate Property List files, also known as plists. It can parse plist files into native Ruby data structures as well as generating new plist files from your Ruby objects.
129 | EOD
130 |
131 | s.authors = "Ben Bleything and Patrick May"
132 | s.homepage = "http://plist.rubyforge.org"
133 |
134 | s.rubyforge_project = RUBYFORGE_PROJECT
135 |
136 | s.has_rdoc = true
137 |
138 | s.files = RELEASE_FILES
139 | s.test_files = TEST_FILES
140 |
141 | s.autorequire = 'plist'
142 | end
143 |
144 | Rake::GemPackageTask.new(spec) do |p|
145 | p.gem_spec = spec
146 | p.need_tar = true
147 | p.need_zip = true
148 | end
149 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd/reply/query_record.rb:
--------------------------------------------------------------------------------
1 | require 'ipaddr'
2 |
3 | ##
4 | # Created by DNSSD::Service#query_record
5 |
6 | class DNSSD::Reply::QueryRecord < DNSSD::Reply
7 |
8 | ##
9 | # A domain for registration or browsing
10 |
11 | attr_reader :domain
12 |
13 | ##
14 | # The service name
15 |
16 | attr_reader :name
17 |
18 | ##
19 | # DNS Record data
20 |
21 | attr_reader :record
22 |
23 | ##
24 | # DNS Record class (only IN is supported)
25 |
26 | attr_reader :record_class
27 |
28 | ##
29 | # DNS Record type
30 |
31 | attr_reader :record_type
32 |
33 | ##
34 | # Time-to-live for this record. See #expired?
35 |
36 | attr_reader :ttl
37 |
38 | ##
39 | # The service type
40 |
41 | attr_reader :type
42 |
43 | ##
44 | # Creates a new QueryRecord, called internally by
45 | # DNSSD::Service#query_record
46 |
47 | def initialize(service, flags, interface, fullname, record_type,
48 | record_class, record, ttl)
49 | super service, flags, interface
50 |
51 | set_fullname fullname
52 |
53 | @record_type = record_type
54 | @record_class = record_class
55 | @record = record
56 |
57 | @created = Time.now
58 | @ttl = ttl
59 | end
60 |
61 | ##
62 | # Converts a RFC 1035 character-string into a ruby String
63 |
64 | def character_string_to_string(character_string)
65 | length = character_string.slice 0
66 | length = length.ord unless Numeric === length
67 | string = character_string.slice 1, length
68 |
69 | if string.length != length then
70 | raise TypeError,
71 | "invalid character string, expected #{length} got #{string.length} in #{@record.inspect}"
72 | end
73 |
74 | string
75 | end
76 |
77 | ##
78 | # Converts a RFC 1035 domain-name into a ruby String
79 |
80 | def domain_name_to_string(domain_name)
81 | return '.' if domain_name == "\0"
82 |
83 | domain_name = domain_name.dup
84 | string = []
85 |
86 | until domain_name.empty? do
87 | string << character_string_to_string(domain_name)
88 | domain_name.slice! 0, string.last.length + 1
89 | end
90 |
91 | string << nil unless string.last.empty?
92 |
93 | string.join('.')
94 | end
95 |
96 | ##
97 | # Has this QueryRecord passed its TTL?
98 |
99 | def expired?
100 | Time.now > @created + ttl
101 | end
102 |
103 | def inspect # :nodoc:
104 | "#<%s:0x%x %s %s %s %p interface: %s flags: %p>" % [
105 | self.class, object_id,
106 | fullname, record_class_name, record_type_name, record,
107 | interface_name, @flags
108 | ]
109 | end
110 |
111 | ##
112 | # Name of this record's record_class
113 |
114 | def record_class_name
115 | return "unknown #{@record_class}" unless @record_class == DNSSD::Record::IN
116 | 'IN' # Only IN is supported
117 | end
118 |
119 | ##
120 | # Decodes output for #record, returning the raw record if it can't be
121 | # decoded. Handles:
122 | #
123 | # A AAAA CNAME MX NS PTR SOA SRV TXT
124 |
125 | def record_data
126 | return @record unless @record_class == DNSSD::Record::IN
127 |
128 | case @record_type
129 | when DNSSD::Record::A,
130 | DNSSD::Record::AAAA then
131 | IPAddr.new_ntoh @record
132 | when DNSSD::Record::CNAME,
133 | DNSSD::Record::NS,
134 | DNSSD::Record::PTR then
135 | domain_name_to_string @record
136 | when DNSSD::Record::MX then
137 | mx = @record.unpack 'nZ*'
138 | mx[-1] = domain_name_to_string mx.last
139 | mx
140 | when DNSSD::Record::SOA then
141 | soa = @record.unpack 'Z*Z*NNNNN'
142 | soa[0] = domain_name_to_string soa[0]
143 | soa[1] = domain_name_to_string soa[1]
144 | soa
145 | when DNSSD::Record::SRV then
146 | srv = @record.unpack 'nnnZ*'
147 | srv[-1] = domain_name_to_string srv.last
148 | srv
149 | when DNSSD::Record::TXT then
150 | record = @record.dup
151 | txt = []
152 |
153 | until record.empty? do
154 | txt << character_string_to_string(record)
155 | record.slice! 0, txt.last.length + 1
156 | end
157 |
158 | txt
159 | else
160 | @record
161 | end
162 | end
163 |
164 | ##
165 | # Name of this record's record_type
166 |
167 | def record_type_name
168 | return "unknown #{@record_type} for record class (#{@record_class})" unless
169 | @record_class == DNSSD::Record::IN
170 | DNSSD::Record::VALUE_TO_NAME[@record_type]
171 | end
172 |
173 | ##
174 | # Outputs this record in a BIND-like DNS format
175 |
176 | def to_s
177 | "%s %d %s %s %p" % [
178 | fullname, ttl, record_class_name, record_type_name, record_data
179 | ]
180 | end
181 | end
182 |
--------------------------------------------------------------------------------
/lib/vendor/homebrew-fork/download_strategy.rb:
--------------------------------------------------------------------------------
1 | class Hbc::HbVCSDownloadStrategy < Hbc::AbstractDownloadStrategy
2 | REF_TYPES = [:branch, :revision, :revisions, :tag].freeze
3 |
4 | def initialize(cask,command=Hbc::SystemCommand)
5 | super
6 | @ref_type, @ref = extract_ref
7 | @clone = HOMEBREW_CACHE.join(cache_filename)
8 | end
9 |
10 | def extract_ref
11 | key = REF_TYPES.find do |type|
12 | uri_object.respond_to?(type) and uri_object.send(type)
13 | end
14 | return key, key ? uri_object.send(key) : nil
15 | end
16 |
17 | def cache_filename
18 | "#{name}--#{cache_tag}"
19 | end
20 |
21 | def cache_tag
22 | "__UNKNOWN__"
23 | end
24 |
25 | def cached_location
26 | @clone
27 | end
28 |
29 | def clear_cache
30 | cached_location.rmtree if cached_location.exist?
31 | end
32 | end
33 |
34 | class Hbc::HbCurlDownloadStrategy < Hbc::AbstractDownloadStrategy
35 | # todo should be part of url object
36 | def mirrors
37 | @mirrors ||= []
38 | end
39 |
40 | def tarball_path
41 | @tarball_path ||= Pathname.new("#{HOMEBREW_CACHE}/#{name}-#{version}#{ext}")
42 | end
43 |
44 | def temporary_path
45 | @temporary_path ||= Pathname.new("#{tarball_path}.incomplete")
46 | end
47 |
48 | def cached_location
49 | tarball_path
50 | end
51 |
52 | def clear_cache
53 | [cached_location, temporary_path].each { |f| f.unlink if f.exist? }
54 | end
55 |
56 | def downloaded_size
57 | temporary_path.size? or 0
58 | end
59 |
60 | def fetch
61 | ohai "Downloading #{@url}"
62 | unless tarball_path.exist?
63 | had_incomplete_download = temporary_path.exist?
64 | begin
65 | _fetch
66 | rescue Hbc::ErrorDuringExecution
67 | # 33 == range not supported
68 | # try wiping the incomplete download and retrying once
69 | if $?.exitstatus == 33 && had_incomplete_download
70 | ohai "Trying a full download"
71 | temporary_path.unlink
72 | had_incomplete_download = false
73 | retry
74 | else
75 | if @url =~ %r[^file://]
76 | msg = "File does not exist: #{@url.sub(%r[^file://], "")}"
77 | else
78 | msg = "Download failed: #{@url}"
79 | end
80 | raise Hbc::CurlDownloadStrategyError, msg
81 | end
82 | end
83 | Hbc::Utils.ignore_interrupts { temporary_path.rename(tarball_path) }
84 | else
85 | puts "Already downloaded: #{tarball_path}"
86 | end
87 | rescue Hbc::CurlDownloadStrategyError
88 | raise if mirrors.empty?
89 | puts "Trying a mirror..."
90 | @url = mirrors.shift
91 | retry
92 | else
93 | tarball_path
94 | end
95 |
96 | private
97 |
98 | def curl(*args)
99 | args << '--connect-timeout' << '5' unless mirrors.empty?
100 | super
101 | end
102 |
103 | def ext
104 | # We need a Pathname because we've monkeypatched extname to support double
105 | # extensions (e.g. tar.gz). -- todo actually that monkeypatch has been removed
106 | Pathname.new(@url).extname[/[^?]+/]
107 | end
108 | end
109 |
110 | class Hbc::HbSubversionDownloadStrategy < Hbc::HbVCSDownloadStrategy
111 | def cache_tag
112 | # todo: pass versions as symbols, support :head here
113 | version == 'head' ? "svn-HEAD" : "svn"
114 | end
115 |
116 | def repo_valid?
117 | @clone.join(".svn").directory?
118 | end
119 |
120 | def repo_url
121 | `svn info '#{@clone}' 2>/dev/null`.strip[/^URL: (.+)$/, 1]
122 | end
123 |
124 | def fetch
125 | @url = @url.sub(/^svn\+/, '') if @url =~ %r[^svn\+http://]
126 | ohai "Checking out #{@url}"
127 |
128 | clear_cache unless @url.chomp("/") == repo_url or quiet_system 'svn', 'switch', @url, @clone
129 |
130 | if @clone.exist? and not repo_valid?
131 | puts "Removing invalid SVN repo from cache"
132 | clear_cache
133 | end
134 |
135 | case @ref_type
136 | when :revision
137 | fetch_repo @clone, @url, @ref
138 | when :revisions
139 | # nil is OK for main_revision, as fetch_repo will then get latest
140 | main_revision = @ref[:trunk]
141 | fetch_repo @clone, @url, main_revision, true
142 |
143 | get_externals do |external_name, external_url|
144 | fetch_repo @clone+external_name, external_url, @ref[external_name], true
145 | end
146 | else
147 | fetch_repo @clone, @url
148 | end
149 | end
150 |
151 | def shell_quote(str)
152 | # Oh god escaping shell args.
153 | # See http://notetoself.vrensk.com/2008/08/escaping-single-quotes-in-ruby-harder-than-expected/
154 | str.gsub(/\\|'/) { |c| "\\#{c}" }
155 | end
156 |
157 | def get_externals
158 | `svn propget svn:externals '#{shell_quote(@url)}'`.chomp.each_line do |line|
159 | name, url = line.split(/\s+/)
160 | yield name, url
161 | end
162 | end
163 | end
164 |
--------------------------------------------------------------------------------
/recipe/Calc.rb:
--------------------------------------------------------------------------------
1 | class Calc < BrewSparkling::Recipe::Builder
2 | github 'noodlewerk/Apple_Watch_Calculator', branch: 'd0dc076be63e9e5c605ecef145d6da4c1fda11d0'
3 | description 'Apple Watch Calculator'
4 | version '1.0'
5 | bundle_identifiers %w(com.noodlewerk.Calc com.noodlewerk.Calc.watchapp com.noodlewerk.Calc.watchkitextension)
6 |
7 | def build
8 | xcodebuild_archive(scheme: 'Calc')
9 | end
10 |
11 | patch :DATA
12 | end
13 |
14 | __END__
15 | diff --git a/Calc.xcodeproj/xcshareddata/xcschemes/Calc.xcscheme b/Calc.xcodeproj/xcshareddata/xcschemes/Calc.xcscheme
16 | new file mode 100644
17 | index 0000000..a284134
18 | --- /dev/null
19 | +++ b/Calc.xcodeproj/xcshareddata/xcschemes/Calc.xcscheme
20 | @@ -0,0 +1,101 @@
21 | +
22 | +
25 | +
28 | +
29 | +
35 | +
41 | +
42 | +
43 | +
44 | +
45 | +
50 | +
51 | +
53 | +
59 | +
60 | +
61 | +
62 | +
63 | +
69 | +
70 | +
71 | +
72 | +
73 | +
74 | +
84 | +
86 | +
92 | +
93 | +
94 | +
95 | +
96 | +
97 | +
103 | +
105 | +
111 | +
112 | +
113 | +
114 | +
116 | +
117 | +
120 | +
121 | +
122 |
--------------------------------------------------------------------------------
/recipe/bridges2.rb:
--------------------------------------------------------------------------------
1 | class Bridges2 < BrewSparkling::Recipe::Builder
2 | description 'A puzzle game with bridges, houses, tolls, and subways for iOS'
3 | github 'zgrossbart/bridges', branch: 'd41f8c3cec14121fbb535b9c476af17f7a9d1292'
4 | version '1.2'
5 | bundle_identifier 'com.zackgrossbart.--Bridges'
6 | executable_name '7 Bridges.app'
7 |
8 | def build
9 | xcodebuild_archive(scheme: 'bridges2')
10 | end
11 |
12 | patch :DATA
13 | end
14 |
15 | __END__
16 | diff --git a/bridges2.xcodeproj/xcshareddata/xcschemes/bridges2.xcscheme b/bridges2.xcodeproj/xcshareddata/xcschemes/bridges2.xcscheme
17 | new file mode 100644
18 | index 0000000..3ffd728
19 | --- /dev/null
20 | +++ b/bridges2.xcodeproj/xcshareddata/xcschemes/bridges2.xcscheme
21 | @@ -0,0 +1,91 @@
22 | +
23 | +
26 | +
29 | +
30 | +
36 | +
42 | +
43 | +
44 | +
45 | +
46 | +
51 | +
52 | +
53 | +
54 | +
60 | +
61 | +
62 | +
63 | +
64 | +
65 | +
75 | +
77 | +
83 | +
84 | +
85 | +
86 | +
87 | +
88 | +
94 | +
96 | +
102 | +
103 | +
104 | +
105 | +
107 | +
108 | +
111 | +
112 | +
113 | diff --git a/bridges2/MainMenuViewController.mm b/bridges2/MainMenuViewController.mm
114 | index 93142ac..8b52369 100644
115 | --- a/bridges2/MainMenuViewController.mm
116 | +++ b/bridges2/MainMenuViewController.mm
117 | @@ -88,7 +88,7 @@
118 | -(void)viewDidLoad {
119 | [super viewDidLoad];
120 | if (_checkImage == nil) {
121 | - _checkImage = [UIImage imageNamed:@"green_check.png"];
122 | + _checkImage = [[UIImage imageNamed:@"green_check.png"] retain];
123 | }
124 |
125 | [self preloadSounds];
126 |
--------------------------------------------------------------------------------
/recipe/SpoolDays.rb:
--------------------------------------------------------------------------------
1 | class SpoolDays < BrewSparkling::Recipe::Builder
2 | github 'suer/spool-days', branch: '737455cccf3e8bfd36304c07812dcec5b9f1f4e0'
3 | description 'date count up/down application for iOS'
4 | version '1.0'
5 | bundle_identifiers %w(org.codefirst.SpoolDays org.codefirst.SpoolDays.SpoolDaysTodayExtension)
6 |
7 | def build
8 | pod 'install'
9 | Dir.chdir('SpoolDays') do
10 | system 'cp', 'preference.plist.example', 'preference.plist'
11 | end
12 | xcodebuild_archive(scheme: 'SpoolDays', workspace: 'SpoolDays.xcworkspace')
13 | end
14 |
15 | patch :DATA
16 | end
17 |
18 | __END__
19 | diff --git a/SpoolDays.xcodeproj/project.pbxproj b/SpoolDays.xcodeproj/project.pbxproj
20 | index 60e6735..bf39240 100644
21 | --- a/SpoolDays.xcodeproj/project.pbxproj
22 | +++ b/SpoolDays.xcodeproj/project.pbxproj
23 | @@ -381,7 +381,7 @@
24 | CreatedOnToolsVersion = 6.1;
25 | SystemCapabilities = {
26 | com.apple.ApplicationGroups.iOS = {
27 | - enabled = 1;
28 | + enabled = 0;
29 | };
30 | };
31 | };
32 | @@ -389,10 +389,10 @@
33 | CreatedOnToolsVersion = 6.0.1;
34 | SystemCapabilities = {
35 | com.apple.ApplicationGroups.iOS = {
36 | - enabled = 1;
37 | + enabled = 0;
38 | };
39 | com.apple.BackgroundModes = {
40 | - enabled = 1;
41 | + enabled = 0;
42 | };
43 | };
44 | };
45 | @@ -625,8 +625,8 @@
46 | isa = XCBuildConfiguration;
47 | baseConfigurationReference = 28ED91F5F3718D86CF27B399 /* Pods.debug.xcconfig */;
48 | buildSettings = {
49 | - CODE_SIGN_ENTITLEMENTS = SpoolDaysTodayExtension/SpoolDaysTodayExtension.entitlements;
50 | CODE_SIGN_IDENTITY = "iPhone Developer";
51 | + ENABLE_BITCODE = NO;
52 | GCC_PREPROCESSOR_DEFINITIONS = (
53 | "DEBUG=1",
54 | "$(inherited)",
55 | @@ -674,8 +674,8 @@
56 | isa = XCBuildConfiguration;
57 | baseConfigurationReference = 51761DB67EF34A17DB7EAEF3 /* Pods.release.xcconfig */;
58 | buildSettings = {
59 | - CODE_SIGN_ENTITLEMENTS = SpoolDaysTodayExtension/SpoolDaysTodayExtension.entitlements;
60 | CODE_SIGN_IDENTITY = "iPhone Developer";
61 | + ENABLE_BITCODE = NO;
62 | GCC_PREPROCESSOR_DEFINITIONS = (
63 | "$(inherited)",
64 | "COCOAPODS=1",
65 | @@ -803,10 +803,10 @@
66 | buildSettings = {
67 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
68 | CLANG_ENABLE_MODULES = YES;
69 | - CODE_SIGN_ENTITLEMENTS = SpoolDays/SpoolDays.entitlements;
70 | CODE_SIGN_IDENTITY = "iPhone Developer";
71 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
72 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
73 | + ENABLE_BITCODE = NO;
74 | INFOPLIST_FILE = SpoolDays/Info.plist;
75 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
76 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
77 | @@ -827,10 +827,10 @@
78 | buildSettings = {
79 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
80 | CLANG_ENABLE_MODULES = YES;
81 | - CODE_SIGN_ENTITLEMENTS = SpoolDays/SpoolDays.entitlements;
82 | CODE_SIGN_IDENTITY = "iPhone Developer";
83 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
84 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
85 | + ENABLE_BITCODE = NO;
86 | INFOPLIST_FILE = SpoolDays/Info.plist;
87 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
88 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
89 | diff --git a/SpoolDays/Info.plist b/SpoolDays/Info.plist
90 | index 227e97e..e20bfff 100644
91 | --- a/SpoolDays/Info.plist
92 | +++ b/SpoolDays/Info.plist
93 | @@ -35,10 +35,6 @@
94 | 15
95 | LSRequiresIPhoneOS
96 |
97 | - UIBackgroundModes
98 | -
99 | - fetch
100 | -
101 | UILaunchStoryboardName
102 | LaunchScreen
103 | UIRequiredDeviceCapabilities
104 | diff --git a/SpoolDays/SpoolDays.entitlements b/SpoolDays/SpoolDays.entitlements
105 | index a243079..0c67376 100644
106 | --- a/SpoolDays/SpoolDays.entitlements
107 | +++ b/SpoolDays/SpoolDays.entitlements
108 | @@ -1,10 +1,5 @@
109 |
110 |
111 |
112 | -
113 | - com.apple.security.application-groups
114 | -
115 | - group.org.codefirst.SpoolDaysExtension
116 | -
117 | -
118 | +
119 |
120 | diff --git a/SpoolDaysTodayExtension/SpoolDaysTodayExtension.entitlements b/SpoolDaysTodayExtension/SpoolDaysTodayExtension.entitlements
121 | index a243079..0c67376 100644
122 | --- a/SpoolDaysTodayExtension/SpoolDaysTodayExtension.entitlements
123 | +++ b/SpoolDaysTodayExtension/SpoolDaysTodayExtension.entitlements
124 | @@ -1,10 +1,5 @@
125 |
126 |
127 |
128 | -
129 | - com.apple.security.application-groups
130 | -
131 | - group.org.codefirst.SpoolDaysExtension
132 | -
133 | -
134 | +
135 |
136 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/lib/dnssd.rb:
--------------------------------------------------------------------------------
1 | ##
2 | # DNSSD is a wrapper for the DNS Service Discovery library.
3 | #
4 | # DNSSD.announce and DNSSD::Reply.connect provide an easy-to-use way to
5 | # announce and connect to services.
6 | #
7 | # The methods DNSSD.enumerate_domains, DNSSD.browse, DNSSD.register, and
8 | # DNSSD.resolve provide the basic API for making your applications DNS \Service
9 | # Discovery aware.
10 |
11 | module DNSSD
12 |
13 | ##
14 | # The version of DNSSD you're using.
15 |
16 | VERSION = '3.0.1'
17 |
18 | ##
19 | # Registers +socket+ with DNSSD as +name+. If +service+ is omitted it is
20 | # looked up using #getservbyport and the ports address. +text_record+,
21 | # +flags+ and +interface+ are used as in #register.
22 | #
23 | # Returns the Service created by registering the socket. The Service will
24 | # automatically be shut down when #close or #close_read is called on the
25 | # socket.
26 | #
27 | # Only for bound TCP and UDP sockets.
28 |
29 | def self.announce(socket, name, service = nil, text_record = nil, flags = 0,
30 | interface = DNSSD::InterfaceAny, &block)
31 | _, port, = socket.addr
32 |
33 | raise ArgumentError, 'socket not bound' if port == 0
34 |
35 | service ||= Socket.getservbyport port
36 |
37 | proto = case socket
38 | when TCPSocket then 'tcp'
39 | when UDPSocket then 'udp'
40 | else raise ArgumentError, 'tcp or udp sockets only'
41 | end
42 |
43 | type = "_#{service}._#{proto}"
44 |
45 | registrar = register(name, type, nil, port, text_record, flags, interface,
46 | &block)
47 |
48 | socket.instance_variable_set :@registrar, registrar
49 |
50 | def socket.close
51 | result = super
52 | @registrar.stop
53 | return result
54 | end
55 |
56 | def socket.close_read
57 | result = super
58 | @registrar.stop
59 | return result
60 | end
61 |
62 | registrar
63 | end
64 |
65 | ##
66 | # Asynchronous version of DNSSD::Service#browse
67 |
68 | def self.browse type, domain = nil, flags = 0, interface = DNSSD::InterfaceAny
69 | service = DNSSD::Service.browse type, domain, flags, interface
70 | service.async_each { |r| yield r }
71 | service
72 | end
73 |
74 | ##
75 | # Synchronous version of DNSSD::Service#browse
76 |
77 | def self.browse! type, domain = nil, flags = 0, interface = DNSSD::InterfaceAny
78 | service = DNSSD::Service.browse type, domain, flags, interface
79 | service.each { |r| yield r }
80 | ensure
81 | service.stop
82 | end
83 |
84 | ##
85 | # Asynchronous version of DNSSD::Service#enumerate_domains
86 |
87 | def self.enumerate_domains flags = DNSSD::Flags::BrowseDomains,
88 | interface = DNSSD::InterfaceAny
89 | service = DNSSD::Service.enumerate_domains flags, interface
90 | service.async_each { |r| yield r }
91 | service
92 | end
93 |
94 | ##
95 | # Synchronous version of DNSSD::Service#enumerate_domains
96 |
97 | def self.enumerate_domains!(flags = DNSSD::Flags::BrowseDomains,
98 | interface = DNSSD::InterfaceAny, &block)
99 | service = DNSSD::Service.enumerate_domains flags, interface
100 | service.each { |r| yield r }
101 | ensure
102 | service.stop
103 | end
104 |
105 | ##
106 | # Asynchronous version of DNSSD::Service#register
107 |
108 | def self.register(name, type, domain, port, text_record = nil, flags = 0,
109 | interface = DNSSD::InterfaceAny)
110 | service = DNSSD::Service.register name, type, domain, port, nil,
111 | text_record, flags, interface
112 |
113 | service.async_each { |r| yield r } if block_given?
114 |
115 | service
116 | end
117 |
118 | ##
119 | # Synchronous version of DNSSD::Service#register
120 |
121 | def self.register!(name, type, domain, port, text_record = nil, flags = 0,
122 | interface = DNSSD::InterfaceAny, &block)
123 | service = DNSSD::Service.register name, type, domain, port, nil,
124 | text_record, flags, interface
125 |
126 | service.each { |r| yield r } if block_given?
127 | ensure
128 | service.stop
129 | end
130 |
131 | ##
132 | # Asynchronous version of DNSSD::Service#resolve
133 |
134 | def self.resolve(*args)
135 | service = DNSSD::Service.resolve(*args)
136 | service.async_each { |r| yield r }
137 | service
138 | end
139 |
140 | ##
141 | # Synchronous version of DNSSD::Service#resolve
142 |
143 | def self.resolve!(*args)
144 | service = DNSSD::Service.resolve(*args)
145 | service.each { |r| yield r }
146 | ensure
147 | service.stop if service
148 | end
149 | end
150 |
151 | require 'socket'
152 |
153 | require 'dnssd/reply'
154 | require 'dnssd/reply/addr_info'
155 | require 'dnssd/reply/browse'
156 | require 'dnssd/reply/domain'
157 | require 'dnssd/reply/query_record'
158 | require 'dnssd/reply/register'
159 | require 'dnssd/reply/resolve'
160 | require 'dnssd/text_record'
161 |
162 | # Suppress avahi compatibilty warning
163 | # http://0pointer.de/avahi-compat?s=libdns_sd&e=ruby
164 | ENV['AVAHI_COMPAT_NOWARN'] = '1'
165 |
166 | # The C extension uses above-defined classes
167 | require 'dnssd/dnssd'
168 |
169 | module DNSSD
170 | # :stopdoc:
171 | class ServiceNotRunningError < UnknownError; end unless
172 | const_defined? :ServiceNotRunningError
173 |
174 | InterfaceUnicast = 4294967294 unless const_defined? :InterfaceUnicast # -2
175 | # :startdoc:
176 | end
177 |
178 | require 'dnssd/flags'
179 | require 'dnssd/service'
180 | require 'dnssd/record'
181 |
182 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/lib/plist/parser.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | #
3 | # = plist
4 | #
5 | # Copyright 2006-2010 Ben Bleything and Patrick May
6 | # Distributed under the MIT License
7 | #
8 |
9 | # Plist parses Mac OS X xml property list files into ruby data structures.
10 | #
11 | # === Load a plist file
12 | # This is the main point of the library:
13 | #
14 | # r = Plist::parse_xml( filename_or_xml )
15 | module Plist
16 | # Note that I don't use these two elements much:
17 | #
18 | # + Date elements are returned as DateTime objects.
19 | # + Data elements are implemented as Tempfiles
20 | #
21 | # Plist::parse_xml will blow up if it encounters a data element.
22 | # If you encounter such an error, or if you have a Date element which
23 | # can't be parsed into a Time object, please send your plist file to
24 | # plist@hexane.org so that I can implement the proper support.
25 | def Plist::parse_xml( filename_or_xml )
26 | listener = Listener.new
27 | #parser = REXML::Parsers::StreamParser.new(File.new(filename), listener)
28 | parser = StreamParser.new(filename_or_xml, listener)
29 | parser.parse
30 | listener.result
31 | end
32 |
33 | class Listener
34 | #include REXML::StreamListener
35 |
36 | attr_accessor :result, :open
37 |
38 | def initialize
39 | @result = nil
40 | @open = Array.new
41 | end
42 |
43 |
44 | def tag_start(name, attributes)
45 | @open.push PTag::mappings[name].new
46 | end
47 |
48 | def text( contents )
49 | @open.last.text = contents if @open.last
50 | end
51 |
52 | def tag_end(name)
53 | last = @open.pop
54 | if @open.empty?
55 | @result = last.to_ruby
56 | else
57 | @open.last.children.push last
58 | end
59 | end
60 | end
61 |
62 | class StreamParser
63 | def initialize( plist_data_or_file, listener )
64 | if plist_data_or_file.respond_to? :read
65 | @xml = plist_data_or_file.read
66 | elsif File.exists? plist_data_or_file
67 | @xml = File.read( plist_data_or_file )
68 | else
69 | @xml = plist_data_or_file
70 | end
71 |
72 | @listener = listener
73 | end
74 |
75 | TEXT = /([^<]+)/
76 | XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>*/um
77 | DOCTYPE_PATTERN = /\s*)/um
78 | COMMENT_START = /\A/um
80 |
81 |
82 | def parse
83 | plist_tags = PTag::mappings.keys.join('|')
84 | start_tag = /<(#{plist_tags})([^>]*)>/i
85 | end_tag = /<\/(#{plist_tags})[^>]*>/i
86 |
87 | require 'strscan'
88 |
89 | @scanner = StringScanner.new( @xml )
90 | until @scanner.eos?
91 | if @scanner.scan(COMMENT_START)
92 | @scanner.scan(COMMENT_END)
93 | elsif @scanner.scan(XMLDECL_PATTERN)
94 | elsif @scanner.scan(DOCTYPE_PATTERN)
95 | elsif @scanner.scan(start_tag)
96 | @listener.tag_start(@scanner[1], nil)
97 | if (@scanner[2] =~ /\/$/)
98 | @listener.tag_end(@scanner[1])
99 | end
100 | elsif @scanner.scan(TEXT)
101 | @listener.text(@scanner[1])
102 | elsif @scanner.scan(end_tag)
103 | @listener.tag_end(@scanner[1])
104 | else
105 | raise "Unimplemented element"
106 | end
107 | end
108 | end
109 | end
110 |
111 | class PTag
112 | @@mappings = { }
113 | def PTag::mappings
114 | @@mappings
115 | end
116 |
117 | def PTag::inherited( sub_class )
118 | key = sub_class.to_s.downcase
119 | key.gsub!(/^plist::/, '' )
120 | key.gsub!(/^p/, '') unless key == "plist"
121 |
122 | @@mappings[key] = sub_class
123 | end
124 |
125 | attr_accessor :text, :children
126 | def initialize
127 | @children = Array.new
128 | end
129 |
130 | def to_ruby
131 | raise "Unimplemented: " + self.class.to_s + "#to_ruby on #{self.inspect}"
132 | end
133 | end
134 |
135 | class PList < PTag
136 | def to_ruby
137 | children.first.to_ruby if children.first
138 | end
139 | end
140 |
141 | class PDict < PTag
142 | def to_ruby
143 | dict = Hash.new
144 | key = nil
145 |
146 | children.each do |c|
147 | if key.nil?
148 | key = c.to_ruby
149 | else
150 | dict[key] = c.to_ruby
151 | key = nil
152 | end
153 | end
154 |
155 | dict
156 | end
157 | end
158 |
159 | class PKey < PTag
160 | def to_ruby
161 | CGI::unescapeHTML(text || '')
162 | end
163 | end
164 |
165 | class PString < PTag
166 | def to_ruby
167 | CGI::unescapeHTML(text || '')
168 | end
169 | end
170 |
171 | class PArray < PTag
172 | def to_ruby
173 | children.collect do |c|
174 | c.to_ruby
175 | end
176 | end
177 | end
178 |
179 | class PInteger < PTag
180 | def to_ruby
181 | text.to_i
182 | end
183 | end
184 |
185 | class PTrue < PTag
186 | def to_ruby
187 | true
188 | end
189 | end
190 |
191 | class PFalse < PTag
192 | def to_ruby
193 | false
194 | end
195 | end
196 |
197 | class PReal < PTag
198 | def to_ruby
199 | text.to_f
200 | end
201 | end
202 |
203 | require 'date'
204 | class PDate < PTag
205 | def to_ruby
206 | DateTime.parse(text)
207 | end
208 | end
209 |
210 | require 'base64'
211 | class PData < PTag
212 | def to_ruby
213 | data = Base64.decode64(text.gsub(/\s+/, ''))
214 |
215 | begin
216 | return Marshal.load(data)
217 | rescue Exception => e
218 | io = StringIO.new
219 | io.write data
220 | io.rewind
221 | return io
222 | end
223 | end
224 | end
225 | end
226 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/dnssd-3.0.1/test/test_dnssd_service.rb:
--------------------------------------------------------------------------------
1 | require 'helper'
2 |
3 | class TestDNSSDService < DNSSD::Test
4 |
5 | def test_class_get_property
6 | skip 'DNSSD::Service::get_property not defined' unless
7 | DNSSD::Service.respond_to? :get_property
8 |
9 | assert_kind_of Numeric,
10 | DNSSD::Service.get_property(DNSSD::Service::DaemonVersion)
11 | end
12 |
13 | def test_class_getaddrinfo
14 | addresses = []
15 | service = DNSSD::Service.getaddrinfo 'localhost'
16 |
17 | service.each do |addrinfo|
18 | addresses << addrinfo.address
19 | break unless addrinfo.flags.more_coming?
20 | end
21 |
22 | assert addresses.index('127.0.0.1')
23 | end
24 |
25 | def test_enumerate
26 | service = DNSSD::Service.enumerate_domains
27 |
28 | begin
29 | Timeout.timeout(2) do
30 | service.each do |reply|
31 | # I *think* there will be a local. on every machine??
32 | break if reply.domain == 'local.'
33 | end
34 | assert true
35 | end
36 | rescue Timeout::Error
37 | skip "couldn't find any domains to enumerate"
38 | end
39 | ensure
40 | service.stop
41 | end
42 |
43 | def test_async_register_browse
44 | registered = Latch.new
45 | found = Latch.new
46 | name = SecureRandom.hex
47 |
48 | register = DNSSD::Service.register name, "_http._tcp", nil, 8080
49 | register.async_each do |reply|
50 | if reply.domain == "local."
51 | registered.release
52 | found.await
53 | end
54 | end
55 |
56 | registered.await
57 |
58 | browse = DNSSD::Service.browse '_http._tcp'
59 | browse.async_each do |r|
60 | if r.name == name && r.domain == "local."
61 | found.release
62 | assert_equal name, r.name
63 | assert_equal "_http._tcp", r.type
64 | end
65 | end
66 |
67 | register.stop
68 | browse.stop
69 | end
70 |
71 | def test_register_browse
72 | registered = Latch.new
73 | found = Latch.new
74 | name = SecureRandom.hex
75 |
76 | broadcast = Thread.new do
77 | service = DNSSD::Service.register name, "_http._tcp", nil, 8080
78 | service.each do |reply|
79 | if reply.domain == "local."
80 | registered.release
81 | found.await
82 | service.stop
83 | end
84 | end
85 | end
86 |
87 | find = Thread.new do
88 | registered.await
89 | service = DNSSD::Service.browse '_http._tcp'
90 | service.each do |r|
91 | if r.name == name && r.domain == "local."
92 | found.release
93 | service.stop
94 | assert_equal name, r.name
95 | assert_equal "_http._tcp", r.type
96 | end
97 | end
98 | end
99 |
100 | found.await
101 | broadcast.join
102 | find.join
103 | end
104 |
105 | def test_resolve
106 | done = Latch.new
107 | name = SecureRandom.hex
108 |
109 | broadcast = Thread.new do
110 | txt = DNSSD::TextRecord.new 'foo' => 'bar'
111 | service = DNSSD::Service.register name, "_http._tcp", nil, 8080, nil, txt
112 | done.await
113 | service.stop
114 | end
115 |
116 | service = DNSSD::Service.browse '_http._tcp'
117 | reply = service.each.find do |r|
118 | r.name == name && r.domain == "local."
119 | end
120 |
121 | resolver = DNSSD::Service.resolve reply.name, reply.type, reply.domain
122 | text = resolver.each.find(&:text_record).text_record
123 | assert_equal 'bar', text['foo']
124 |
125 | done.release
126 | broadcast.join
127 | end
128 |
129 | def test_query_record
130 | done = Latch.new
131 | name = SecureRandom.hex
132 |
133 | broadcast = Thread.new do
134 | txt = DNSSD::TextRecord.new 'foo' => 'bar'
135 | service = DNSSD::Service.register name, "_http._tcp", nil, 8080, nil, txt
136 | done.await
137 | service.stop
138 | end
139 |
140 | service = DNSSD::Service.browse '_http._tcp'
141 | reply = service.each.find do |r|
142 | r.name == name && r.domain == "local."
143 | end
144 | service.stop
145 |
146 | service = DNSSD::Service.query_record reply.fullname, DNSSD::Record::SRV
147 | assert service.each.first
148 | service.stop
149 |
150 | done.release
151 | broadcast.join
152 | end
153 |
154 | def test_add_record
155 | skip "not supported" if RbConfig::CONFIG['target_os'] =~ /linux/
156 | done = Latch.new
157 | registered = Latch.new
158 | broadcast = Thread.new do
159 | txt = DNSSD::TextRecord.new 'bar' => 'baz'
160 | service = DNSSD::Service.register name, "_http._tcp", nil, 8080
161 | service.add_record(DNSSD::Record::TXT, txt.encode)
162 | registered.release
163 | done.await
164 | end
165 |
166 | registered.await
167 | service = DNSSD::Service.browse '_http._tcp'
168 | reply = service.each.find { |r|
169 | r.name == name && r.domain == "local."
170 | }
171 |
172 | query = DNSSD::Service.query_record reply.fullname, DNSSD::Record::TXT
173 | r = query.each.find do |response|
174 | !response.flags.more_coming?
175 | end
176 | record = DNSSD::TextRecord.decode r.record
177 | done.release
178 | assert_equal 'baz', record['bar']
179 | broadcast.join
180 | end
181 |
182 | def test_stop
183 | service = DNSSD::Service.browse '_http._tcp'
184 | assert_predicate service, :started?
185 | service.stop
186 | refute_predicate service, :started?
187 |
188 | assert_raises(DNSSD::Error) { service.each { } }
189 | end
190 |
191 | def test_stop_twice
192 | service = DNSSD::Service.browse '_http._tcp'
193 | service.stop
194 | assert_raises(DNSSD::Error) { service.stop }
195 | end
196 | end
197 |
--------------------------------------------------------------------------------
/gems/ruby/2.0.0/gems/plist-3.1.0/test/assets/AlbumData.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Application Version
6 | 5.0.4 (263)
7 | Archive Path
8 | /Users/username/Pictures/iPhoto Library
9 | List of Albums
10 |
11 |
12 | AlbumId
13 | 999000
14 | AlbumName
15 | Library
16 | KeyList
17 |
18 | 7
19 |
20 | Master
21 |
22 | PhotoCount
23 | 1
24 | PlayMusic
25 | YES
26 | RepeatSlideShow
27 | YES
28 | SecondsPerSlide
29 | 3
30 | SlideShowUseTitles
31 |
32 | SongPath
33 |
34 | TransitionDirection
35 | 0
36 | TransitionName
37 | Dissolve
38 | TransitionSpeed
39 | 1
40 |
41 |
42 | Album Type
43 | Special Roll
44 | AlbumId
45 | 999001
46 | AlbumName
47 | Last Roll
48 | Filter Mode
49 | All
50 | Filters
51 |
52 |
53 | Count
54 | 1
55 | Operation
56 | In Last
57 | Type
58 | Roll
59 |
60 |
61 | KeyList
62 |
63 | 7
64 |
65 | PhotoCount
66 | 1
67 | PlayMusic
68 | YES
69 | RepeatSlideShow
70 | YES
71 | SecondsPerSlide
72 | 3
73 | SlideShowUseTitles
74 |
75 | SongPath
76 |
77 | TransitionDirection
78 | 0
79 | TransitionName
80 | Dissolve
81 | TransitionSpeed
82 | 1
83 |
84 |
85 | Album Type
86 | Special Month
87 | AlbumId
88 | 999002
89 | AlbumName
90 | Last 12 Months
91 | Filter Mode
92 | All
93 | Filters
94 |
95 | KeyList
96 |
97 | 7
98 |
99 | PhotoCount
100 | 1
101 | PlayMusic
102 | YES
103 | RepeatSlideShow
104 | YES
105 | SecondsPerSlide
106 | 3
107 | SlideShowUseTitles
108 |
109 | SongPath
110 |
111 | TransitionDirection
112 | 0
113 | TransitionName
114 | Dissolve
115 | TransitionSpeed
116 | 1
117 |
118 |
119 | Album Type
120 | Regular
121 | AlbumId
122 | 9
123 | AlbumName
124 | An Album
125 | KeyList
126 |
127 | 7
128 |
129 | PhotoCount
130 | 1
131 | PlayMusic
132 | YES
133 | RepeatSlideShow
134 | YES
135 | SecondsPerSlide
136 | 3
137 | SlideShowUseTitles
138 |
139 | SongPath
140 |
141 | TransitionDirection
142 | 0
143 | TransitionName
144 | Dissolve
145 | TransitionSpeed
146 | 1
147 |
148 |
149 | List of Keywords
150 |
151 | List of Rolls
152 |
153 |
154 | Album Type
155 | Regular
156 | AlbumId
157 | 6
158 | AlbumName
159 | Roll 1
160 | KeyList
161 |
162 | 7
163 |
164 | Parent
165 | 999000
166 | PhotoCount
167 | 1
168 |
169 |
170 | Major Version
171 | 2
172 | Master Image List
173 |
174 | 7
175 |
176 | Aspect Ratio
177 | 1
178 | Caption
179 | fallow_keep.png.450x450.2005-12-04
180 | Comment
181 | a comment
182 | DateAsTimerInterval
183 | 158341389
184 | ImagePath
185 | /Users/username/Pictures/iPhoto Library/2006/01/07/fallow_keep.png.450x450.2005-12-04.jpg
186 | MediaType
187 | Image
188 | MetaModDateAsTimerInterval
189 | 158341439.728129
190 | ModDateAsTimerInterval
191 | 158341389
192 | Rating
193 | 0
194 | Roll
195 | 6
196 | ThumbPath
197 | /Users/username/Pictures/iPhoto Library/2006/01/07/Thumbs/7.jpg
198 |
199 |
200 | Minor Version
201 | 0
202 |
203 |
204 |
--------------------------------------------------------------------------------