Class: Pod::X::Sandbox::Workspace

Inherits:
Sandbox
  • Object
show all
Includes:
Protocol
Defined in:
lib/cocoapods-x/extension/sandbox/workspace.rb

Defined Under Namespace

Classes: Repo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWorkspace

Returns a new instance of Workspace.



14
15
16
17
18
19
# 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

Instance Attribute Details

#projectsObject (readonly)

Returns the value of attribute projects.



12
13
14
# File 'lib/cocoapods-x/extension/sandbox/workspace.rb', line 12

def projects
  @projects
end

#reposObject (readonly)

Returns the value of attribute repos.



12
13
14
# File 'lib/cocoapods-x/extension/sandbox/workspace.rb', line 12

def repos
  @repos
end

#templateObject (readonly)

Returns the value of attribute template.



12
13
14
# File 'lib/cocoapods-x/extension/sandbox/workspace.rb', line 12

def template
  @template
end

Instance Method Details

#all_podsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/cocoapods-x/extension/sandbox/workspace.rb', line 44

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 "        end\n    end\n    all_pods\nend\n"::new(pod_url.basename.to_s, domain_url.basename.to_s, project_url.basename.to_s, pod_url.to_s, branch)

#install!Object



21
22
23
24
25
26
27
28
29
# 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_fileObject



40
41
42
# File 'lib/cocoapods-x/extension/sandbox/workspace.rb', line 40

def source_file
    root + 'sources'
end

#update!Object



31
32
33
34
35
36
37
38
# File 'lib/cocoapods-x/extension/sandbox/workspace.rb', line 31

def update!
    @repos.update!
    @template.update!
    @projects.update!
    
    rm! ['-rf', source_file]
    cp! [@template::source_file, source_file]
end