qb 0.1.48 → 0.1.49

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
  SHA1:
3
- metadata.gz: 0eb9c603416537655809bf3a2147a55cd35e1833
4
- data.tar.gz: f6c6ae61026428b672ee0dd61a01dddfddd492bc
3
+ metadata.gz: ed96cc13dcc121fa80f3b32515c33e3e2f93cef3
4
+ data.tar.gz: a96f9605215fea222673ca113e22d4922c98447b
5
5
  SHA512:
6
- metadata.gz: 65c50309bd1d3501a14228cced913d84351d8192df54b13f777d9e99c50fbabefd757d384c6bfdecfbe8b9725f60fc48b0d85a44660af08851a459cdd60a9b24
7
- data.tar.gz: c719eb898d4fc602559396028dcd7fb6b98534b96645d718ccad76d40cbcd388dc11ddff24669ac385778c8db164f53b15be3f2f71a828c679eb1b5d54927cff
6
+ metadata.gz: 20159e67d810fb30d67c1280cfb7c4a2eca725257929b533953d029131f9aa8f1788247e7bba35cf2a2ba6498c24544209cb2a220c10210f7fb02c1caea3eed4
7
+ data.tar.gz: 9f06c0a965378d78b27e80a55e775e1300de7c4cbba704f27c158311355db0fe7b64211f22091ebaf6f4068e35a44bf833a02ada7a381f66b7ba3ab4f77bab37
@@ -1,7 +1,7 @@
1
1
  module QB
2
2
  GEM_NAME = 'qb'
3
3
 
4
- VERSION = "0.1.48"
4
+ VERSION = "0.1.49"
5
5
 
6
6
  def self.gemspec
7
7
  Gem.loaded_specs[GEM_NAME]
@@ -3,6 +3,7 @@ __metaclass__ = type
3
3
 
4
4
  import subprocess
5
5
  import os
6
+ import json
6
7
 
7
8
  from ansible.errors import AnsibleError
8
9
 
@@ -47,12 +48,29 @@ def semver_inc(version, level = None, preid = None):
47
48
  return out.rstrip()
48
49
 
49
50
 
51
+ def semver_parse(version):
52
+ '''parse semver.
53
+ '''
54
+
55
+ stmt = (
56
+ '''console.log(JSON.stringify(require('semver')(%s), null, 2))''' %
57
+ json.dumps(version)
58
+ )
59
+
60
+ cmd = ['node', '--eval', stmt]
61
+
62
+ out = subprocess.check_output(cmd)
63
+
64
+ return out.rstrip()
65
+
66
+
50
67
  class FilterModule(object):
51
68
  ''' version manipulation filters '''
52
69
 
53
70
  def filters(self):
54
71
  return {
55
72
  'semver_inc': semver_inc,
73
+ 'semver_parse': semver_parse,
56
74
  }
57
75
 
58
76
 
@@ -6,3 +6,7 @@ dependencies:
6
6
  gitignore_name: Global/OSX
7
7
  gitignore_dest: "{{ git_repo_dest }}"
8
8
  when: ansible_distribution == "MacOSX"
9
+
10
+ - role: qb.gitignore
11
+ gitignore_name: Qb
12
+ gitignore_dest: "{{ git_repo_dest }}"
@@ -0,0 +1,5 @@
1
+ ---
2
+ # defaults file for qb.package_json_info
3
+ package_json_info_dir: "{{ qb_dir }}"
4
+ package_json_info_var: null
5
+ package_json_info_debug: "{{ ansible_env.QB_DEBUG is defined }}"
@@ -0,0 +1,9 @@
1
+ ---
2
+ # meta file for qb.package_json_info
3
+
4
+ allow_duplicates: yes
5
+
6
+ dependencies: # []
7
+ - role: qb.read_json
8
+ read_json_src: "{{ package_json_info_dir }}/package.json"
9
+ read_json_dump: "{{ package_json_info_dump }}"
@@ -0,0 +1,60 @@
1
+ ---
2
+ # meta/qb.yml file for qb.package_json_info
3
+ #
4
+ # qb settings for this role. see README.md for more info.
5
+ #
6
+
7
+ # description of the role to show in it's help output.
8
+ description: load package.json into a variable.
9
+
10
+ # prefix for role variables
11
+ var_prefix: null
12
+
13
+ # how to get a default for `dir` if it's not provided as the only
14
+ # positional argument. if a positional argument is provided it will
15
+ # override the method defined here.
16
+ #
17
+ # options:
18
+ #
19
+ # - null
20
+ # - require the value on the command line.
21
+ # - false
22
+ # - don't provide qb_dir (means doesn't load or save options either).
23
+ # - git_root
24
+ # - use the git root fof the directory that the `qb` command is invoked
25
+ # from. useful for 'project-centric' commands so they can be invoked
26
+ # from anywhere in the repo.
27
+ # - cwd
28
+ # - use the directory the `qb` command is invoked form.
29
+ # - {exe: PATH}
30
+ # - invoke an execuable, passing a JSON serialization of the options
31
+ # mapping their CLI names to values. path can be relative to role
32
+ # directory.
33
+ # - {find_up: FILENAME}
34
+ # - starting at the current direcotry and climbing up to parent
35
+ # directories, use the first one that contains FILENAME. error
36
+ # if none is found.
37
+ default_dir: null
38
+
39
+ # default user to become for play
40
+ default_user: null
41
+
42
+ # set to false to not save options in .qb-options.yml files
43
+ save_options: false
44
+
45
+ options: # []
46
+ # - name: example
47
+ # description: an example of a variable.
48
+ # required: false
49
+ # type: boolean # boolean (default) | string
50
+ # short: e
51
+ - name: dir
52
+ description: direcotry containing package.json
53
+ type: string
54
+ short: p
55
+
56
+ - name: dump
57
+ description: dump value via debug task.
58
+ type: boolean
59
+ short: d
60
+
@@ -0,0 +1,18 @@
1
+ ---
2
+ # tasks file for qb.package_json_info
3
+
4
+ - name: parse version value
5
+ set_fact:
6
+ package_json_info_value:
7
+ value: "{{ read_json_value }}"
8
+ version: "{{ read_json_value.version | semver_parse }}"
9
+
10
+ - name: set var
11
+ when: package_json_info_var != None
12
+ set_fact:
13
+ "{{ package_json_info_var }}": "{{ package_json_info_value }}"
14
+
15
+ - name: dump debug output
16
+ when: package_json_info_dump
17
+ debug:
18
+ msg: "{{ package_json_info_value }}"
@@ -0,0 +1,5 @@
1
+ ---
2
+ # defaults file for qb.read_json
3
+ read_json_src: "{{ qb_dir }}"
4
+ read_json_var: null
5
+ read_json_dump: "{{ ansible_env.QB_DEBUG is defined }}"
@@ -0,0 +1,6 @@
1
+ ---
2
+ # meta file for qb.read_json
3
+
4
+ allow_duplicates: yes
5
+
6
+ dependencies: []
@@ -0,0 +1,70 @@
1
+ ---
2
+ # meta/qb.yml file for qb.read_json
3
+ #
4
+ # qb settings for this role. see README.md for more info.
5
+ #
6
+
7
+ # description of the role to show in it's help output.
8
+ description: >
9
+ read a json file into a variable. yeah. 'cause you need to do it as a role
10
+ sometimes.
11
+
12
+ # prefix for role variables
13
+ var_prefix: null
14
+
15
+ # how to get a default for `dir` if it's not provided as the only
16
+ # positional argument. if a positional argument is provided it will
17
+ # override the method defined here.
18
+ #
19
+ # options:
20
+ #
21
+ # - null
22
+ # - require the value on the command line.
23
+ # - false
24
+ # - don't provide qb_dir (means doesn't load or save options either).
25
+ # - git_root
26
+ # - use the git root fof the directory that the `qb` command is invoked
27
+ # from. useful for 'project-centric' commands so they can be invoked
28
+ # from anywhere in the repo.
29
+ # - cwd
30
+ # - use the directory the `qb` command is invoked form.
31
+ # - {exe: PATH}
32
+ # - invoke an execuable, passing a JSON serialization of the options
33
+ # mapping their CLI names to values. path can be relative to role
34
+ # directory.
35
+ # - {find_up: FILENAME}
36
+ # - starting at the current direcotry and climbing up to parent
37
+ # directories, use the first one that contains FILENAME. error
38
+ # if none is found.
39
+ default_dir: false
40
+
41
+ # default user to become for play
42
+ default_user: null
43
+
44
+ # set to false to not save options in .qb-options.yml files
45
+ save_options: false
46
+
47
+ options: # []
48
+ # - name: example
49
+ # description: an example of a variable.
50
+ # required: false
51
+ # type: boolean # boolean (default) | string
52
+ # short: e
53
+ - name: src
54
+ description: path to source file.
55
+ required: true
56
+ type: string
57
+ short: s
58
+
59
+ - name: var
60
+ description: variable name to write value into.
61
+ required: false
62
+ type: string
63
+ short: v
64
+
65
+ - name: dump
66
+ description: dump the value via debug task.
67
+ required: false
68
+ type: boolean
69
+ short: d
70
+
@@ -0,0 +1,23 @@
1
+ ---
2
+ # tasks file for qb.read_json
3
+ - name: read file
4
+ slurp:
5
+ src: "{{ read_json_src }}"
6
+ register: read_json_slurp
7
+
8
+ - name: parse json
9
+ set_fact:
10
+ read_json_value: "{{ read_json_slurp.content | b64decode }}"
11
+
12
+ - name: set var
13
+ when: read_json_var != None
14
+ set_fact:
15
+ "{{ read_json_var }}": "{{ read_json_value }}"
16
+
17
+ - name: print debug output
18
+ when: read_json_dump
19
+ debug:
20
+ msg:
21
+ name: "{{ read_json_var }}"
22
+ value: "{{ read_json_value }}"
23
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.48
4
+ version: 0.1.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-11 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -530,6 +530,10 @@ files:
530
530
  - roles/qb.npm_package/meta/main.yml
531
531
  - roles/qb.npm_package/meta/qb.yml
532
532
  - roles/qb.npm_package/tasks/main.yml
533
+ - roles/qb.package_json_info/defaults/main.yml
534
+ - roles/qb.package_json_info/meta/main.yml
535
+ - roles/qb.package_json_info/meta/qb.yml
536
+ - roles/qb.package_json_info/tasks/main.yml
533
537
  - roles/qb.project/.qb-options.yml
534
538
  - roles/qb.project/defaults/main.yml
535
539
  - roles/qb.project/files/ansible.cfg
@@ -553,6 +557,10 @@ files:
553
557
  - roles/qb.qb_role/templates/.gitkeep
554
558
  - roles/qb.qb_role/templates/module.rb.j2
555
559
  - roles/qb.qb_role/templates/qb.yml.j2
560
+ - roles/qb.read_json/defaults/main.yml
561
+ - roles/qb.read_json/meta/main.yml
562
+ - roles/qb.read_json/meta/qb.yml
563
+ - roles/qb.read_json/tasks/main.yml
556
564
  - roles/qb.release_gem/defaults/main.yml
557
565
  - roles/qb.release_gem/meta/main.yml
558
566
  - roles/qb.release_gem/meta/qb.yml