rockette 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +1 -0
- data/lib/rockette.rb +1 -1
- data/lib/rockette/cli.rb +3 -1
- data/lib/rockette/commands/deploy.rb +16 -8
- data/lib/rockette/text_helper.rb +8 -1
- data/lib/rockette/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f2bd092666b9d3952a13d9009337006088e6953db8f418274bf645ba98ea99c
|
4
|
+
data.tar.gz: ed1e3372aae98f79c10845c67a726a8b83a7cf7bd68edf6d8b7ef2fe382feea2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea97f6f7946d19d31879ce554d825ed2303ccf511761645529e0213df1cdfdb0ce5b18fb94dd493fa21597703bef54575b6fdd2254c0582f3c36a1089a00d028
|
7
|
+
data.tar.gz: ff75dcaf8d481ff7f2a63e4212634dec0e2e60172b6da158cd9dc5f8d51505f9daa6c0a26a0097113ffec2216d72b3b7aef505a8fb5521afce9e549df93571a2
|
data/CHANGELOG.md
CHANGED
@@ -10,4 +10,10 @@
|
|
10
10
|
- Unify rest calls into Rester class
|
11
11
|
- Improve exception handling including socket errors
|
12
12
|
- Switch to yaml for config
|
13
|
-
- Use ~/.rockette as consistent location for config and exports
|
13
|
+
- Use ~/.rockette as consistent location for config and exports
|
14
|
+
|
15
|
+
## [0.0.2] - 2021-03-18
|
16
|
+
|
17
|
+
- Add copy switch to deploy command
|
18
|
+
- Use file name passed via -f switch
|
19
|
+
- Try to find export file and let caller know if file not found
|
data/README.md
CHANGED
@@ -22,6 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
Run rockette export to create and download an exported application file.
|
24
24
|
Run rockette deploy to push and import an application export.
|
25
|
+
Run rockette help or rockette 'command' help for more information.
|
25
26
|
|
26
27
|
## Development
|
27
28
|
|
data/lib/rockette.rb
CHANGED
@@ -35,7 +35,7 @@ module Rockette
|
|
35
35
|
response = RestClient::Request.execute(headers: @headers,
|
36
36
|
method: VERBS[@meth.downcase], payload: @params,
|
37
37
|
timeout: @config["timeout"], url: @url, verify_ssl: false)
|
38
|
-
rescue SocketError => e
|
38
|
+
rescue SocketError, IOError => e
|
39
39
|
puts "#{e.class}: #{e.message}"
|
40
40
|
nil
|
41
41
|
rescue StandardError => e
|
data/lib/rockette/cli.rb
CHANGED
@@ -23,7 +23,9 @@ module Rockette
|
|
23
23
|
option :file, aliases: "-f", required: true,
|
24
24
|
desc: "Provide an APEX application export file (.sql)"
|
25
25
|
option :url, aliases: "-u", required: true,
|
26
|
-
desc: "Provide a valid url"
|
26
|
+
desc: "Provide a valid APEX deployment url"
|
27
|
+
option :copy, aliases: "-c", required: false,
|
28
|
+
desc: "Use this flag if you are copying an application instead of overwriting"
|
27
29
|
def deploy(*)
|
28
30
|
if options[:help]
|
29
31
|
invoke :help, ["deploy"]
|
@@ -11,16 +11,23 @@ module Rockette
|
|
11
11
|
def initialize(options)
|
12
12
|
super()
|
13
13
|
@options = options
|
14
|
-
@filey =
|
14
|
+
@filey = @options[:file]
|
15
|
+
@body = CONF["deploy_body"]
|
16
|
+
@body["app_id_src"] = "1" # @options[:app_id]
|
17
|
+
@body["app_id_tgt"] = @options[:copy] ? 0 : @options[:app_id]
|
18
|
+
@body["blob_url"] = @filey
|
19
|
+
end
|
20
|
+
|
21
|
+
def file_finder
|
22
|
+
[EXPORT_DIR, "/usr/app", "/usr/local/app"].each do |f|
|
23
|
+
next unless File.exist?(File.join(f, @filey))
|
24
|
+
break File.join(f, @filey) if File.exist?(File.join(f, @filey)) # Take 1st match
|
25
|
+
end
|
15
26
|
end
|
16
27
|
|
17
28
|
def importer
|
18
|
-
body = CONF["deploy_body"]
|
19
|
-
body["app_id_src"] = @options[:app_id]
|
20
|
-
body["app_id_tgt"] = @options[:app_id]
|
21
|
-
# body["app_id_tgt"] = "0" #test app copy
|
22
29
|
url = "#{@options[:url]}deploy/app"
|
23
|
-
response = Rester.new(meth: "Post", params: body, url: url).rest_try
|
30
|
+
response = Rester.new(meth: "Post", params: @body, url: url).rest_try
|
24
31
|
bail unless response
|
25
32
|
abort padder("Error. Got back response code: #{response.code}") unless (200..201).include? response.code
|
26
33
|
response
|
@@ -31,7 +38,8 @@ module Rockette
|
|
31
38
|
push_hdrs["file_name"] = @filey
|
32
39
|
push_url = "#{@options[:url]}data_loader/blob"
|
33
40
|
# Push the chosen export file to the target system
|
34
|
-
filey =
|
41
|
+
filey = file_finder
|
42
|
+
file_not_found if filey.is_a?(Array)
|
35
43
|
response = Rester.new(headers: push_hdrs, meth: "Post", params: File.open(filey), url: push_url).rest_try
|
36
44
|
bail unless response
|
37
45
|
abort padder("Error. Got back response code: #{response.code}") unless (200..201).include? response.code
|
@@ -41,7 +49,7 @@ module Rockette
|
|
41
49
|
def execute(input: $stdin, output: $stdout)
|
42
50
|
check_input(input)
|
43
51
|
# Create and download export
|
44
|
-
output.puts padder("
|
52
|
+
output.puts padder("Attempting to deploy export file #{@filey}...")
|
45
53
|
pusher
|
46
54
|
output.puts padder("Pushed #{@filey} to instance and attempting import now...")
|
47
55
|
# If push was successful, request application import
|
data/lib/rockette/text_helper.rb
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
# Add common methods to Rockette module
|
4
4
|
module TextHelper
|
5
5
|
def bail
|
6
|
-
puts "Bailing,
|
6
|
+
puts "Bailing, a socket (network) or IO error occurred. Can you access the url from here?"
|
7
7
|
puts "Double check the url and make sure you have a network connection to the target."
|
8
|
+
puts
|
8
9
|
exit
|
9
10
|
end
|
10
11
|
|
@@ -12,6 +13,12 @@ module TextHelper
|
|
12
13
|
input unless input.nil?
|
13
14
|
end
|
14
15
|
|
16
|
+
def file_not_found
|
17
|
+
puts "File not found. Double check file name and place in ~/.rockette/exports, /usr/app, or /usr/local/app"
|
18
|
+
puts
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
|
15
22
|
def padder(str)
|
16
23
|
"\n#{str}\n"
|
17
24
|
end
|
data/lib/rockette/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rockette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kody Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|