ukku 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzViOTY0ZjU4MzFhNjkyNDM3ZWViNDg0Mzk3NjcxN2FkZWJhMmUyZg==
5
- data.tar.gz: !binary |-
6
- MDUxNTBjZDBlNmY4OTYwYWJiMmUzOTIyZGNkZjM4MDM1YTVkN2FkMg==
2
+ SHA1:
3
+ metadata.gz: 305c7f9a904bcd72a8c94e34412a3df87f8ddd1b
4
+ data.tar.gz: df9ab5f883072fa59f7bb2f5984f0615275728a9
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZjVlMTlkN2QxNDY1YTZhNzlmNzNlYmMyYWI4NGMyN2E0ZjQ1YjFhMGQwNzIz
10
- NzBmN2EyNzMxNWFkZWU3YWIzZGU1YTc4NmMwMjc0NjM3NmE5NGQ0ZDQ1YTkx
11
- Njk4NTMyYWQ5MzQ4NDQ4ZjI3NDNiYWY2OWY2N2RjYzcxZjhiZjc=
12
- data.tar.gz: !binary |-
13
- MzI1YWY0N2NmNTMwNzFjODI1M2EwOTk5ODU3OWVhMjYzYzgwZWZhNWM1ZjZm
14
- YjY5ZTU1M2JhMzRlOGY3NDYxZDE0NjkxM2E1NzAyMzI5ZDJjOWU3NjkxZWZi
15
- MzAzZmEyYjdmNzRlMTgwMmU5MTY5YTQ5OGJkOWYwMmY4YTljYmM=
6
+ metadata.gz: 2a1e0f80855a522b8b73d2012d93a757fe653522f8345671c2b2a406bea7cc8b862e55614ea6eb09bf03f38d738949d180dffd2cb51db21414da38859c77f517
7
+ data.tar.gz: 4fc31d926872b5e33914d67885188d53605b0c1675842cd269b2557b4ca37f1c59e02b39290b856ba26a59fb7e31e4682baecbd1882532e4752d3332ca479787
data/bin/ukku CHANGED
@@ -12,6 +12,9 @@ Ukku.
12
12
  Usage:
13
13
  ukku configure [-u USER] [-i IDENTITY_FILE] HOST [NAME]
14
14
  ukku [--app=NAME] run COMMAND...
15
+ ukku [--app=NAME] keys:upload PUBLIC_KEY_FILE
16
+ ukku [--app=NAME] vars
17
+ ukku [--app=NAME] vars:set VAR_NAME VAR_VALUE
15
18
 
16
19
  Arguments:
17
20
  HOST Domain or IP of your server.
@@ -33,6 +36,11 @@ begin
33
36
  # execute commands
34
37
  ConfigureCommand.new.execute(args) if args['configure']
35
38
  RunCommand.new.execute(args) if args['run']
39
+ UploadKeyCommand.new.execute(args) if args['keys:upload']
40
+ VarsCommand.new.execute(args) if args['vars']
41
+ SetVarCommand.new.execute(args) if args['vars:set']
42
+ rescue Docopt::Exit => e
43
+ puts doc.strip
36
44
  rescue Exception => e
37
45
  puts " ! #{e.message}"
38
46
  exit 1
@@ -2,3 +2,6 @@ require 'ukku/version.rb'
2
2
  require 'ukku/connection.rb'
3
3
  require 'ukku/configure_command.rb'
4
4
  require 'ukku/run_command.rb'
5
+ require 'ukku/vars_command.rb'
6
+ require 'ukku/set_var_command.rb'
7
+ require 'ukku/upload_key_command.rb'
@@ -31,6 +31,8 @@ class ConfigureCommand
31
31
 
32
32
  append_ukku_file_to_gitignore
33
33
 
34
+ print_ssh_config if identity_file
35
+
34
36
  puts
35
37
  puts "Your server is configured! Deploy your application using 'git push #{name} master'"
36
38
  end
@@ -58,10 +60,9 @@ class ConfigureCommand
58
60
 
59
61
  def configure_server(conn)
60
62
  wget1_command = "wget https://raw.githubusercontent.com/germanescobar/ukku/master/server/bootstrap.sh"
61
- wget2_command = "wget https://raw.githubusercontent.com/germanescobar/ukku/master/server/run.sh"
62
- chmod_command = "chmod 755 bootstrap.sh run.sh"
63
+ chmod_command = "chmod 755 bootstrap.sh"
63
64
  run_command = "./bootstrap.sh"
64
- conn.execute "#{wget1_command} && #{wget2_command} && #{chmod_command} && #{run_command}"
65
+ conn.execute "#{wget1_command} && #{chmod_command} && #{run_command}"
65
66
  end
66
67
 
67
68
  def fetch_repo
@@ -100,4 +101,15 @@ class ConfigureCommand
100
101
  end
101
102
  end
102
103
 
104
+ def print_ssh_config
105
+ puts "*********************************************************************"
106
+ puts "ATTENTION: Add the following to '~/.ssh/config' before deploying"
107
+ puts "(create the file if necessary; erase any other entry with same host):"
108
+ puts
109
+ puts "Host #{host}"
110
+ puts " User git"
111
+ puts " IdentityFile #{identity_file}"
112
+ puts "*********************************************************************"
113
+ end
114
+
103
115
  end
@@ -5,12 +5,17 @@ class Connection
5
5
  @identity_file = identity_file
6
6
  end
7
7
 
8
- def execute(command)
9
- args = ["ssh", "-t"]
8
+ def execute(command, &blk)
9
+ args = ["ssh"]
10
+ args << "-t" if blk.nil?
10
11
  if @identity_file
11
12
  args += ["-i", @identity_file ]
12
13
  end
13
14
  args += ["#{@user}@#{@host}", "#{command}"]
14
- Subprocess.check_call(args)
15
+ if blk
16
+ Subprocess.check_call(args, stdin: Subprocess::PIPE, &blk)
17
+ else
18
+ Subprocess.check_call(args)
19
+ end
15
20
  end
16
21
  end
@@ -27,6 +27,6 @@ class RunCommand
27
27
 
28
28
  puts "Running command '#{command}' on #{host} ..."
29
29
  conn = Connection.new(host, user, identity_file)
30
- conn.execute("./run.sh #{command}")
30
+ conn.execute("runcommand #{command}")
31
31
  end
32
32
  end
@@ -0,0 +1,28 @@
1
+ class SetVarCommand
2
+ def execute(args)
3
+ var_name = args['VAR_NAME']
4
+ var_value = args['VAR_VALUE']
5
+
6
+ data = YAML.load_file(UKKU_FILE)
7
+ name, server = data.first
8
+ if name.nil?
9
+ raise "No application configured. Run 'ukku configure <host>' first."
10
+ end
11
+
12
+ if data.length > 1
13
+ if args['--app'].empty?
14
+ raise "No app specified, use the --app NAME option"
15
+ else
16
+ name = args[--app]
17
+ sever = data[name]
18
+ end
19
+ end
20
+
21
+ host = server['host']
22
+ user = server['user']
23
+ identity_file = server['identity_file']
24
+
25
+ conn = Connection.new(host, user, identity_file)
26
+ conn.execute("mkdir -p /etc/vars && echo '#{var_value}' > /etc/vars/#{var_name} && launchapp")
27
+ end
28
+ end
@@ -0,0 +1,42 @@
1
+ class UploadKeyCommand
2
+ def execute(args)
3
+ data = YAML.load_file(UKKU_FILE)
4
+ name, server = data.first
5
+ if name.nil?
6
+ raise "No application configured. Run 'ukku configure <host>' first."
7
+ end
8
+
9
+ if data.length > 1
10
+ if args['--app'].empty?
11
+ raise "No app specified, use the --app NAME option"
12
+ else
13
+ name = args[--app]
14
+ sever = data[name]
15
+ end
16
+ end
17
+
18
+ host = server['host']
19
+ user = server['user']
20
+ identity_file = server['identity_file']
21
+
22
+ key_file = args['PUBLIC_KEY_FILE']
23
+
24
+ conn = Connection.new(host, user, identity_file)
25
+
26
+ puts "Uploading key '#{key_file}' ... "
27
+ conn.execute("gitreceive upload-key ukku") do |p|
28
+ p.communicate IO.read(File.expand_path(key_file))
29
+ end
30
+ puts "Done!"
31
+
32
+ puts
33
+ puts "*********************************************************************"
34
+ puts "ATTENTION: Add the following to '~/.ssh/config' before deploying"
35
+ puts "(create the file if necessary; erase any other entry with same host):"
36
+ puts
37
+ puts "Host #{host}"
38
+ puts " User git"
39
+ puts " IdentityFile #{key_file}"
40
+ puts "*********************************************************************"
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ class VarsCommand
2
+ def execute(args)
3
+ data = YAML.load_file(UKKU_FILE)
4
+ name, server = data.first
5
+ if name.nil?
6
+ raise "No application configured. Run 'ukku configure <host>' first."
7
+ end
8
+
9
+ if data.length > 1
10
+ if args['--app'].empty?
11
+ raise "No app specified, use the --app NAME option"
12
+ else
13
+ name = args[--app]
14
+ sever = data[name]
15
+ end
16
+ end
17
+
18
+ host = server['host']
19
+ user = server['user']
20
+ identity_file = server['identity_file']
21
+
22
+ conn = Connection.new(host, user, identity_file)
23
+ conn.execute("mkdir -p /etc/vars && FILES=/etc/vars/*; for f in $FILES; do echo \"${f##*/}=$(<$f)\"; done")
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Ukku
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ukku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Germán Escobar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-19 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aruba
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -126,6 +126,9 @@ files:
126
126
  - lib/ukku/configure_command.rb
127
127
  - lib/ukku/connection.rb
128
128
  - lib/ukku/run_command.rb
129
+ - lib/ukku/set_var_command.rb
130
+ - lib/ukku/upload_key_command.rb
131
+ - lib/ukku/vars_command.rb
129
132
  - lib/ukku/version.rb
130
133
  - test/default_test.rb
131
134
  - test/test_helper.rb
@@ -141,17 +144,17 @@ require_paths:
141
144
  - lib
142
145
  required_ruby_version: !ruby/object:Gem::Requirement
143
146
  requirements:
144
- - - ! '>='
147
+ - - ">="
145
148
  - !ruby/object:Gem::Version
146
149
  version: '0'
147
150
  required_rubygems_version: !ruby/object:Gem::Requirement
148
151
  requirements:
149
- - - ! '>='
152
+ - - ">="
150
153
  - !ruby/object:Gem::Version
151
154
  version: '0'
152
155
  requirements: []
153
156
  rubyforge_project:
154
- rubygems_version: 2.4.1
157
+ rubygems_version: 2.4.4
155
158
  signing_key:
156
159
  specification_version: 4
157
160
  summary: Easily deploy your application to your own server using "git push"