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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '05948ecaeb302fe7fac8223a0c9236c506c6f42b5f61f70ae599a337de1f1a82'
4
- data.tar.gz: 332cdebeb6df4e8b3ed5d36078b1b9ec327b82c0dd2d6336f22509ed3a9d8226
3
+ metadata.gz: 19d755f53f960c0a8f9a829de39ea34bffe813a34c87b8fc7ccb28061056e6e3
4
+ data.tar.gz: 4e530e0b67585fffd753ba8f0619f000dc28d8cc2b116117292f1065f5d80bed
5
5
  SHA512:
6
- metadata.gz: f1b9926571e1a245bedaa1f5af9dbe40e07d41c05daf2128cb775e7e4cf0a5f97899252a877937c8fb683d1c4e29fa2f4f183966ddfcc461b370c30df1314f5f
7
- data.tar.gz: 1ef3ed00db4fa1ac0d59c79b42983684939b212f8d2a6a4777d179293193505f46d41833165b41c400e03444e3d6c33da53daaf5857ccf2f1718ad31b37f817d
6
+ metadata.gz: f37c89a25a0a153cdd212d8718cbb001d66bdc48ce33b408b49ce99648b4bda2d383a0e2b7851c95aecc74f4320cbd96b53276313aaa636d42c1de15600a2a06
7
+ data.tar.gz: 962a62b8690573d77c7634f285cfa61e35b96d82d1231027acc15574bf5151a5f97fb704beb71392e6291dbf3bedc5cf736092f20f3ca550ecc36db790d3bbab
@@ -1,3 +1,3 @@
1
1
  module AtkToolbox
2
- VERSION = '0.0.36'
2
+ VERSION = '0.0.37'
3
3
  end
@@ -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
- name: The ATK Repo
5
- description: Blah
6
- homepage: www.blah.com
4
+ name: The ATK Repo
5
+ description: Blah
6
+ homepage: www.blah.com
7
7
 
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
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
- basic_setup: &basic_setup_reference
18
- (project_commands): &basic_commands
17
+ basic_setup: &basic_setup_reference
18
+ (project_commands): &basic_commands
19
19
  # auto-insert the !lang/console if they dont put one
20
- run: !language/ruby puts "hi"
21
- stop: \`pkill node`
22
- compile: gcc *.cpp
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
- [*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
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
- (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
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
- when(--os is 'mac'):
44
- (dependencies):
45
- <<: *base_dependencies
46
- python2: v2.7
43
+ when(--os is 'mac'):
44
+ (dependencies):
45
+ <<: *base_dependencies
46
+ python2: v2.7
47
47
 
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'):
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
- when(--os is 'arch'):
55
- (project_commands):
56
- <<: *basic_commands
54
+ when(--os is 'arch'):
55
+ (project_commands):
56
+ <<: *basic_commands
57
57
  # this injects all the (project_commands) here
58
- my_ip_address: ip # this is a custom command specific to arch linux
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
@@ -2,4 +2,4 @@ require_relative '../lib/atk_toolbox'
2
2
 
3
3
  Dir.chdir __dir__
4
4
 
5
- Info.set_key(["test"], "it worked?")
5
+ Info.set_key(["test"], { "thing" => [1,2,3] })
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atk_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Hykin