vpsmatrix 0.1.1 → 0.1.2
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 +4 -4
- data/lib/vpsmatrix/config.rb +1 -1
- data/lib/vpsmatrix/starter.rb +9 -4
- data/lib/vpsmatrix/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95566a120dc3a2b9c11023cff70d62cbd92f9c21
|
4
|
+
data.tar.gz: 9c22855c45d15913b9e5723b9ed8187a75d553fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee496806cb5582b9e8bd6c6ada68f36d13d17345b2cc5e161da9cae76beb2063e34b1a157c23def08167cbbd8b1987284b2f9315e8084824a0e775b8b08ed301
|
7
|
+
data.tar.gz: 98c4100f1c5e1d24a5330d8094576852f5260f0ce10b78bfbf33e35ba1bacc6ed229b677c7f5872480635c1d8f2638e2e965e972530ad766d14ed693d2001fb1
|
data/lib/vpsmatrix/config.rb
CHANGED
data/lib/vpsmatrix/starter.rb
CHANGED
@@ -2,12 +2,13 @@ require 'thor'
|
|
2
2
|
require 'digest'
|
3
3
|
require 'net/http'
|
4
4
|
require 'uri'
|
5
|
+
require_relative 'config'
|
5
6
|
|
6
7
|
class Starter < Thor
|
7
8
|
include Thor::Actions
|
8
9
|
|
9
|
-
desc 'demo', 'run demo deploy to deploy app to VPS Matrix demo server'
|
10
|
-
def demo
|
10
|
+
desc 'demo deploy', 'run demo deploy to deploy app to VPS Matrix demo server'
|
11
|
+
def demo task
|
11
12
|
|
12
13
|
##
|
13
14
|
# check SSH key in .vpsmatrix dir, else generate new
|
@@ -27,11 +28,13 @@ class Starter < Thor
|
|
27
28
|
# then one config file in app folder?
|
28
29
|
unless File.exists? ".vpsmatrix/id_rsa.pub"
|
29
30
|
# Generate SSH key
|
31
|
+
ssh_key = 'HFKNGEWIUHENINHSLN867G5867BDI7BOQ8YWQF9YFN9QWF'
|
30
32
|
end
|
31
33
|
|
32
34
|
@app_name = Dir.pwd.split(File::SEPARATOR).last
|
33
35
|
unless Config.new.content['api_key']
|
34
36
|
# ask for it to server
|
37
|
+
# TODO check if server returns api_key
|
35
38
|
api_key = send_get_request "https://api.vpsmatrix.net/uploads/get_api_key", {ssh_key: ssh_key}
|
36
39
|
Config.new.write 'api_key', api_key
|
37
40
|
end
|
@@ -60,6 +63,7 @@ class Starter < Thor
|
|
60
63
|
no_commands do
|
61
64
|
def read_files
|
62
65
|
|
66
|
+
puts 'Writing files to temporary file'
|
63
67
|
# TODO check size of directory
|
64
68
|
working_dir = Dir.pwd
|
65
69
|
list_of_files = Dir.glob "#{working_dir}/**/*"
|
@@ -77,16 +81,17 @@ class Starter < Thor
|
|
77
81
|
end
|
78
82
|
|
79
83
|
def stream_file
|
84
|
+
puts 'Stream file to server'
|
80
85
|
uri = URI.parse("https://api.vpsmatrix.net/uploads/send_new_files")
|
81
86
|
|
82
87
|
# stream version
|
83
88
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
84
89
|
req = Net::HTTP::Put.new(uri)
|
85
90
|
req.add_field('Transfer-Encoding', 'chunked')
|
86
|
-
|
91
|
+
req.basic_auth("test_app", "test_app")
|
87
92
|
req.body_stream = File.open("files_to_send")
|
88
93
|
|
89
|
-
http.request
|
94
|
+
http.request req do |response|
|
90
95
|
# puts response
|
91
96
|
response.read_body do |chunk|
|
92
97
|
puts chunk
|
data/lib/vpsmatrix/version.rb
CHANGED