Class: Deploy
- Inherits:
-
IRB::Command::Base
- Object
- IRB::Command::Base
- Deploy
- Defined in:
- lib/alet/irb/command/deploy.rb
Instance Method Summary collapse
- #deploy_component(component_type, argv, options) ⇒ Object
- #deploy_file(argv, manifest, options) ⇒ Object
- #execute(arg) ⇒ Object
Instance Method Details
#deploy_component(component_type, argv, options) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/alet/irb/command/deploy.rb', line 56 def deploy_component(component_type, argv, ) return if argv.empty? type_alias = { 'apex' => 'ApexClass', 'trigger' => 'ApexTrigger', 'lwc' => 'LightningComponentBundle', } = argv.map do |name| = type_alias[component_type] || component_type %|"#{}:#{name}"| end sf.project.deploy_start metadata: , target_org: Alet.config.org.alias, raw_output: true, ** end |
#deploy_file(argv, manifest, options) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/alet/irb/command/deploy.rb', line 48 def deploy_file(argv, manifest, ) if manifest sf.project.deploy_start manifest: manifest, target_org: Alet.config.org.alias, raw_output: true, ** else sf.project.deploy_start source_dir: argv.first, target_org: Alet.config.org.alias, raw_output: true, ** end end |
#execute(arg) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/alet/irb/command/deploy.rb', line 9 def execute(arg) pastel = Pastel.new argv = Shellwords.shellsplit(arg) opts = OptionParser.new opts.on('-m manifest-file', '--manifest') opts.on('-d', '--dryrun') opts.on('-l test-level', '--test-level') opts.on('-t test1,test2,...', '--tests') if argv.empty? puts pastel.red(t('deploy.error.no_arguments')) return end params = {} opts.parse!(argv, into: params) component_type = argv.shift = { dry_run: params[:dryrun] || false, tests: params[:tests]&.split(','), test_level: params[:"test-level"] } puts component_type # for debug puts argv # for debug puts params # for debug puts # for debug if component_type == 'file' deploy_file(argv, params[:manifest], ) else deploy_component(component_type, argv, ) end rescue => e puts pastel.red(e.) end |