vikingio 0.0.7 → 0.0.8

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba92bc5e2c2e5132d74a48a9a005561ddf765815
4
- data.tar.gz: 2dd7e36625a2c557d3927a8ea13fe74034a3085e
3
+ metadata.gz: 93ca0bd7fc17c016a464c4e3a4d1f0ec8e96260b
4
+ data.tar.gz: 29c046eed9dbe98dd79f7cdb192c24c1cecfd8b0
5
5
  SHA512:
6
- metadata.gz: a17e0326eec1b195b5993b8985999f3b34a78773eeab1eab660d6954cce5f2e48b5386abfe01131e5bbfebe267b9bfbe996cc0669aa2426ea6f7368a04301cd1
7
- data.tar.gz: 85a869d50e71e39f51f464becf27d9b1e3cca07df5e84784db0c94777e008501f28ca6cd0acc4c601fddbca9f6349c722302578f2f325d00e2ad0d220a183e1f
6
+ metadata.gz: 63c53791b9118d8a24ab6da942d7dbe40359a7ec9d6cac1afd148e81587a9abbeb6f1555c2ba6524ee6fe0ee0f4142af175fe8b646a4503bfb1b1d2959396a43
7
+ data.tar.gz: e4639b1beb53e217d0572462f8adee2a6bbb3dd5a5cfc7148ce720f944b911396bd1440bddbdb405924fea4765840fb53fbeee4cf7437a1c41ea8cc024b8318a
data/.gitignore CHANGED
@@ -1,22 +1,22 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in vikingio-cli.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vikingio-cli.gemspec
4
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2014 Eric Campbell
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2014 Eric Campbell
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
- Command Line Toolkit for VikingIO. Sign up at http://www.vikingio.com
2
-
3
- Commands:
4
-
5
- help -
6
- login - Authenticate with VikingIO
7
- logout - Clear your authentication credentials
8
- create - Create a new VikingIO application
9
- generate - Generate a skeleton VikingIO application
10
- link - Link the current directory with an existing VikingIO application
11
- unlink - Unlink the current directory with it's VikingIO application
12
- deploy - Deploy your application
13
- shutdown - Shutdown all production servers
1
+ Command Line Toolkit for VikingIO. Sign up at http://www.vikingio.com
2
+
3
+ Commands:
4
+
5
+ help -
6
+ login - Authenticate with VikingIO
7
+ logout - Clear your authentication credentials
8
+ create - Create a new VikingIO application
9
+ generate - Generate a skeleton VikingIO application
10
+ link - Link the current directory with an existing VikingIO application
11
+ unlink - Unlink the current directory with it's VikingIO application
12
+ deploy - Deploy your application
13
+ shutdown - Shutdown all production servers
14
14
  run - Compile and run your application locally
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
-
1
+ require "bundler/gem_tasks"
2
+
data/bin/vikingio CHANGED
@@ -1,11 +1,11 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- #puts $LOAD_PATH
5
-
6
- lib = File.expand_path(File.join(File.dirname(File.expand_path(__FILE__)), "..", "lib"))
7
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
-
9
- # start up the CLI
10
- require "vikingio/cli"
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ #puts $LOAD_PATH
5
+
6
+ lib = File.expand_path(File.join(File.dirname(File.expand_path(__FILE__)), "..", "lib"))
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+
9
+ # start up the CLI
10
+ require "vikingio/cli"
11
11
  VikingIO::CLI.start(*ARGV)
File without changes
File without changes
data/lib/vikingio/cli.rb CHANGED
@@ -1,49 +1,53 @@
1
- require 'net/http'
2
- require 'uri'
3
- require 'io/console'
4
- require 'json'
5
- require 'fileutils'
6
- require 'yaml'
7
- require 'tmpdir'
8
- require 'open3'
9
- require 'net/http/post/multipart'
10
- require 'openssl'
11
- require 'rbconfig'
12
-
13
- IS_WINDOWS = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
14
-
15
- lib = File.dirname(File.expand_path(__FILE__))
16
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
17
-
18
- require "vikingio/cli/version"
19
- require "vikingio/cli/helpers"
20
- require "vikingio/cli/client"
21
- require "vikingio/cli/commands"
22
-
23
-
24
- module VikingIO
25
- module CLI
26
-
27
- def self.start(*args)
28
- begin
29
- if $stdin.isatty
30
- $stdin.sync = true
31
- end
32
- if $stdout.isatty
33
- $stdout.sync = true
34
- end
35
-
36
- command = args.shift.strip rescue "help"
37
- args.flatten!
38
-
39
- VikingIO::CLI::Commands.run(command, args)
40
-
41
- rescue Interrupt
42
- puts "Command cancelled."
43
- rescue => error
44
- puts error
45
- end
46
- end
47
-
48
- end
49
- end
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'io/console'
4
+ require 'json'
5
+ require 'fileutils'
6
+ require 'yaml'
7
+ require 'tmpdir'
8
+ require 'open3'
9
+ require 'net/http/post/multipart'
10
+ require 'openssl'
11
+ require 'rbconfig'
12
+
13
+ require 'zip'#, '>= 1.0.0' # will load new rubyzip version
14
+ #require 'zip-zip' # will load compatibility for old rubyzip API.
15
+
16
+
17
+
18
+ IS_WINDOWS = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
19
+
20
+ lib = File.dirname(File.expand_path(__FILE__))
21
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
22
+
23
+ require "vikingio/cli/version"
24
+ require "vikingio/cli/helpers"
25
+ require "vikingio/cli/client"
26
+ require "vikingio/cli/commands"
27
+
28
+ module VikingIO
29
+ module CLI
30
+
31
+ def self.start(*args)
32
+ begin
33
+ if $stdin.isatty
34
+ $stdin.sync = true
35
+ end
36
+ if $stdout.isatty
37
+ $stdout.sync = true
38
+ end
39
+
40
+ command = args.shift.strip rescue "help"
41
+ args.flatten!
42
+
43
+ VikingIO::CLI::Commands.run(command, args)
44
+
45
+ rescue Interrupt
46
+ puts "Command cancelled."
47
+ rescue => error
48
+ puts error
49
+ end
50
+ end
51
+
52
+ end
53
+ end
@@ -1,157 +1,157 @@
1
- module VikingIO
2
- module CLI
3
- module Client
4
-
5
- BASE_PATH = "https://www.vikingio.com/api/"
6
- BASE_BUILD_PATH = "http://build1.vikingio.com/"
7
-
8
- def self.get_status(user_key, app_key)
9
- uri = URI.join(BASE_PATH, "apps/status")
10
- http = Net::HTTP.new(uri.host, uri.port)
11
- http.use_ssl = true
12
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
- req = Net::HTTP::Get.new(uri.path)
14
- req['x-vikingio-user-key'] = user_key
15
- req['x-vikingio-app-key'] = app_key
16
- resp = http.request(req)
17
- return JSON.parse(resp.body)
18
- end
19
-
20
- def self.deploy_data(user_key, app_key, data_path)
21
- uri = URI.join(BASE_BUILD_PATH, "deploy_data")
22
-
23
- req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(data_path, "application/octet-stream")}
24
- req['x-vikingio-user-key'] = user_key
25
- req['x-vikingio-key'] = app_key
26
- res = Net::HTTP.start(uri.host, uri.port) do |http|
27
- http.request(req)
28
- end
29
- end
30
-
31
- def self.deploy_servers(user_key, app_key, server_path)
32
- uri = URI.join(BASE_BUILD_PATH, "deploy_servers")
33
-
34
- req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(server_path, "application/octet-stream")}
35
- req['x-vikingio-user-key'] = user_key
36
- req['x-vikingio-key'] = app_key
37
- res = Net::HTTP.start(uri.host, uri.port) do |http|
38
- http.request(req)
39
- end
40
- end
41
-
42
- def self.deploy_check(user_key, app_key)
43
- uri = URI.join(BASE_BUILD_PATH, "deploy_check")
44
- http = Net::HTTP.new(uri.host, uri.port)
45
- req = Net::HTTP::Get.new(uri.path)
46
- req['x-vikingio-user-key'] = user_key
47
- req['x-vikingio-key'] = app_key
48
- req['x-vikingio-nodefile'] = VikingIO::CLI.get_node_data.to_json
49
- resp = http.request(req)
50
- return resp.body
51
- end
52
-
53
- def self.deploy(user_key, app_key)
54
- uri = URI.join(BASE_BUILD_PATH, "deploy")
55
- http = Net::HTTP.new(uri.host, uri.port)
56
- req = Net::HTTP::Get.new(uri.path)
57
- req['x-vikingio-user-key'] = user_key
58
- req['x-vikingio-key'] = app_key
59
- req['x-vikingio-nodefile'] = VikingIO::CLI.get_node_data.to_json
60
- resp = http.request(req)
61
- return resp.body
62
- end
63
-
64
- def self.request_build_job(user_key, app_key)
65
- uri = URI.join(BASE_BUILD_PATH, "start")
66
-
67
- http = Net::HTTP.new(uri.host, uri.port)
68
- req = Net::HTTP::Get.new(uri.path)
69
- req['x-vikingio-user-key'] = user_key
70
- req['x-vikingio-key'] = app_key
71
- http.request(req)
72
- end
73
-
74
- def self.synchronize_file(user_key, app_key, file)
75
- uri = URI.join(BASE_BUILD_PATH, "sync")
76
-
77
- req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(file, "application/octet-stream"), "build-rfname" => file.gsub(File.join(Dir.pwd, "VikingIO"), "")}
78
- req['x-vikingio-user-key'] = user_key
79
- req['x-vikingio-key'] = app_key
80
- res = Net::HTTP.start(uri.host, uri.port) do |http|
81
- http.request(req)
82
- end
83
- end
84
-
85
- def self.compile_server(user_key, app_key, app_name)
86
- uri = URI.join(BASE_BUILD_PATH, "compile")
87
-
88
- http = Net::HTTP.new(uri.host, uri.port)
89
- req = Net::HTTP::Get.new(uri.path)
90
- req['x-vikingio-user-key'] = user_key
91
- req['x-vikingio-key'] = app_key
92
- req['x-vikingio-app-name'] = app_name
93
- resp = http.request(req)
94
-
95
- puts resp.body
96
- end
97
-
98
- def self.authenticate(email, password)
99
- uri = URI.join(BASE_PATH, "auth")
100
-
101
- http = Net::HTTP.new(uri.host, uri.port)
102
- http.use_ssl = true
103
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
104
-
105
- request = Net::HTTP::Post.new(uri.request_uri)
106
- request.set_form_data({"email" => email, "password" => password})
107
-
108
- response = http.request(request)
109
-
110
- return nil if response.code == "403"
111
- puts "Unable to reach server." and return nil if response.code == "401"
112
-
113
- json = JSON.parse(response.body)
114
-
115
- return json["key"]
116
- end
117
-
118
- def self.create_app(name)
119
- uri = URI.join(BASE_PATH, "apps")
120
-
121
- http = Net::HTTP.new(uri.host, uri.port)
122
- http.use_ssl = true
123
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
124
- req = Net::HTTP::Post.new(uri.path)
125
- req['x-vikingio-user-key'] = VikingIO::CLI.get_netrc_key
126
- req.set_form_data({"name" => name})
127
- response = http.request(req)
128
-
129
- return nil if response.code == "403"
130
- puts "Unable to reach server." and return nil if response.code == "401"
131
-
132
- return JSON.parse(response.body)
133
- end
134
-
135
- def self.create_node(name, app_key)
136
- return nil if name == "" || name == nil
137
-
138
- uri = URI.join(BASE_PATH, "nodes")
139
-
140
- http = Net::HTTP.new(uri.host, uri.port)
141
- http.use_ssl = true
142
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
143
- req = Net::HTTP::Post.new(uri.path)
144
- req['x-vikingio-user-key'] = VikingIO::CLI.get_netrc_key
145
- req['x-vikingio-app-key'] = app_key
146
- req.set_form_data({"name" => name})
147
- response = http.request(req)
148
-
149
- return nil if response.code == "403"
150
- puts "Unable to reach server." and return nil if response.code == "401"
151
-
152
- return JSON.parse(response.body)
153
- end
154
-
155
- end
156
- end
157
- end
1
+ module VikingIO
2
+ module CLI
3
+ module Client
4
+
5
+ BASE_PATH = "https://www.vikingio.com/api/"
6
+ BASE_BUILD_PATH = "http://build1.vikingio.com/"
7
+
8
+ def self.get_status(user_key, app_key)
9
+ uri = URI.join(BASE_PATH, "apps/status")
10
+ http = Net::HTTP.new(uri.host, uri.port)
11
+ http.use_ssl = true
12
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
+ req = Net::HTTP::Get.new(uri.path)
14
+ req['x-vikingio-user-key'] = user_key
15
+ req['x-vikingio-app-key'] = app_key
16
+ resp = http.request(req)
17
+ return JSON.parse(resp.body)
18
+ end
19
+
20
+ def self.deploy_data(user_key, app_key, data_path)
21
+ uri = URI.join(BASE_BUILD_PATH, "deploy_data")
22
+
23
+ req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(data_path, "application/octet-stream")}
24
+ req['x-vikingio-user-key'] = user_key
25
+ req['x-vikingio-key'] = app_key
26
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
27
+ http.request(req)
28
+ end
29
+ end
30
+
31
+ def self.deploy_servers(user_key, app_key, server_path)
32
+ uri = URI.join(BASE_BUILD_PATH, "deploy_servers")
33
+
34
+ req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(server_path, "application/octet-stream")}
35
+ req['x-vikingio-user-key'] = user_key
36
+ req['x-vikingio-key'] = app_key
37
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
38
+ http.request(req)
39
+ end
40
+ end
41
+
42
+ def self.deploy_check(user_key, app_key)
43
+ uri = URI.join(BASE_BUILD_PATH, "deploy_check")
44
+ http = Net::HTTP.new(uri.host, uri.port)
45
+ req = Net::HTTP::Get.new(uri.path)
46
+ req['x-vikingio-user-key'] = user_key
47
+ req['x-vikingio-key'] = app_key
48
+ req['x-vikingio-nodefile'] = VikingIO::CLI.get_node_data.to_json
49
+ resp = http.request(req)
50
+ return resp.body
51
+ end
52
+
53
+ def self.deploy(user_key, app_key)
54
+ uri = URI.join(BASE_BUILD_PATH, "deploy")
55
+ http = Net::HTTP.new(uri.host, uri.port)
56
+ req = Net::HTTP::Get.new(uri.path)
57
+ req['x-vikingio-user-key'] = user_key
58
+ req['x-vikingio-key'] = app_key
59
+ req['x-vikingio-nodefile'] = VikingIO::CLI.get_node_data.to_json
60
+ resp = http.request(req)
61
+ return resp.body
62
+ end
63
+
64
+ def self.request_build_job(user_key, app_key)
65
+ uri = URI.join(BASE_BUILD_PATH, "start")
66
+
67
+ http = Net::HTTP.new(uri.host, uri.port)
68
+ req = Net::HTTP::Get.new(uri.path)
69
+ req['x-vikingio-user-key'] = user_key
70
+ req['x-vikingio-key'] = app_key
71
+ http.request(req)
72
+ end
73
+
74
+ def self.synchronize_file(user_key, app_key, file)
75
+ uri = URI.join(BASE_BUILD_PATH, "sync")
76
+
77
+ req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(file, "application/octet-stream"), "build-rfname" => file.gsub(File.join(Dir.pwd, "VikingIO"), "")}
78
+ req['x-vikingio-user-key'] = user_key
79
+ req['x-vikingio-key'] = app_key
80
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
81
+ http.request(req)
82
+ end
83
+ end
84
+
85
+ def self.compile_server(user_key, app_key, app_name)
86
+ uri = URI.join(BASE_BUILD_PATH, "compile")
87
+
88
+ http = Net::HTTP.new(uri.host, uri.port)
89
+ req = Net::HTTP::Get.new(uri.path)
90
+ req['x-vikingio-user-key'] = user_key
91
+ req['x-vikingio-key'] = app_key
92
+ req['x-vikingio-app-name'] = app_name
93
+ resp = http.request(req)
94
+
95
+ puts resp.body
96
+ end
97
+
98
+ def self.authenticate(email, password)
99
+ uri = URI.join(BASE_PATH, "auth")
100
+
101
+ http = Net::HTTP.new(uri.host, uri.port)
102
+ http.use_ssl = true
103
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
104
+
105
+ request = Net::HTTP::Post.new(uri.request_uri)
106
+ request.set_form_data({"email" => email, "password" => password})
107
+
108
+ response = http.request(request)
109
+
110
+ return nil if response.code == "403"
111
+ puts "Unable to reach server." and return nil if response.code == "401"
112
+
113
+ json = JSON.parse(response.body)
114
+
115
+ return json["key"]
116
+ end
117
+
118
+ def self.create_app(name)
119
+ uri = URI.join(BASE_PATH, "apps")
120
+
121
+ http = Net::HTTP.new(uri.host, uri.port)
122
+ http.use_ssl = true
123
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
124
+ req = Net::HTTP::Post.new(uri.path)
125
+ req['x-vikingio-user-key'] = VikingIO::CLI.get_netrc_key
126
+ req.set_form_data({"name" => name})
127
+ response = http.request(req)
128
+
129
+ return nil if response.code == "403"
130
+ puts "Unable to reach server." and return nil if response.code == "401"
131
+
132
+ return JSON.parse(response.body)
133
+ end
134
+
135
+ def self.create_node(name, app_key)
136
+ return nil if name == "" || name == nil
137
+
138
+ uri = URI.join(BASE_PATH, "nodes")
139
+
140
+ http = Net::HTTP.new(uri.host, uri.port)
141
+ http.use_ssl = true
142
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
143
+ req = Net::HTTP::Post.new(uri.path)
144
+ req['x-vikingio-user-key'] = VikingIO::CLI.get_netrc_key
145
+ req['x-vikingio-app-key'] = app_key
146
+ req.set_form_data({"name" => name})
147
+ response = http.request(req)
148
+
149
+ return nil if response.code == "403"
150
+ puts "Unable to reach server." and return nil if response.code == "401"
151
+
152
+ return JSON.parse(response.body)
153
+ end
154
+
155
+ end
156
+ end
157
+ end