Class: Pod::X::Installer

Inherits:
Object
  • Object
show all
Extended by:
Executable
Defined in:
lib/cocoapods-x/extension/installer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInstaller

Returns a new instance of Installer.



24
25
26
27
28
29
# File 'lib/cocoapods-x/extension/installer.rb', line 24

def initialize 
    @project = nil
    @workspace = nil
    @pods_builder = Pod::X::PodsBuilder::new
    @sources_builder = Pod::X::SourcesBuilder::new
end

Instance Attribute Details

#init_methodObject

Returns the value of attribute init_method.



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

def init_method
  @init_method
end

#init_selfObject

Returns the value of attribute init_self.



11
12
13
# File 'lib/cocoapods-x/extension/installer.rb', line 11

def init_self
  @init_self
end

#pod_methodObject

Returns the value of attribute pod_method.



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

def pod_method
  @pod_method
end

#pod_selfObject

Returns the value of attribute pod_self.



11
12
13
# File 'lib/cocoapods-x/extension/installer.rb', line 11

def pod_self
  @pod_self
end

#pods_builderObject

Returns the value of attribute pods_builder.



14
15
16
# File 'lib/cocoapods-x/extension/installer.rb', line 14

def pods_builder
  @pods_builder
end

#print_post_install_message_methodObject

Returns the value of attribute print_post_install_message_method.



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

def print_post_install_message_method
  @print_post_install_message_method
end

#print_post_install_message_selfObject

Returns the value of attribute print_post_install_message_self.



11
12
13
# File 'lib/cocoapods-x/extension/installer.rb', line 11

def print_post_install_message_self
  @print_post_install_message_self
end

#projectObject

Returns the value of attribute project.



15
16
17
# File 'lib/cocoapods-x/extension/installer.rb', line 15

def project
  @project
end

#reposObject

Returns the value of attribute repos.



17
18
19
# File 'lib/cocoapods-x/extension/installer.rb', line 17

def repos
  @repos
end

#sources_builderObject

Returns the value of attribute sources_builder.



14
15
16
# File 'lib/cocoapods-x/extension/installer.rb', line 14

def sources_builder
  @sources_builder
end

#target_methodObject

Returns the value of attribute target_method.



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

def target_method
  @target_method
end

#target_selfObject

Returns the value of attribute target_self.



11
12
13
# File 'lib/cocoapods-x/extension/installer.rb', line 11

def target_self
  @target_self
end

#use_reposObject

Returns the value of attribute use_repos.



18
19
20
# File 'lib/cocoapods-x/extension/installer.rb', line 18

def use_repos
  @use_repos
end

#workspaceObject

Returns the value of attribute workspace.



15
16
17
# File 'lib/cocoapods-x/extension/installer.rb', line 15

def workspace
  @workspace
end

Class Method Details

.installerObject



31
32
33
34
# File 'lib/cocoapods-x/extension/installer.rb', line 31

def self.installer
    @@shared ||= Pod::X::Installer::new
    @@shared
end

Instance Method Details

#monitor_initialize_begin(defined_in_file = nil, internal_hash = {}, &block) ⇒ Object

monitor



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cocoapods-x/extension/installer.rb', line 38

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 + 'Working...'.green
end

#monitor_initialize_end(defined_in_file = nil, internal_hash = {}, &block) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/cocoapods-x/extension/installer.rb', line 56

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) ⇒ Object



85
86
87
88
89
90
91
92
93
# File 'lib/cocoapods-x/extension/installer.rb', line 85

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) ⇒ Object



95
96
97
# File 'lib/cocoapods-x/extension/installer.rb', line 95

def monitor_pod_end(name, *requirements)
    nil
end

#monitor_print_post_install_message_beginObject



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/cocoapods-x/extension/installer.rb', line 99

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_endObject



122
123
124
# File 'lib/cocoapods-x/extension/installer.rb', line 122

def monitor_print_post_install_message_end

end

#monitor_target_begin(name, options = nil, &block) ⇒ Object



77
78
79
# File 'lib/cocoapods-x/extension/installer.rb', line 77

def monitor_target_begin(name, options = nil, &block)

end

#monitor_target_end(name, options = nil, &block) ⇒ Object



81
82
83
# File 'lib/cocoapods-x/extension/installer.rb', line 81

def monitor_target_end(name, options = nil, &block)

end