rockette 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2870c274fb8f46b67ff9590364eeb0b68936e046a2a33c162de7410542c735af
4
- data.tar.gz: b2932d43fbd1562c79b86408afb907b1db2bf4c2fb8d072fdd36d61393dccd92
3
+ metadata.gz: 0f2bd092666b9d3952a13d9009337006088e6953db8f418274bf645ba98ea99c
4
+ data.tar.gz: ed1e3372aae98f79c10845c67a726a8b83a7cf7bd68edf6d8b7ef2fe382feea2
5
5
  SHA512:
6
- metadata.gz: c214dc82ce832ae90d328447062ba8ac98a56ff3ab1056d7724123c8ae0da01bb3909845671b45ce2f869f6c2d880b326d8b7105f2a42c7069ac3618c3aad357
7
- data.tar.gz: 1b9b8d76c9e547d8af19382d5b0eed3800f4e914f8f5dbe34933c75fdd1c766042ef289af4f0fd4f59167e8d71422a68edf35d88a71693cdba45e1c6781747f6
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 = "f#{@options[:app_id]}.sql"
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 = File.join(EXPORT_DIR, @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("OK, deploying export file #{@filey}")
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
@@ -3,8 +3,9 @@
3
3
  # Add common methods to Rockette module
4
4
  module TextHelper
5
5
  def bail
6
- puts "Bailing, unable to check for application. Can you access the url from here?"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rockette
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
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.1
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-16 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry