class Pod::X::Sandbox::Workspace

Constants

Repo

Attributes

projects[R]
repos[R]
template[R]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/cocoapods-x/extension/sandbox/workspace.rb, line 14
def initialize
    super File.join(File.expand_path('~'), '.cocoapods/x')
    @repos = Pod::X::Sandbox::Repos::new root
    @template = Pod::X::Sandbox::Template::new root
    @projects = Pod::X::Sandbox::Projects::new root
end

Public Instance Methods

all_pods() click to toggle source
# File lib/cocoapods-x/extension/sandbox/workspace.rb, line 45
def all_pods
    all_pods = Array::new
    for url in Dir.glob(@repos::root + '*/*') do
        pod_url = Pathname(url)
        if pod_url.directory?
            domain_url = Pathname(pod_url.dirname)
            branch = git_branch(pod_url)
            all_pods << Repo::new(pod_url.basename.to_s, domain_url.basename.to_s, nil, pod_url.to_s, branch)
        end
    end
    for url in Dir.glob(@projects::root + '*/repos/*/*') do
        pod_url = Pathname(url)
        if pod_url.directory?
            domain_url = Pathname(pod_url.dirname)
            project_url = Pathname(Pathname(domain_url.dirname).dirname)
            branch = git_branch(pod_url)
            all_pods <<Repo::new(pod_url.basename.to_s, domain_url.basename.to_s, project_url.basename.to_s, pod_url.to_s, branch)
        end
    end
    all_pods
end
install!() click to toggle source
# File lib/cocoapods-x/extension/sandbox/workspace.rb, line 21
def install!
    @repos.install!
    @template.install! 
    @projects.install!

    unless source_file.exist?
        cp! [@template::source_file, source_file]
    end
end
source_file() click to toggle source
# File lib/cocoapods-x/extension/sandbox/workspace.rb, line 41
def source_file
    root + 'sources'
end
update!() click to toggle source
# File lib/cocoapods-x/extension/sandbox/workspace.rb, line 31
def update!
    @repos.update!
    @template.update!
    @projects.update!
    
    unless source_file.exist?
        cp! [@template::source_file, source_file]
    end
end

Private Instance Methods

git_branch(url) click to toggle source
# File lib/cocoapods-x/extension/sandbox/workspace.rb, line 69
def git_branch url
    branch = nil
    Dir.chdir(url) do
        begin
            branch = git! ['rev-parse', '--abbrev-ref', 'HEAD']
            branch = branch.chomp
        rescue => exception
            branch = nil
        end
    end
    branch
end