vikingio 0.0.4 → 0.0.5

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: d739b0c4f41820cef3b18de08cb5a1c8c6bdbfe0
4
- data.tar.gz: 658778efd420af2907bea5fc8f7c489518cca713
3
+ metadata.gz: 5959b8f07fca2207bc45c91b131c001286a97c7d
4
+ data.tar.gz: 988b3cae379904c96f908492cb58a2cd6f3ad1e7
5
5
  SHA512:
6
- metadata.gz: 688bfa301decfbc8ec1223171d0639d6efc7cc3b6d783cc55442e34cb8a00e5c31bb9efaf51e2899d4b0fd7809c3fda8ac1284ad7f749e3b6825270f29ec3150
7
- data.tar.gz: e8e9af5d1ef2ce5ac4d200d316280c9b705fd4b8d2983c7552eba508adcc4b4ea85d8f260c36582f3876ebe91d5c4a503c9e30c064f2e941401d9e1793005702
6
+ metadata.gz: 446b5231e205e200834d711492f0bdd0d521b6c6c45a0b42c7a720160df7792194fcde44ac204c0b68e9ffa628a4204cc8e40fbe520be6b53fc694535ffc9eb0
7
+ data.tar.gz: 5f6046bf32913927037bbc1db8b8f0e5bab8fd5c64618415f121d0bf00f27c04e8dafcc1740aaa90d4a7e4230a500a9ed5f04f96396fce4b367ea68e1e7ccfa0
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.
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,6 +1,11 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- # start up the CLI
5
- 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"
6
11
  VikingIO::CLI.start(*ARGV)
File without changes
File without changes
@@ -1,153 +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
- req = Net::HTTP::Get.new(uri.path)
13
- req['x-vikingio-user-key'] = user_key
14
- req['x-vikingio-app-key'] = app_key
15
- resp = http.request(req)
16
- return JSON.parse(resp.body)
17
- end
18
-
19
- def self.deploy_data(user_key, app_key, data_path)
20
- uri = URI.join(BASE_BUILD_PATH, "deploy_data")
21
-
22
- req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(data_path, "application/octet-stream")}
23
- req['x-vikingio-user-key'] = user_key
24
- req['x-vikingio-key'] = app_key
25
- res = Net::HTTP.start(uri.host, uri.port) do |http|
26
- http.request(req)
27
- end
28
- end
29
-
30
- def self.deploy_servers(user_key, app_key, server_path)
31
- uri = URI.join(BASE_BUILD_PATH, "deploy_servers")
32
-
33
- req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(server_path, "application/octet-stream")}
34
- req['x-vikingio-user-key'] = user_key
35
- req['x-vikingio-key'] = app_key
36
- res = Net::HTTP.start(uri.host, uri.port) do |http|
37
- http.request(req)
38
- end
39
- end
40
-
41
- def self.deploy_check(user_key, app_key)
42
- uri = URI.join(BASE_BUILD_PATH, "deploy_check")
43
- http = Net::HTTP.new(uri.host, uri.port)
44
- req = Net::HTTP::Get.new(uri.path)
45
- req['x-vikingio-user-key'] = user_key
46
- req['x-vikingio-key'] = app_key
47
- req['x-vikingio-nodefile'] = VikingIO::CLI.get_node_data.to_json
48
- resp = http.request(req)
49
- return resp.body
50
- end
51
-
52
- def self.deploy(user_key, app_key)
53
- uri = URI.join(BASE_BUILD_PATH, "deploy")
54
- http = Net::HTTP.new(uri.host, uri.port)
55
- req = Net::HTTP::Get.new(uri.path)
56
- req['x-vikingio-user-key'] = user_key
57
- req['x-vikingio-key'] = app_key
58
- req['x-vikingio-nodefile'] = VikingIO::CLI.get_node_data.to_json
59
- resp = http.request(req)
60
- return resp.body
61
- end
62
-
63
- def self.request_build_job(user_key, app_key)
64
- uri = URI.join(BASE_BUILD_PATH, "start")
65
-
66
- http = Net::HTTP.new(uri.host, uri.port)
67
- req = Net::HTTP::Get.new(uri.path)
68
- req['x-vikingio-user-key'] = user_key
69
- req['x-vikingio-key'] = app_key
70
- http.request(req)
71
- end
72
-
73
- def self.synchronize_file(user_key, app_key, file)
74
- uri = URI.join(BASE_BUILD_PATH, "sync")
75
-
76
- req = Net::HTTP::Post::Multipart.new uri.path, {"file" => UploadIO.new(file, "application/octet-stream"), "build-rfname" => file.gsub(File.join(Dir.pwd, "VikingIO"), "")}
77
- req['x-vikingio-user-key'] = user_key
78
- req['x-vikingio-key'] = app_key
79
- res = Net::HTTP.start(uri.host, uri.port) do |http|
80
- http.request(req)
81
- end
82
- end
83
-
84
- def self.compile_server(user_key, app_key, app_name)
85
- uri = URI.join(BASE_BUILD_PATH, "compile")
86
-
87
- http = Net::HTTP.new(uri.host, uri.port)
88
- req = Net::HTTP::Get.new(uri.path)
89
- req['x-vikingio-user-key'] = user_key
90
- req['x-vikingio-key'] = app_key
91
- req['x-vikingio-app-name'] = app_name
92
- resp = http.request(req)
93
-
94
- puts resp.body
95
- end
96
-
97
- def self.authenticate(email, password)
98
- uri = URI.join(BASE_PATH, "auth")
99
-
100
- http = Net::HTTP.new(uri.host, uri.port)
101
- http.use_ssl = true
102
-
103
- request = Net::HTTP::Post.new(uri.request_uri)
104
- request.set_form_data({"email" => email, "password" => password})
105
-
106
- response = http.request(request)
107
-
108
- return nil if response.code == "403"
109
- puts "Unable to reach server." and return nil if response.code == "401"
110
-
111
- json = JSON.parse(response.body)
112
-
113
- return json["key"]
114
- end
115
-
116
- def self.create_app(name)
117
- uri = URI.join(BASE_PATH, "apps")
118
-
119
- http = Net::HTTP.new(uri.host, uri.port)
120
- http.use_ssl = true
121
- req = Net::HTTP::Post.new(uri.path)
122
- req['x-vikingio-user-key'] = VikingIO::CLI.get_netrc_key
123
- req.set_form_data({"name" => name})
124
- response = http.request(req)
125
-
126
- return nil if response.code == "403"
127
- puts "Unable to reach server." and return nil if response.code == "401"
128
-
129
- return JSON.parse(response.body)
130
- end
131
-
132
- def self.create_node(name, app_key)
133
- return nil if name == "" || name == nil
134
-
135
- uri = URI.join(BASE_PATH, "nodes")
136
-
137
- http = Net::HTTP.new(uri.host, uri.port)
138
- http.use_ssl = true
139
- req = Net::HTTP::Post.new(uri.path)
140
- req['x-vikingio-user-key'] = VikingIO::CLI.get_netrc_key
141
- req['x-vikingio-app-key'] = app_key
142
- req.set_form_data({"name" => name})
143
- response = http.request(req)
144
-
145
- return nil if response.code == "403"
146
- puts "Unable to reach server." and return nil if response.code == "401"
147
-
148
- return JSON.parse(response.body)
149
- end
150
-
151
- end
152
- end
153
- 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