Class: SimpleDeployer::Command::Project

Inherits:
CommandsBase show all
Defined in:
lib/simple_deployer/commands/project.rb

Instance Method Summary collapse

Methods inherited from CommandsBase

#initialize

Constructor Details

This class inherits a constructor from SimpleDeployer::Command::CommandsBase

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/simple_deployer/commands/project.rb', line 15

def create
    puts "Packaging local folder"
    file = package(Dir.getwd)
    p "Packing done"
    p "Uploading"
    upload(file)
    p "creating project"
    pr_id = @service.create_project(File.basename(file, '.*') + "_project", File.basename(file), @service.config.aws_access_key, @service.config.aws_secret_key)
    @service.config.project_id = pr_id
    @service.config.save_config
    p "Project created, project id saved as default"
#            p "launching server " + pr_id
#            @service.launch_server(pr_id)
#            p "server launched"
end

#databasesObject



52
53
54
55
56
57
# File 'lib/simple_deployer/commands/project.rb', line 52

def databases
    get_project
    databases = @service.databases_list(@pr_id)
    p databases.size >0 ? databases : "No active databases"

end

#deployObject



76
77
78
79
# File 'lib/simple_deployer/commands/project.rb', line 76

def deploy
    get_project
    @service.deploy_code(@pr_id)
end

#deploy_folderObject



67
68
69
70
71
72
73
# File 'lib/simple_deployer/commands/project.rb', line 67

def deploy_folder
    get_project
    file = package(Dir.getwd)
    upload(file)
    @service.deploy_code(pr_id, "scm_url"=> File.basename(file), "scm_type"=>"s3")
    p "Code deployed"
end

#launch_serverObject



46
47
48
49
# File 'lib/simple_deployer/commands/project.rb', line 46

def launch_server
    get_project
    @service.launch_server(@pr_id)
end

#load_balancerObject



60
61
62
63
64
# File 'lib/simple_deployer/commands/project.rb', line 60

def load_balancer
    get_project
    lb = @service.load_balancer(@pr_id)
    p lb ? lb : "No load balancer"
end

#mainObject



5
6
7
8
9
10
11
12
# File 'lib/simple_deployer/commands/project.rb', line 5

def main
    get_project
    project = @service.project_info(@pr_id)
    p "Project info"
    project.each_pair do |k, v|
        p "#{k}:#{v}"
    end
end

#serversObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/simple_deployer/commands/project.rb', line 32

def servers
    get_project
    servers = @service.servers_list(@pr_id)
    if servers.size >0
        servers.each do |s|
            p "ID:" + s["id"] + "; status:" + s["status"]
        end
    else
        p "No active servers"

    end
end