vpsmatrix 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e64482b14abb177030434f658a60b5f653f56364
4
- data.tar.gz: 30956335527eac82a746e522c8aaa08449b46d56
3
+ metadata.gz: 95566a120dc3a2b9c11023cff70d62cbd92f9c21
4
+ data.tar.gz: 9c22855c45d15913b9e5723b9ed8187a75d553fd
5
5
  SHA512:
6
- metadata.gz: 6f8183d09a523c303cbde12f3890c74c0eec671627df0d16051294e57f8e80116bb46c808a1991cb197fa2cd425e602637ec86f9e5b5fd0505f5fe871f78448f
7
- data.tar.gz: b88ed5d453ecbc2735643c346348414e1e2b0d5db95e5fbd0275368c0d2d306f38c2c40c293b8584738f3a05062e2cc4b4c4815d91cc31edc48b70e2a1cfa82e
6
+ metadata.gz: ee496806cb5582b9e8bd6c6ada68f36d13d17345b2cc5e161da9cae76beb2063e34b1a157c23def08167cbbd8b1987284b2f9315e8084824a0e775b8b08ed301
7
+ data.tar.gz: 98c4100f1c5e1d24a5330d8094576852f5260f0ce10b78bfbf33e35ba1bacc6ed229b677c7f5872480635c1d8f2638e2e965e972530ad766d14ed693d2001fb1
@@ -5,7 +5,7 @@ class Config
5
5
  def initialize
6
6
  @file_path = ".vps_matrix/config.yml"
7
7
  unless File.exists? @file_path
8
- Dir.mkdir ".vpsmatrix"
8
+ Dir.mkdir ".vps_matrix"
9
9
  File.open(@file_path, 'w') do |file|
10
10
  file.write "comment: 'Config file for VPS Matrix services'"
11
11
  end
@@ -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
- request.basic_auth("test_app", "test_app")
91
+ req.basic_auth("test_app", "test_app")
87
92
  req.body_stream = File.open("files_to_send")
88
93
 
89
- http.request request do |response|
94
+ http.request req do |response|
90
95
  # puts response
91
96
  response.read_body do |chunk|
92
97
  puts chunk
@@ -1,3 +1,3 @@
1
1
  module Vpsmatrix
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vpsmatrix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mousse