class Pod::X::Installer

Attributes

init_method[RW]
init_self[RW]
pod_method[RW]
pod_self[RW]
pods_builder[RW]
print_post_install_message_method[RW]
print_post_install_message_self[RW]
project[RW]
repos[RW]
sources_builder[RW]
target_method[RW]
target_self[RW]
use_repos[RW]
workspace[RW]

Public Class Methods

installer() click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 32
def self.installer
    @@shared ||= Pod::X::Installer::new
    @@shared
end
new() click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 25
def initialize 
    @project = nil
    @workspace = nil
    @pods_builder = Pod::X::PodsBuilder::new
    @sources_builder = Pod::X::SourcesBuilder::new
end

Public Instance Methods

monitor_initialize_begin(defined_in_file = nil, internal_hash = {}, &block) click to toggle source

monitor

# File lib/cocoapods-x/extension/installer.rb, line 39
def monitor_initialize_begin(defined_in_file = nil, internal_hash = {}, &block)
    workspace = Pod::X::Sandbox::workspace
    return unless workspace.source_file.exist?

    conf = Pod::X::Configurator::find_conf?(Dir.pwd)
    return if conf.nil?
    project = Pod::X::Sandbox::Project::new(conf)
    return unless project.pods_file.exist?

    @project = project
    @workspace = workspace
    @pods_builder::build(project.pods_file)
    @sources_builder::build(workspace.source_file)
    @repos = build_repos()
    @use_repos = Array::new
    UI.puts 'Pod::X '.magenta + "(#{CocoapodsX::VERSION}) Working...".green
end
monitor_initialize_end(defined_in_file = nil, internal_hash = {}, &block) click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 57
def monitor_initialize_end(defined_in_file = nil, internal_hash = {}, &block)
    return nil if @repos.nil?
    return nil if @use_repos.nil?

    @use_repos.each do |name|
        repo = @repos[name]
        repo_url = repo.repo_url
        location_url = repo.location_url
        if repo_url.nil? || location_url.nil?
            UI.puts 'Pod::X '.magenta + "You must specify a repository to clone for '#{name}'.".yellow
        elsif !Dir::exist?(location_url) || Dir::empty?(location_url)
            UI.section('Pod::X '.magenta + "Cloning into '#{name}'...".green) do 
                UI.puts 'Pod::X '.magenta + "'#{name}' from: #{repo_url}".magenta
                UI.puts 'Pod::X '.magenta + "'#{name}' to: #{location_url}".magenta
                rm! ['-rf', location_url]
                git! ['clone', repo_url, location_url]
            end
        end
    end
end
monitor_pod_begin(name, *requirements) click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 86
def monitor_pod_begin(name, *requirements)
    return nil if @repos.nil?
    return nil if @repos[name].nil?
    return nil if @use_repos.nil?
    unless @use_repos.include?(name)
        @use_repos << name
    end
    @repos[name].location_url
end
monitor_pod_end(name, *requirements) click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 96
def monitor_pod_end(name, *requirements)
    nil
end
monitor_print_post_install_message_begin() click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 100
def monitor_print_post_install_message_begin
    return nil if @repos.nil?
    return nil if @use_repos.nil?
    return nil if @use_repos.size <= 0

    @use_repos.each do |name|
        repo = @repos[name]
        location_url = repo.location_url
        unless location_url.nil?
            Dir.chdir(location_url) do
                begin
                    branch = git! ['rev-parse', '--abbrev-ref', 'HEAD']
                    branch = branch.chomp
                    UI.puts 'Pod::X '.magenta + "Installing #{name} (#{branch.red})".green
                rescue => exception
                    UI.puts 'Pod::X '.magenta + "Installing #{name}".green
                end
            end
        end
    end
    UI.puts 'Pod::X '.magenta + "installation complete!".green
end
monitor_print_post_install_message_end() click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 123
def monitor_print_post_install_message_end

end
monitor_target_begin(name, options = nil, &block) click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 78
def monitor_target_begin(name, options = nil, &block)

end
monitor_target_end(name, options = nil, &block) click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 82
def monitor_target_end(name, options = nil, &block)

end

Private Instance Methods

build_repos() click to toggle source
# File lib/cocoapods-x/extension/installer.rb, line 129
def build_repos
    return nil if @pods_builder.nil?
    return nil if @sources_builder.nil?

    repos = Hash::new(nil)
    @pods_builder.pods.each do | name, pod_argv |
        source_argv = @sources_builder.sources[name]
        repo = Pod::X::Sandbox::Repos::Repo(name, pod_argv, source_argv, @workspace, @project)
        unless repo.nil?
            repos[name] = repo
        end
    end
    repos
end