spree_cm_commissioner 0.0.1 → 0.0.3
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/.bundle/config +2 -0
- data/.github/workflows/test_and_build_gem.yml +31 -29
- data/.ruby-version +1 -1
- data/.vscode/settings.json +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +16 -7
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ebcb431615d0335fb711329a587b1337f3b7cb166a3905b69aa7425b5722c0af
         | 
| 4 | 
            +
              data.tar.gz: 3e8091c73ea14c67c938cc143f82637b837726049e239e14fd93ca47fbc34194
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: '081444c4677f7339071b9041968bc4f749ded9e6097986df822530f04370909046bb218318c883c1499c7c15a5912e23d4749c501dee3e23a0f9e39caab1ea48'
         | 
| 7 | 
            +
              data.tar.gz: 8583c96f326d25054504edd8b727e95ed297fabe3a5fb27088ff7e9491254c66cbd7a19069cda3151aa7a02f730abe22237759d21848bb65f4cc9195558df8d1
         | 
    
        data/.bundle/config
    CHANGED
    
    
| @@ -12,7 +12,7 @@ on: | |
| 12 12 | 
             
                tags:
         | 
| 13 13 | 
             
                  - "*"
         | 
| 14 14 | 
             
            jobs:
         | 
| 15 | 
            -
               | 
| 15 | 
            +
              test_and_build_gem:
         | 
| 16 16 | 
             
                runs-on: ubuntu-latest
         | 
| 17 17 |  | 
| 18 18 | 
             
                services:
         | 
| @@ -67,42 +67,42 @@ jobs: | |
| 67 67 | 
             
                    env:
         | 
| 68 68 | 
             
                      DATABASE_URL: postgres://myuser:mypassword@localhost:5432/test_db
         | 
| 69 69 |  | 
| 70 | 
            -
                    if:  | 
| 70 | 
            +
                    if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'develop'
         | 
| 71 71 | 
             
                    run: |
         | 
| 72 72 | 
             
                      bundle exec rake
         | 
| 73 73 |  | 
| 74 74 | 
             
                  # 2405-build-and-publish-gem
         | 
| 75 | 
            -
                  - name: Rename long migration files
         | 
| 76 | 
            -
                    env:
         | 
| 77 | 
            -
                      DATABASE_URL: postgres://myuser:mypassword@localhost:5432/test_db
         | 
| 78 | 
            -
                    # if: startsWith(github.ref, 'refs/tags/') # Only on tag pushes
         | 
| 79 | 
            -
                    if: github.ref == 'refs/heads/2405-build-and-publish-gem'
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                    run: |
         | 
| 82 | 
            -
                      cd db/migrate
         | 
| 83 | 
            -
                      for file in *.rb; do
         | 
| 84 | 
            -
                        if [ ${#file} -gt 60 ]; then  # Adjust threshold if needed
         | 
| 85 | 
            -
                          # Extract timestamp (first 14 chars) and shorten the rest
         | 
| 86 | 
            -
                          timestamp=${file:0:14}
         | 
| 87 | 
            -
                          suffix=$(echo "$file" | sed 's/^[0-9]\{14\}_//' | sed 's/\.rb$//')
         | 
| 88 | 
            -
                          short_suffix=$(echo "$suffix" | cut -c1-40) # Limit suffix to 40 chars
         | 
| 89 | 
            -
                          new_name="${timestamp}_${short_suffix}.rb"
         | 
| 90 | 
            -
                          mv "$file" "$new_name"
         | 
| 91 | 
            -
                          echo "Renamed $file to $new_name"
         | 
| 92 | 
            -
                        fi
         | 
| 93 | 
            -
                      done
         | 
| 94 | 
            -
                      echo "Renamed long migration files done"
         | 
| 95 | 
            -
                      gem build *.gemspec
         | 
| 96 | 
            -
             | 
| 97 | 
            -
                  # # Build the gem
         | 
| 98 | 
            -
                  # - name: Build gem
         | 
| 75 | 
            +
                  # - name: Rename long migration files
         | 
| 99 76 | 
             
                  #   env:
         | 
| 100 77 | 
             
                  #     DATABASE_URL: postgres://myuser:mypassword@localhost:5432/test_db
         | 
| 101 | 
            -
             | 
| 102 78 | 
             
                  #   # if: startsWith(github.ref, 'refs/tags/') # Only on tag pushes
         | 
| 103 79 | 
             
                  #   if: github.ref == 'refs/heads/2405-build-and-publish-gem'
         | 
| 80 | 
            +
             | 
| 104 81 | 
             
                  #   run: |
         | 
| 105 | 
            -
                  #      | 
| 82 | 
            +
                  #     cd db/migrate
         | 
| 83 | 
            +
                  #     for file in *.rb; do
         | 
| 84 | 
            +
                  #       if [ ${#file} -gt 60 ]; then  # Adjust threshold if needed
         | 
| 85 | 
            +
                  #         # Extract timestamp (first 14 chars) and shorten the rest
         | 
| 86 | 
            +
                  #         timestamp=${file:0:14}
         | 
| 87 | 
            +
                  #         suffix=$(echo "$file" | sed 's/^[0-9]\{14\}_//' | sed 's/\.rb$//')
         | 
| 88 | 
            +
                  #         short_suffix=$(echo "$suffix" | cut -c1-40) # Limit suffix to 40 chars
         | 
| 89 | 
            +
                  #         new_name="${timestamp}_${short_suffix}.rb"
         | 
| 90 | 
            +
                  #         mv "$file" "$new_name"
         | 
| 91 | 
            +
                  #         echo "Renamed $file to $new_name"
         | 
| 92 | 
            +
                  #       fi
         | 
| 93 | 
            +
                  #     done
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  # Build the gem
         | 
| 96 | 
            +
                  - name: Build gem
         | 
| 97 | 
            +
                    env:
         | 
| 98 | 
            +
                      DATABASE_URL: postgres://myuser:mypassword@localhost:5432/test_db
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                    # if: startsWith(github.ref, 'refs/tags/') # Only on tag pushes
         | 
| 101 | 
            +
                    if: |
         | 
| 102 | 
            +
                      startsWith(github.ref, 'refs/tags/') ||
         | 
| 103 | 
            +
                      (github.event_name == 'push' && github.ref == 'refs/heads/2405-build-and-publish-gem')
         | 
| 104 | 
            +
                    run: |
         | 
| 105 | 
            +
                      gem build *.gemspec
         | 
| 106 106 |  | 
| 107 107 | 
             
                  # Publish the gem
         | 
| 108 108 | 
             
                  - name: Publish gem
         | 
| @@ -110,7 +110,9 @@ jobs: | |
| 110 110 | 
             
                      DATABASE_URL: postgres://myuser:mypassword@localhost:5432/test_db
         | 
| 111 111 |  | 
| 112 112 | 
             
                    # if: startsWith(github.ref, 'refs/tags/') # Only on tag pushes
         | 
| 113 | 
            -
                    if:  | 
| 113 | 
            +
                    if: |
         | 
| 114 | 
            +
                      startsWith(github.ref, 'refs/tags/') ||
         | 
| 115 | 
            +
                      (github.event_name == 'push' && github.ref == 'refs/heads/2405-build-and-publish-gem')
         | 
| 114 116 | 
             
                    run: |
         | 
| 115 117 | 
             
                      mkdir -p ~/.gem
         | 
| 116 118 | 
             
                      echo ":rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials
         | 
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            3.2. | 
| 1 | 
            +
            3.2.0
         | 
    
        data/.vscode/settings.json
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -28,6 +28,10 @@ bundle exec rails g spree_cm_commissioner:install | |
| 28 28 |  | 
| 29 29 | 
             
            If your server was running, restart it so that it can find the assets properly.
         | 
| 30 30 |  | 
| 31 | 
            +
            ## Bump a new version
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            Update the semantic version number in `lib/spree_cm_commissioner/version.rb`, then create and push a new tag to GitHub. When the tag is pushed, the GitHub Actions workflow will automatically build the gem and publish it to RubyGems.
         | 
| 34 | 
            +
             | 
| 31 35 | 
             
            ## Config
         | 
| 32 36 |  | 
| 33 37 | 
             
            ### Rake tasks
         | 
| @@ -200,19 +204,25 @@ bundle exec gem release | |
| 200 204 | 
             
            For more options please see [gem-release REAMDE](https://github.com/svenfuchs/gem-release)
         | 
| 201 205 |  | 
| 202 206 | 
             
            ## Troubleshooting Database Lock on Taxonomy Creation Errors
         | 
| 207 | 
            +
             | 
| 203 208 | 
             
            ### Issue Overview
         | 
| 209 | 
            +
             | 
| 204 210 | 
             
            In development, this error can occur after creating a new database and restoring the database (e.g., from a staging environment). When this happens, attempts to create a new Taxonomy may fail due to a record lock.
         | 
| 205 211 |  | 
| 206 212 | 
             
            ### Error Message
         | 
| 213 | 
            +
             | 
| 207 214 | 
             
            In case you create in console manualy
         | 
| 208 | 
            -
             | 
| 215 | 
            +
             | 
| 216 | 
            +
            ```sh
         | 
| 209 217 | 
             
            /usr/local/bundle/gems/activerecord-7.0.8/lib/active_record/locking/pessimistic.rb:70:in `lock!': Locking a record with unpersisted changes is not supported. Use `save` to persist the changes, or `reload` to discard them explicitly. (RuntimeError)
         | 
| 210 218 | 
             
            ```
         | 
| 219 | 
            +
             | 
| 211 220 | 
             
            In case you create from web-app
         | 
| 212 | 
            -
            ```
         | 
| 213 | 
            -
            Locking a record with unpersisted changes is not supported. Use save to persist the changes, or reload to discard them explicitly.
         | 
| 214 221 |  | 
| 215 | 
            -
             | 
| 222 | 
            +
            ```sh
         | 
| 223 | 
            +
            # Locking a record with unpersisted changes is not supported. Use save to persist the changes, or reload to discard them explicitly.
         | 
| 224 | 
            +
             | 
| 225 | 
            +
            # Extracted source (around line #70):
         | 
| 216 226 |  | 
| 217 227 | 
             
            if persisted?
         | 
| 218 228 | 
             
              if has_changes_to_save?
         | 
| @@ -223,13 +233,13 @@ if persisted? | |
| 223 233 | 
             
            ```
         | 
| 224 234 |  | 
| 225 235 | 
             
            ### Workaround Solution
         | 
| 226 | 
            -
             | 
| 236 | 
            +
             | 
| 237 | 
            +
            1. Open the Rails console: `rails console`
         | 
| 227 238 | 
             
            2. Find an existing Taxonomy record: `taxonomy = Spree::Taxonomy.last`
         | 
| 228 239 | 
             
            3. Update any attribute to release the lock. For example: `taxonomy.update(name: "#{taxonomy.name}1")`
         | 
| 229 240 |  | 
| 230 241 | 
             
            This action should unlock the record, allowing you to successfully create a new Taxonomy.
         | 
| 231 242 |  | 
| 232 | 
            -
             | 
| 233 243 | 
             
            ## Contributing
         | 
| 234 244 |  | 
| 235 245 | 
             
            If you'd like to contribute, please take a look at the
         | 
| @@ -428,4 +438,3 @@ def wrap_with_multitenant_without(&block) | |
| 428 438 | 
             
              MultiTenant.without(&block)
         | 
| 429 439 | 
             
            end
         | 
| 430 440 | 
             
            ```
         | 
| 431 | 
            -
             | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: spree_cm_commissioner
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - You
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2025-03- | 
| 11 | 
            +
            date: 2025-03-04 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: spree
         | 
| @@ -2367,7 +2367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 2367 2367 | 
             
                  version: '0'
         | 
| 2368 2368 | 
             
            requirements:
         | 
| 2369 2369 | 
             
            - none
         | 
| 2370 | 
            -
            rubygems_version: 3.4. | 
| 2370 | 
            +
            rubygems_version: 3.4.1
         | 
| 2371 2371 | 
             
            signing_key:
         | 
| 2372 2372 | 
             
            specification_version: 4
         | 
| 2373 2373 | 
             
            summary: Add extension summary here
         |