command_proposal 1.0.6 → 1.0.7
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 +4 -4
 - data/app/controllers/command_proposal/iterations_controller.rb +1 -1
 - data/app/helpers/command_proposal/application_helper.rb +5 -3
 - data/app/models/command_proposal/iteration.rb +1 -1
 - data/lib/command_proposal/configuration.rb +1 -0
 - data/lib/command_proposal/services/command_interpreter.rb +2 -0
 - data/lib/command_proposal/services/runner.rb +3 -2
 - data/lib/command_proposal/version.rb +1 -6
 - data/lib/generators/command_proposal/install/templates/initializer.rb +4 -0
 - metadata +6 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 31a6d83b17c11473a1b540ed85ee8d9f9eb18e7c0e19e2a5ba3d5dec32ecec48
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8c98bf481ccb61042260928daf5f2b89783b9cdb577db44ff5ce6c9ddd264579
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0c70f51608c1d81770bf4cbe084f445da6a1aac249243e8c05ebb8fca375ef21c33d9b7bb118085d60853b483480675c4ed723ed9fd5074067fd1d12d6fc990e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ec49a4f24e8384a56fb24add427e26b56df0b414fb3916830b414440f92a97a6183762696f7e995f0a12baab224c7176ac1cc0a43610b1200b3ad6db9240eb0f
         
     | 
| 
         @@ -48,7 +48,7 @@ class ::CommandProposal::IterationsController < ::CommandProposal::EngineControl 
     | 
|
| 
       48 
48 
     | 
    
         
             
                begin
         
     | 
| 
       49 
49 
     | 
    
         
             
                  alter_command if params.dig(:command_proposal_iteration, :command).present?
         
     | 
| 
       50 
50 
     | 
    
         
             
                rescue ::CommandProposal::Services::CommandInterpreter::Error => e
         
     | 
| 
       51 
     | 
    
         
            -
                  return redirect_to cmd_path(: 
     | 
| 
      
 51 
     | 
    
         
            +
                  return redirect_to cmd_path(:error, :tasks), alert: e.message
         
     | 
| 
       52 
52 
     | 
    
         
             
                end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
                sleep 0.2
         
     | 
| 
         @@ -19,13 +19,15 @@ module CommandProposal 
     | 
|
| 
       19 
19 
     | 
    
         
             
                    end
         
     | 
| 
       20 
20 
     | 
    
         
             
                  }
         
     | 
| 
       21 
21 
     | 
    
         
             
                  args << { host: host, port: nil } if host.present?
         
     | 
| 
       22 
     | 
    
         
            -
                  # args << {host: nil}
         
     | 
| 
       23 
22 
     | 
    
         | 
| 
       24 
23 
     | 
    
         
             
                  begin
         
     | 
| 
       25 
24 
     | 
    
         
             
                    engine.url_for(args.compact)
         
     | 
| 
       26 
25 
     | 
    
         
             
                  rescue NoMethodError => e
         
     | 
| 
       27 
     | 
    
         
            -
                     
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
                    if e.message.match?(/\_(url|path)\'/)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      raise e
         
     | 
| 
      
 28 
     | 
    
         
            +
                    else
         
     | 
| 
      
 29 
     | 
    
         
            +
                      raise "Error generating route! Please make sure `config.action_mailer.default_url_options` are set."
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
       29 
31 
     | 
    
         
             
                  end
         
     | 
| 
       30 
32 
     | 
    
         
             
                end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
         @@ -56,6 +56,8 @@ module CommandProposal 
     | 
|
| 
       56 
56 
     | 
    
         
             
                    check_can_command? && check_can_approve?
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         
             
                    @iteration.update(status: :approved, approver: @user, approved_at: Time.current)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    proposal = ::CommandProposal::Service::ProposalPresenter.new(@iteration)
         
     | 
| 
      
 60 
     | 
    
         
            +
                    ::CommandProposal.configuration.approval_callback&.call(proposal)
         
     | 
| 
       59 
61 
     | 
    
         
             
                  end
         
     | 
| 
       60 
62 
     | 
    
         | 
| 
       61 
63 
     | 
    
         
             
                  def command_run
         
     | 
| 
         @@ -125,7 +125,8 @@ module CommandProposal 
     | 
|
| 
       125 
125 
     | 
    
         | 
| 
       126 
126 
     | 
    
         
             
                  def results_from_exception(exc)
         
     | 
| 
       127 
127 
     | 
    
         
             
                    klass = exc.class
         
     | 
| 
       128 
     | 
    
         
            -
                     
     | 
| 
      
 128 
     | 
    
         
            +
                    # Dup to avoid frozen string errors
         
     | 
| 
      
 129 
     | 
    
         
            +
                    msg = (exc.try(:message) || exc.try(:body) || exc.to_s).dup
         
     | 
| 
       129 
130 
     | 
    
         
             
                    # Remove proposal context
         
     | 
| 
       130 
131 
     | 
    
         
             
                    msg.gsub!(/ for \#\<CommandProposal.*/, "")
         
     | 
| 
       131 
132 
     | 
    
         
             
                    msg.gsub!(/(::)?CommandProposal::Services::Runner(::)?/, "")
         
     | 
| 
         @@ -142,7 +143,7 @@ module CommandProposal 
     | 
|
| 
       142 
143 
     | 
    
         | 
| 
       143 
144 
     | 
    
         
             
                    eval_trace = backtrace.select { |row| row.include?("(eval)") }.presence || []
         
     | 
| 
       144 
145 
     | 
    
         
             
                    eval_trace = eval_trace.map do |row|
         
     | 
| 
       145 
     | 
    
         
            -
                      eval_row_number = row[/\(eval\)\:\d+/].to_s[7..-1]
         
     | 
| 
      
 146 
     | 
    
         
            +
                      eval_row_number = row[/\(eval\)\:\d+/].to_s.dup[7..-1]
         
     | 
| 
       146 
147 
     | 
    
         
             
                      next if eval_row_number.blank?
         
     | 
| 
       147 
148 
     | 
    
         | 
| 
       148 
149 
     | 
    
         
             
                      error_line = @iteration.code.split("\n")[eval_row_number.to_i - 1]
         
     | 
| 
         @@ -43,6 +43,10 @@ 
     | 
|
| 
       43 
43 
     | 
    
         
             
              config.proposal_callback = Proc.new { |proposal|
         
     | 
| 
       44 
44 
     | 
    
         
             
                # Slack.notify("#{proposal.requester} has proposed #{proposal.name}.\n<#{proposal.url}|Click Here> to view this proposal and approve.")
         
     | 
| 
       45 
45 
     | 
    
         
             
              }
         
     | 
| 
      
 46 
     | 
    
         
            +
              # Called when a command is approved
         
     | 
| 
      
 47 
     | 
    
         
            +
              config.approval_callback = Proc.new { |proposal|
         
     | 
| 
      
 48 
     | 
    
         
            +
                # Slack.notify("The task #{proposal.name} has been approved and is now ready to run.\n<#{proposal.url}|Click Here> to view.")
         
     | 
| 
      
 49 
     | 
    
         
            +
              }
         
     | 
| 
       46 
50 
     | 
    
         
             
              # Called when a command runs and completes successfully
         
     | 
| 
       47 
51 
     | 
    
         
             
              config.success_callback = Proc.new { |proposal|
         
     | 
| 
       48 
52 
     | 
    
         
             
                # Slack.notify("The task #{proposal.name} has completed in #{proposal.duration}s.\n<#{proposal.url}|Click Here> to view the results.")
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: command_proposal
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Rocco Nicholls
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-09-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -147,7 +147,7 @@ metadata: 
     | 
|
| 
       147 
147 
     | 
    
         
             
              homepage_uri: https://github.com/Rockster160/command_proposal
         
     | 
| 
       148 
148 
     | 
    
         
             
              source_code_uri: https://github.com/Rockster160/command_proposal
         
     | 
| 
       149 
149 
     | 
    
         
             
              changelog_uri: https://github.com/Rockster160/command_proposal/blob/master/README.md
         
     | 
| 
       150 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 150 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       151 
151 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       152 
152 
     | 
    
         
             
            require_paths:
         
     | 
| 
       153 
153 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -162,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       162 
162 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       163 
163 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       164 
164 
     | 
    
         
             
            requirements: []
         
     | 
| 
       165 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       166 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 165 
     | 
    
         
            +
            rubygems_version: 3.2.22
         
     | 
| 
      
 166 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       167 
167 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       168 
168 
     | 
    
         
             
            summary: Gives the ability to run approved commands through a UI in your browser
         
     | 
| 
       169 
169 
     | 
    
         
             
            test_files: []
         
     |