cpl 0.4.1 → 0.5.0
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/.overcommit.yml +10 -0
- data/Gemfile.lock +10 -3
- data/README.md +6 -0
- data/cpl.gemspec +1 -0
- data/docs/commands.md +51 -3
- data/googlee2da545df05d92f9.html +1 -0
- data/lib/command/base.rb +65 -7
- data/lib/command/build_image.rb +6 -5
- data/lib/command/cleanup_old_images.rb +8 -7
- data/lib/command/cleanup_stale_apps.rb +11 -9
- data/lib/command/config.rb +30 -15
- data/lib/command/copy_image_from_upstream.rb +110 -0
- data/lib/command/delete.rb +10 -12
- data/lib/command/deploy_image.rb +6 -5
- data/lib/command/env.rb +2 -2
- data/lib/command/exists.rb +4 -4
- data/lib/command/info.rb +233 -0
- data/lib/command/latest_image.rb +2 -2
- data/lib/command/logs.rb +4 -4
- data/lib/command/no_command.rb +3 -3
- data/lib/command/open.rb +4 -4
- data/lib/command/promote_app_from_upstream.rb +58 -0
- data/lib/command/ps.rb +10 -13
- data/lib/command/ps_restart.rb +9 -6
- data/lib/command/ps_start.rb +7 -6
- data/lib/command/ps_stop.rb +7 -6
- data/lib/command/run.rb +5 -5
- data/lib/command/run_detached.rb +7 -5
- data/lib/command/setup.rb +71 -13
- data/lib/command/test.rb +2 -2
- data/lib/command/version.rb +2 -2
- data/lib/core/config.rb +26 -19
- data/lib/core/controlplane.rb +77 -11
- data/lib/core/controlplane_api.rb +12 -0
- data/lib/core/controlplane_api_cli.rb +1 -1
- data/lib/core/controlplane_api_direct.rb +2 -2
- data/lib/core/shell.rb +25 -3
- data/lib/cpl/version.rb +1 -1
- data/lib/cpl.rb +19 -10
- data/lib/deprecated_commands.json +6 -0
- data/script/add_command +37 -0
- data/script/generate_commands_docs +5 -5
- data/script/rename_command +43 -0
- metadata +24 -2
| @@ -0,0 +1,43 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            # frozen_string_literal: true
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require "json"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            old_command_name = ARGV[0]&.downcase
         | 
| 7 | 
            +
            new_command_name = ARGV[1]&.downcase
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            abort("ERROR: Must provide old and new command names.") unless old_command_name && new_command_name
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            old_file_name = old_command_name.gsub(/[^A-Za-z]/, "_")
         | 
| 12 | 
            +
            old_file_path = "#{__dir__}/../lib/command/#{old_file_name}.rb"
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            abort("ERROR: Command '#{old_command_name}' does not exist.") unless File.exist?(old_file_path)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            new_file_name = new_command_name.gsub(/[^A-Za-z]/, "_")
         | 
| 17 | 
            +
            new_file_path = "#{__dir__}/../lib/command/#{new_file_name}.rb"
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            abort("ERROR: Command '#{new_command_name}' already exists.") if File.exist?(new_file_path)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            old_class_name = old_file_name.split("_").map(&:capitalize).join
         | 
| 22 | 
            +
            new_class_name = new_file_name.split("_").map(&:capitalize).join
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            file_data = File.binread(old_file_path)
         | 
| 25 | 
            +
            file_data.gsub!(old_class_name, new_class_name)
         | 
| 26 | 
            +
            file_data.gsub!(old_command_name, new_command_name)
         | 
| 27 | 
            +
            File.binwrite(new_file_path, file_data)
         | 
| 28 | 
            +
            File.delete(old_file_path)
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            # Add old command name to deprecated commands
         | 
| 31 | 
            +
            deprecated_commands_file_path = "#{__dir__}/../lib/deprecated_commands.json"
         | 
| 32 | 
            +
            old_deprecated_commands_data = File.binread(deprecated_commands_file_path)
         | 
| 33 | 
            +
            deprecated_commands = JSON.parse(old_deprecated_commands_data)
         | 
| 34 | 
            +
            deprecated_commands = deprecated_commands.to_h do |current_old_command_name, current_new_command_name|
         | 
| 35 | 
            +
              if current_new_command_name == old_command_name
         | 
| 36 | 
            +
                [current_old_command_name, new_command_name]
         | 
| 37 | 
            +
              else
         | 
| 38 | 
            +
                [current_old_command_name, current_new_command_name]
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
            end
         | 
| 41 | 
            +
            deprecated_commands[old_command_name] = new_command_name
         | 
| 42 | 
            +
            new_deprecated_commands_data = "#{JSON.pretty_generate(deprecated_commands.sort.to_h)}\n"
         | 
| 43 | 
            +
            File.binwrite(deprecated_commands_file_path, new_deprecated_commands_data)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cpl
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Justin Gordon
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire:
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2023- | 
| 12 | 
            +
            date: 2023-04-06 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: debug
         | 
| @@ -67,6 +67,20 @@ dependencies: | |
| 67 67 | 
             
                - - "~>"
         | 
| 68 68 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 69 | 
             
                    version: 1.2.1
         | 
| 70 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 71 | 
            +
              name: overcommit
         | 
| 72 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 73 | 
            +
                requirements:
         | 
| 74 | 
            +
                - - "~>"
         | 
| 75 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 76 | 
            +
                    version: 0.60.0
         | 
| 77 | 
            +
              type: :development
         | 
| 78 | 
            +
              prerelease: false
         | 
| 79 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 80 | 
            +
                requirements:
         | 
| 81 | 
            +
                - - "~>"
         | 
| 82 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 83 | 
            +
                    version: 0.60.0
         | 
| 70 84 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 71 85 | 
             
              name: rspec
         | 
| 72 86 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -149,6 +163,7 @@ files: | |
| 149 163 | 
             
            - ".github/workflows/rspec.yml"
         | 
| 150 164 | 
             
            - ".github/workflows/rubocop.yml"
         | 
| 151 165 | 
             
            - ".gitignore"
         | 
| 166 | 
            +
            - ".overcommit.yml"
         | 
| 152 167 | 
             
            - ".rspec"
         | 
| 153 168 | 
             
            - ".rubocop.yml"
         | 
| 154 169 | 
             
            - CHANGELOG.md
         | 
| @@ -167,19 +182,23 @@ files: | |
| 167 182 | 
             
            - docs/troubleshooting.md
         | 
| 168 183 | 
             
            - examples/circleci.yml
         | 
| 169 184 | 
             
            - examples/controlplane.yml
         | 
| 185 | 
            +
            - googlee2da545df05d92f9.html
         | 
| 170 186 | 
             
            - lib/command/base.rb
         | 
| 171 187 | 
             
            - lib/command/build_image.rb
         | 
| 172 188 | 
             
            - lib/command/cleanup_old_images.rb
         | 
| 173 189 | 
             
            - lib/command/cleanup_stale_apps.rb
         | 
| 174 190 | 
             
            - lib/command/config.rb
         | 
| 191 | 
            +
            - lib/command/copy_image_from_upstream.rb
         | 
| 175 192 | 
             
            - lib/command/delete.rb
         | 
| 176 193 | 
             
            - lib/command/deploy_image.rb
         | 
| 177 194 | 
             
            - lib/command/env.rb
         | 
| 178 195 | 
             
            - lib/command/exists.rb
         | 
| 196 | 
            +
            - lib/command/info.rb
         | 
| 179 197 | 
             
            - lib/command/latest_image.rb
         | 
| 180 198 | 
             
            - lib/command/logs.rb
         | 
| 181 199 | 
             
            - lib/command/no_command.rb
         | 
| 182 200 | 
             
            - lib/command/open.rb
         | 
| 201 | 
            +
            - lib/command/promote_app_from_upstream.rb
         | 
| 183 202 | 
             
            - lib/command/ps.rb
         | 
| 184 203 | 
             
            - lib/command/ps_restart.rb
         | 
| 185 204 | 
             
            - lib/command/ps_start.rb
         | 
| @@ -198,9 +217,12 @@ files: | |
| 198 217 | 
             
            - lib/core/shell.rb
         | 
| 199 218 | 
             
            - lib/cpl.rb
         | 
| 200 219 | 
             
            - lib/cpl/version.rb
         | 
| 220 | 
            +
            - lib/deprecated_commands.json
         | 
| 201 221 | 
             
            - lib/main.rb
         | 
| 202 222 | 
             
            - rakelib/create_release.rake
         | 
| 223 | 
            +
            - script/add_command
         | 
| 203 224 | 
             
            - script/generate_commands_docs
         | 
| 225 | 
            +
            - script/rename_command
         | 
| 204 226 | 
             
            - templates/gvc.yml
         | 
| 205 227 | 
             
            - templates/identity.yml
         | 
| 206 228 | 
             
            - templates/memcached.yml
         |