rockette 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f2866e9216bcc77870fb829a23f4da29fbd89f74a0295a4ca4f65f7f555cd5c
4
+ data.tar.gz: 3e4c48b3266e2c701b398b7f485b19570c559488f7cd5262a06ae5e8a3b1f6ad
5
+ SHA512:
6
+ metadata.gz: a5d48288aa8a6c1c40ddf2cd3c13126053ced38e04fc76545195be38ab3f5dd67c50d35e7a1f74f0b679f4d720188b6138173b70719844c0a0bf1b21ff7c7a40
7
+ data.tar.gz: 2da2d82b7ac75cc3e3d53e7f6b13f5d4152309fa907e172f6f221407751a4f24666cd3e3c37e2a870738c6f3534772a1b97860de1037c492f6c4b3ec57adb4fe
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.0.0
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.8
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # Additional things to ignore
11
+ *.sql
12
+ config.json
13
+ *.gem
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.0.0] - 2021-02-08
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at kodywilson@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rockette.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rockette (0.0.0)
5
+ rest-client (~> 2.0)
6
+ thor (~> 1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ domain_name (0.5.20190701)
13
+ unf (>= 0.0.5, < 1.0.0)
14
+ http-accept (1.7.0)
15
+ http-cookie (1.0.3)
16
+ domain_name (~> 0.5)
17
+ mime-types (3.3.1)
18
+ mime-types-data (~> 3.2015)
19
+ mime-types-data (3.2021.0212)
20
+ minitest (5.14.4)
21
+ netrc (0.11.0)
22
+ parallel (1.20.1)
23
+ parser (3.0.0.0)
24
+ ast (~> 2.4.1)
25
+ rainbow (3.0.0)
26
+ rake (13.0.3)
27
+ regexp_parser (2.1.1)
28
+ rest-client (2.1.0)
29
+ http-accept (>= 1.7.0, < 2.0)
30
+ http-cookie (>= 1.0.2, < 2.0)
31
+ mime-types (>= 1.16, < 4.0)
32
+ netrc (~> 0.8)
33
+ rexml (3.2.4)
34
+ rubocop (1.10.0)
35
+ parallel (~> 1.10)
36
+ parser (>= 3.0.0.0)
37
+ rainbow (>= 2.2.2, < 4.0)
38
+ regexp_parser (>= 1.8, < 3.0)
39
+ rexml
40
+ rubocop-ast (>= 1.2.0, < 2.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (>= 1.4.0, < 3.0)
43
+ rubocop-ast (1.4.1)
44
+ parser (>= 2.7.1.5)
45
+ ruby-progressbar (1.11.0)
46
+ thor (1.1.0)
47
+ unf (0.1.4)
48
+ unf_ext
49
+ unf_ext (0.0.7.7)
50
+ unicode-display_width (2.0.0)
51
+
52
+ PLATFORMS
53
+ ruby
54
+ x86_64-darwin-19
55
+
56
+ DEPENDENCIES
57
+ minitest (~> 5.0)
58
+ rake (~> 13.0)
59
+ rockette!
60
+ rubocop (~> 1.7)
61
+
62
+ BUNDLED WITH
63
+ 2.2.11
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Kody Wilson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Rockette
2
+
3
+ Rockette was designed to aid you in exporting and importing APEX applications.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rockette'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rockette
20
+
21
+ ## Usage
22
+
23
+ Run rockette export to create and download an exported application file.
24
+ Run rockette deploy to push and import an application export.
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rockette. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rockette/blob/master/CODE_OF_CONDUCT.md).
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
39
+
40
+ ## Code of Conduct
41
+
42
+ Everyone interacting in the Rockette project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rockette/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "rockette"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ require "pry"
12
+ Pry.start
13
+
14
+ # require "irb"
15
+ # IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/rockette ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ lib_path = File.expand_path('../lib', __dir__)
5
+ $:.unshift(lib_path) if !$:.include?(lib_path)
6
+ require 'rockette/cli'
7
+
8
+ CONF = JSON.parse(File.read('config.json'))
9
+ ENV["THOR_SILENCE_DEPRECATION"] = "true"
10
+
11
+ Signal.trap('INT') do
12
+ warn("\n#{caller.join("\n")}: interrupted")
13
+ exit(1)
14
+ end
15
+
16
+ begin
17
+ Rockette::CLI.start
18
+ rescue Rockette::CLI::Error => err
19
+ puts "ERROR: #{err.message}"
20
+ exit 1
21
+ end
data/lib/rockette.rb ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rockette/version"
4
+
5
+ module Rockette
6
+ class Error < StandardError; end
7
+ #
8
+ # # Export application on APEX instance
9
+ # def create_export(body, url)
10
+ # response = RestClient.post url, body
11
+ # response
12
+ # rescue StandardError => e
13
+ # # change these, send back the error message, don't puts it!
14
+ # puts "Unable to create export because #{e.message}" # puts error
15
+ # end
16
+
17
+ # # Grab application export from APEX instance
18
+ # def grab_export(url)
19
+ # response = RestClient.get url
20
+ # rescue StandardError => e
21
+ # puts "Unable to grab export because #{e.message}" # puts error
22
+ # end
23
+
24
+ # # Import application export into APEX instance
25
+ # def import_app(url, body)
26
+ # response = RestClient.post url, body
27
+ # rescue StandardError => e
28
+ # puts "Unable to import application because #{e.message}" # puts error
29
+ # end
30
+
31
+ # # Push attachment to api endpoint and show code
32
+ # def push_blob(filey, headers, url)
33
+ # response = RestClient.post url, filey, headers
34
+ # response
35
+ # rescue StandardError => e
36
+ # puts "Unable to push file because #{e.message}" # puts error
37
+ # end
38
+
39
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'rest-client'
5
+ require 'thor'
6
+
7
+ module Rockette
8
+ #
9
+ # @api public
10
+ class CLI < Thor
11
+ # Error raised by this runner
12
+ Error = Class.new(StandardError)
13
+
14
+ desc 'version', 'rockette version'
15
+ def version
16
+ require_relative 'version'
17
+ puts "v#{Rockette::VERSION}"
18
+ end
19
+ map %w(--version -v) => :version
20
+
21
+ desc 'deploy', 'Deploy chosen export file to target APEX instance'
22
+ method_option :help, aliases: '-h', type: :boolean,
23
+ desc: 'Display usage information'
24
+ option :app_id, aliases: '-a', :required => true,
25
+ desc: 'Provide an APEX application ID'
26
+ option :file, aliases: '-f', :required => true,
27
+ desc: 'Provide an APEX application export file (.sql)'
28
+ option :url, aliases: '-u', :required => true,
29
+ desc: 'Provide a valid url'
30
+ def deploy(*)
31
+ if options[:help]
32
+ invoke :help, ['deploy']
33
+ else
34
+ require_relative 'commands/deploy'
35
+ Rockette::Commands::Deploy.new(options).execute
36
+ end
37
+ end
38
+
39
+ desc 'export', 'Export and download application from target APEX environment'
40
+ method_option :help, aliases: '-h', type: :boolean,
41
+ desc: 'Display usage information'
42
+ option :app_id, aliases: '-a', :required => true,
43
+ desc: 'Provide an APEX application ID'
44
+ option :url, aliases: '-u', :required => true,
45
+ desc: 'Provide a valid url'
46
+ def export(*)
47
+ if options[:help]
48
+ invoke :help, ['export']
49
+ else
50
+ require_relative 'commands/export'
51
+ Rockette::Commands::Export.new(options).execute
52
+ end
53
+ end
54
+
55
+ desc 'config', 'Command description...'
56
+ method_option :help, aliases: '-h', type: :boolean,
57
+ desc: 'Display usage information'
58
+ def config(*)
59
+ if options[:help]
60
+ invoke :help, ['config']
61
+ else
62
+ require_relative 'commands/config'
63
+ Rockette::Commands::Config.new(options).execute
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module Rockette
6
+ class Command
7
+ extend Forwardable
8
+
9
+ def_delegators :command, :run
10
+
11
+ # Execute this command
12
+ #
13
+ # @api public
14
+ def execute(*)
15
+ raise(
16
+ NotImplementedError,
17
+ "#{self.class}##{__method__} must be implemented"
18
+ )
19
+ end
20
+
21
+ # The external commands runner
22
+ #
23
+ # @see http://www.rubydoc.info/gems/tty-command
24
+ #
25
+ # @api public
26
+ def command(**options)
27
+ require 'tty-command'
28
+ TTY::Command.new(options)
29
+ end
30
+
31
+ # The cursor movement
32
+ #
33
+ # @see http://www.rubydoc.info/gems/tty-cursor
34
+ #
35
+ # @api public
36
+ def cursor
37
+ require 'tty-cursor'
38
+ TTY::Cursor
39
+ end
40
+
41
+ # Open a file or text in the user's preferred editor
42
+ #
43
+ # @see http://www.rubydoc.info/gems/tty-editor
44
+ #
45
+ # @api public
46
+ def editor
47
+ require 'tty-editor'
48
+ TTY::Editor
49
+ end
50
+
51
+ # File manipulation utility methods
52
+ #
53
+ # @see http://www.rubydoc.info/gems/tty-file
54
+ #
55
+ # @api public
56
+ def generator
57
+ require 'tty-file'
58
+ TTY::File
59
+ end
60
+
61
+ # Terminal output paging
62
+ #
63
+ # @see http://www.rubydoc.info/gems/tty-pager
64
+ #
65
+ # @api public
66
+ def pager(**options)
67
+ require 'tty-pager'
68
+ TTY::Pager.new(options)
69
+ end
70
+
71
+ # Terminal platform and OS properties
72
+ #
73
+ # @see http://www.rubydoc.info/gems/tty-pager
74
+ #
75
+ # @api public
76
+ def platform
77
+ require 'tty-platform'
78
+ TTY::Platform.new
79
+ end
80
+
81
+ # The interactive prompt
82
+ #
83
+ # @see http://www.rubydoc.info/gems/tty-prompt
84
+ #
85
+ # @api public
86
+ def prompt(**options)
87
+ require 'tty-prompt'
88
+ TTY::Prompt.new(options)
89
+ end
90
+
91
+ # Get terminal screen properties
92
+ #
93
+ # @see http://www.rubydoc.info/gems/tty-screen
94
+ #
95
+ # @api public
96
+ def screen
97
+ require 'tty-screen'
98
+ TTY::Screen
99
+ end
100
+
101
+ # The unix which utility
102
+ #
103
+ # @see http://www.rubydoc.info/gems/tty-which
104
+ #
105
+ # @api public
106
+ def which(*args)
107
+ require 'tty-which'
108
+ TTY::Which.which(*args)
109
+ end
110
+
111
+ # Check if executable exists
112
+ #
113
+ # @see http://www.rubydoc.info/gems/tty-which
114
+ #
115
+ # @api public
116
+ def exec_exist?(*args)
117
+ require 'tty-which'
118
+ TTY::Which.exist?(*args)
119
+ end
120
+ end
121
+ end
@@ -0,0 +1 @@
1
+ #
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../command'
4
+
5
+ module Rockette
6
+ module Commands
7
+ class Config < Rockette::Command
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+
12
+ def execute(input: $stdin, output: $stdout)
13
+ # Command logic goes here ...
14
+ output.puts "OK"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../command'
4
+
5
+ module Rockette
6
+ module Commands
7
+ class Deploy < Rockette::Command
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+
12
+ # Import application export into APEX instance
13
+ def import_app(url, body)
14
+ response = RestClient.post url, body
15
+ rescue StandardError => e
16
+ puts "Unable to import application because #{e.message}" # puts error
17
+ end
18
+
19
+ # Push attachment to api endpoint and show code
20
+ def push_blob(filey, headers, url)
21
+ response = RestClient.post url, filey, headers
22
+ response
23
+ rescue StandardError => e
24
+ puts "Unable to push file because #{e.message}" # puts error
25
+ end
26
+
27
+ def execute(input: $stdin, output: $stdout)
28
+ # Create and download export
29
+ output.puts "OK, deploying export file #{@options[:file]}"
30
+ filey = "f#{@options[:app_id]}.sql"
31
+ # First push the chosen export file to the target system.
32
+ push_hdrs = CONF["push_hdrs"]
33
+ push_hdrs["file_name"] = filey
34
+ push_url = @options[:url] + 'data_loader/blob'
35
+ pusher = push_blob(File.open(filey), push_hdrs, push_url)
36
+ # If push was successful, request application import
37
+ if pusher.code == 200 || pusher.code == 201
38
+ sleep 1 # replace with check for file on server
39
+ puts "Pushed #{filey} and attempting import now..."
40
+ body = CONF["deploy_body"]
41
+ body["app_id_src"] = @options[:app_id]
42
+ body["app_id_tgt"] = @options[:app_id]
43
+ body["app_id_tgt"] = "0" #test app copy
44
+ deploy = import_app(@options[:url] + 'deploy/app', body)
45
+ puts deploy.code
46
+ puts deploy.headers
47
+ puts deploy.body
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../command'
4
+
5
+ module Rockette
6
+ module Commands
7
+ class Export < Rockette::Command
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+
12
+ # Export application on APEX instance
13
+ def create_export(body, url)
14
+ response = RestClient.post url, body
15
+ response
16
+ rescue StandardError => e
17
+ # change these, send back the error message, don't puts it!
18
+ puts "Unable to create export because #{e.message}" # puts error
19
+ end
20
+
21
+ # Grab application export from APEX instance
22
+ def grab_export(url)
23
+ response = RestClient.get url
24
+ rescue StandardError => e
25
+ puts "Unable to grab export because #{e.message}" # puts error
26
+ end
27
+
28
+ def execute(input: $stdin, output: $stdout)
29
+ # Create and download export
30
+ output.puts "OK, exporting App ID: #{@options[:app_id]}"
31
+ filey = "f#{@options[:app_id]}.sql"
32
+ body = {
33
+ "app_id" => @options[:app_id]
34
+ }
35
+ export_url = @options[:url] + 'deploy/app_export'
36
+ puts export_url
37
+ export = create_export(body, export_url)
38
+ if export.code == 201 # Check if export was successfully created first
39
+ sleep 1 # Change to query api to see if file is there
40
+ export_url = export_url + '/' + filey
41
+ response = grab_export(export_url)
42
+ # Now write file if export was grabbed.
43
+ if response.code == 200 || response.code == 201
44
+ File.open(filey, 'wb') {|file| file.write(response.body)}
45
+ puts "Downloaded #{filey} and all done here."
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rockette
4
+ VERSION = "0.0.0"
5
+ end
data/rockette.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rockette/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rockette"
7
+ spec.version = Rockette::VERSION
8
+ spec.authors = ["Kody Wilson"]
9
+ spec.email = ["kodywilson@gmail.com"]
10
+
11
+ spec.summary = "Oracle APEX Deployment Assistant"
12
+ spec.description = "Rockette helps deploy and export APEX applications."
13
+ spec.homepage = "https://github.com/kodywilson/rockette"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+ spec.metadata["changelog_uri"] = "https://github.com/kodywilson/rockette/blob/main/CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Dev dependencies
33
+ spec.add_development_dependency "pry", "~> 0.0"
34
+
35
+ # Uncomment to register a new dependency of your gem
36
+ spec.add_dependency "rest-client", "~> 2.0"
37
+ spec.add_dependency "thor", "~> 1.0"
38
+
39
+ # For more information and examples about making a new gem, checkout our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rockette
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kody Wilson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ description: Rockette helps deploy and export APEX applications.
56
+ email:
57
+ - kodywilson@gmail.com
58
+ executables:
59
+ - rockette
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".github/workflows/main.yml"
64
+ - ".gitignore"
65
+ - ".rubocop.yml"
66
+ - CHANGELOG.md
67
+ - CODE_OF_CONDUCT.md
68
+ - Gemfile
69
+ - Gemfile.lock
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - exe/rockette
76
+ - lib/rockette.rb
77
+ - lib/rockette/cli.rb
78
+ - lib/rockette/command.rb
79
+ - lib/rockette/commands/.gitkeep
80
+ - lib/rockette/commands/config.rb
81
+ - lib/rockette/commands/deploy.rb
82
+ - lib/rockette/commands/export.rb
83
+ - lib/rockette/version.rb
84
+ - rockette.gemspec
85
+ homepage: https://github.com/kodywilson/rockette
86
+ licenses:
87
+ - MIT
88
+ metadata:
89
+ allowed_push_host: https://rubygems.org
90
+ homepage_uri: https://github.com/kodywilson/rockette
91
+ source_code_uri: https://github.com/kodywilson/rockette
92
+ changelog_uri: https://github.com/kodywilson/rockette/blob/main/CHANGELOG.md
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: 2.5.0
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubygems_version: 3.1.4
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Oracle APEX Deployment Assistant
112
+ test_files: []