atk_toolbox 0.0.36 → 0.0.37
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/lib/atk_toolbox/version.rb +1 -1
- data/lib/yaml_edit/set_key.py +8 -1
- data/test/info.yaml +51 -45
- data/test/main.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 19d755f53f960c0a8f9a829de39ea34bffe813a34c87b8fc7ccb28061056e6e3
         | 
| 4 | 
            +
              data.tar.gz: 4e530e0b67585fffd753ba8f0619f000dc28d8cc2b116117292f1065f5d80bed
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f37c89a25a0a153cdd212d8718cbb001d66bdc48ce33b408b49ce99648b4bda2d383a0e2b7851c95aecc74f4320cbd96b53276313aaa636d42c1de15600a2a06
         | 
| 7 | 
            +
              data.tar.gz: 962a62b8690573d77c7634f285cfa61e35b96d82d1231027acc15574bf5151a5f97fb704beb71392e6291dbf3bedc5cf736092f20f3ca550ecc36db790d3bbab
         | 
    
        data/lib/atk_toolbox/version.rb
    CHANGED
    
    
    
        data/lib/yaml_edit/set_key.py
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            import ruamel.yaml
         | 
| 2 | 
            +
            import regex as re
         | 
| 2 3 | 
             
            import json
         | 
| 3 4 | 
             
            import sys
         | 
| 4 5 |  | 
| @@ -18,6 +19,12 @@ def set_by_path(data, path, value): | |
| 18 19 | 
             
                """Set a value in a nested object in data by item sequence."""
         | 
| 19 20 | 
             
                get_by_path(data, path[:-1])[path[-1]] = value
         | 
| 20 21 |  | 
| 22 | 
            +
            # detect the indent
         | 
| 23 | 
            +
            indent_match = re.search(r'^ +', yaml_string, flags=re.MULTILINE)
         | 
| 24 | 
            +
            if indent_match == None:
         | 
| 25 | 
            +
                indent = 4
         | 
| 26 | 
            +
            else:
         | 
| 27 | 
            +
                indent = len(indent_match[0])
         | 
| 21 28 |  | 
| 22 29 | 
             
            # parse the yaml
         | 
| 23 30 | 
             
            data = ruamel.yaml.round_trip_load(yaml_string)
         | 
| @@ -28,4 +35,4 @@ new_value = json.loads(new_key_value) | |
| 28 35 | 
             
            # set the value
         | 
| 29 36 | 
             
            set_by_path(data, path_to_element, new_value)
         | 
| 30 37 | 
             
            # output the data
         | 
| 31 | 
            -
            print(ruamel.yaml.round_trip_dump(data))
         | 
| 38 | 
            +
            print(ruamel.yaml.round_trip_dump(data, indent=indent, block_seq_indent=indent))
         | 
    
        data/test/info.yaml
    CHANGED
    
    | @@ -1,61 +1,61 @@ | |
| 1 1 | 
             
            # Example of Project settings
         | 
| 2 2 | 
             
            (using_atk_version): 1.0
         | 
| 3 3 | 
             
            (project):
         | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 4 | 
            +
                name: The ATK Repo
         | 
| 5 | 
            +
                description: Blah
         | 
| 6 | 
            +
                homepage: www.blah.com
         | 
| 7 7 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 8 | 
            +
                auto_generated_commands: &auto_generated_commands !evaluate/ruby |
         | 
| 9 | 
            +
                    commands = {}
         | 
| 10 | 
            +
                    # check for a scripts directory
         | 
| 11 | 
            +
                    script_file_paths = Dir["scripts/*"]
         | 
| 12 | 
            +
                    for each in script_file_paths
         | 
| 13 | 
            +
                        commands[File.basename(each, ".*")] = "./#{each}"
         | 
| 14 | 
            +
                    end
         | 
| 15 | 
            +
                    commands
         | 
| 16 16 |  | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 17 | 
            +
                basic_setup: &basic_setup_reference
         | 
| 18 | 
            +
                    (project_commands): &basic_commands
         | 
| 19 19 | 
             
                        # auto-insert the !lang/console if they dont put one
         | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 20 | 
            +
                        run: !language/ruby puts "hi"
         | 
| 21 | 
            +
                        stop: \`pkill node`
         | 
| 22 | 
            +
                        compile: gcc *.cpp
         | 
| 23 23 | 
             
                        # TODO: add inline support for doing things like auto-generating commands
         | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 24 | 
            +
                        [*auto_generated_commands]:
         | 
| 25 | 
            +
                    (environment_variables):
         | 
| 26 | 
            +
                        JAVA_VERSION: '8.9'
         | 
| 27 | 
            +
                    (structures):
         | 
| 28 | 
            +
                        npm-package: v1.0.0
         | 
| 29 | 
            +
                        vs-code-package: v1.0.0
         | 
| 30 | 
            +
                        git-repo: v1.0.0
         | 
| 31 | 
            +
                    (dependencies): &base_dependencies
         | 
| 32 | 
            +
                        python3: v3.7.0
         | 
| 33 | 
            +
                        node: v11.11.0
         | 
| 34 | 
            +
                        npm: v6.7.0
         | 
| 35 | 
            +
                        git: v2.21.0
         | 
| 36 36 |  | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 37 | 
            +
                (advanced_setup):
         | 
| 38 | 
            +
                    (local_package_managers): [npm, pip]     # by default the local package managers are always here
         | 
| 39 | 
            +
                    (put_new_dependencies_under): [(project), basic_info, (dependencies)]
         | 
| 40 | 
            +
                    <<: *basic_setup_reference
         | 
| 41 41 | 
             
                                               # this injects all the (basic_setup) here
         | 
| 42 42 | 
             
                    # caveats for a specific OS
         | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 43 | 
            +
                    when(--os is 'mac'):
         | 
| 44 | 
            +
                        (dependencies):
         | 
| 45 | 
            +
                            <<: *base_dependencies
         | 
| 46 | 
            +
                            python2: v2.7
         | 
| 47 47 |  | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 48 | 
            +
                    when(--os is 'windows'):
         | 
| 49 | 
            +
                        (project_commands):
         | 
| 50 | 
            +
                            <<: *basic_commands
         | 
| 51 | 
            +
                            show_files: dir # this is a custom command specific to windows
         | 
| 52 | 
            +
                    when(--os is 'linux'):
         | 
| 53 53 | 
             
                        # caveats for a specific OS sub-version
         | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 54 | 
            +
                        when(--os is 'arch'):
         | 
| 55 | 
            +
                            (project_commands):
         | 
| 56 | 
            +
                                <<: *basic_commands
         | 
| 57 57 | 
             
                                                    # this injects all the (project_commands) here
         | 
| 58 | 
            -
             | 
| 58 | 
            +
                                my_ip_address: ip   # this is a custom command specific to arch linux
         | 
| 59 59 | 
             
                    # # caveats for a different context
         | 
| 60 60 | 
             
                    # when(--context is 'testing'):
         | 
| 61 61 | 
             
                    #     (environment_variables):
         | 
| @@ -65,3 +65,9 @@ | |
| 65 65 | 
             
                    #     when(--os is 'windows'):
         | 
| 66 66 | 
             
                    #         (environment_variables):
         | 
| 67 67 | 
             
                    #             CMAKE_LIB: "C:\\testing"
         | 
| 68 | 
            +
            test:
         | 
| 69 | 
            +
                thing:
         | 
| 70 | 
            +
                    - 1
         | 
| 71 | 
            +
                    - 2
         | 
| 72 | 
            +
                    - 3
         | 
| 73 | 
            +
             | 
    
        data/test/main.rb
    CHANGED