qb 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80033c6e7eace5353695c0cf1239a972bff0c76f
4
- data.tar.gz: 15a2d8f53620eba3538be272165fdda0eb11f51f
3
+ metadata.gz: 352d78a052f07a71c9e99e5cbfdc58024d720fce
4
+ data.tar.gz: 68a8aef9f041c5670c580a962d3961f9147d106b
5
5
  SHA512:
6
- metadata.gz: 0d317ec3cade70ada821b6952efdf28aca34a8a6ce5b8da308e50270509717326422b7c19a3d4625aeb3ce6037cb095a4429b6ea390aaff36ebd27bf984b7391
7
- data.tar.gz: 306fdab6c084efa4351eafdc4541f3f0e0b9e1983ce7153f8f471218aa4fb827abcbd150e3b4e0dd95b1b5fb6523e63ea60f5c19f2ee52e49b348a529a30bbd9
6
+ metadata.gz: 7813746292a10f1a1d710379a4c7e524b92b295b6c8ce5d84d4c777a8f6e0a7f32838b2eb68691172314f4e8ad596f9ce4061e7fbc7833ceb990a047e4d6ddb1
7
+ data.tar.gz: 053bda3ec3198f7dd15d7b237560f0adf085568b7e6925f2e65ebe8670d981fcf7e4cde14d9683d84a2b5c352248ebd54cb4e512e0f418c4dfb23d06ae3acc15
@@ -1,3 +1,3 @@
1
1
  module QB
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -3,4 +3,6 @@
3
3
  component_data: false
4
4
  component_root: div
5
5
  component_blaze: false
6
- component_force: false
6
+ component_force: false
7
+ component_index_import: true
8
+ component_default: false
@@ -20,12 +20,18 @@ vars:
20
20
  # required: false
21
21
  # type: boolean # boolean (default) | string
22
22
  # short: e
23
- - name: path
24
- description: "symbolic path to the view component (ex: 'posts/tiles')"
23
+ - name: dir
24
+ description: directory under imports/ui that the component goes in
25
25
  required: true
26
26
  type: string
27
27
  short: p
28
28
 
29
+ - name: class
30
+ description: component class name
31
+ required: true
32
+ type: string
33
+ short: c
34
+
29
35
  - name: data
30
36
  description: add ReactDataMixin
31
37
  required: false
@@ -48,4 +54,15 @@ vars:
48
54
  description: overwrite existing file
49
55
  required: false
50
56
  type: boolean
51
- short: f
57
+ short: f
58
+
59
+ - name: index_import
60
+ description: create an export * line for this component in imports/ui/index.js
61
+ required: false
62
+ type: boolean
63
+
64
+ - name: default
65
+ description: if true exports the component as the default from the module
66
+ required: false
67
+ type: boolean
68
+
@@ -1,41 +1,44 @@
1
1
  ---
2
- # tasks file for qb.meteor_react_component
3
- - component_facts:
4
- path: "{{ component_path }}"
2
+ - name: set logger name
3
+ set_fact:
4
+ component_logger_name: "imports:ui:{{ component_dir | regex_replace('/', ':')}}:{{ component_class }}"
5
+ component_path: "{{ qb_dir }}/imports/ui/{{ component_dir }}/{{ component_class }}.jsx"
6
+ component_style_path: "{{ qb_dir }}/client/styles/{{ component_dir }}/{{ component_class }}.import.less"
5
7
 
6
8
  - name: create component directory
7
9
  file:
8
- path: "{{ qb_dir }}/imports/ui/{{ component_dir }}"
10
+ path: "{{ component_path | dirname }}"
9
11
  state: directory
10
12
  recurse: true
11
13
 
12
- - name: "create {{ component_class_name }} component"
14
+ - name: "create {{ component_class }} component"
13
15
  template:
14
16
  src: component.jsx.j2
15
- dest: "{{ qb_dir }}/imports/ui/{{ component_dir }}/{{ component_dashed }}.jsx"
17
+ dest: "{{ component_path }}"
16
18
  force: "{{ component_force }}"
17
19
 
18
20
  - name: add import line to imports/ui/index.js
19
21
  lineinfile:
20
22
  dest: "{{ qb_dir }}/imports/ui/index.js"
21
- line: "export * from './{{ component_dir }}/{{ component_dashed }}.jsx';"
22
- when: component_blaze
23
+ line: "export * from './{{ component_dir }}/{{ component_class }}.jsx';"
24
+ create: true
25
+ when: component_index_import
23
26
 
24
27
  - name: create styles directory
25
28
  file:
26
- path: "{{ qb_dir }}/client/styles/{{ component_dir }}"
29
+ path: "{{ component_style_path | dirname }}"
27
30
  state: directory
28
31
  recurse: true
29
32
 
30
33
  - name: create a stylesheet for it
31
34
  template:
32
35
  src: style.import.less.j2
33
- dest: "{{ qb_dir }}/client/styles/{{ component_dir }}/{{ component_dashed }}.import.less"
36
+ dest: "{{ component_style_path }}"
34
37
  force: "{{ component_force }}"
35
38
 
36
39
  - name: add import line to client/styles/index.less
37
40
  lineinfile:
38
41
  dest: "{{ qb_dir }}/client/styles/index.less"
39
- line: '@import "{{ component_dir }}/{{ component_dashed }}.import.less";'
42
+ line: '@import "{{ component_dir }}/{{ component_class }}.import.less";'
40
43
  create: true
41
44
 
@@ -20,7 +20,7 @@ import * as Util from '/imports/util';
20
20
 
21
21
  const log = Util.logger('{{ component_logger_name }}');
22
22
 
23
- export default class {{ component_class_name }} extends Component {
23
+ export {% if component_default %}default{% endif %} class {{ component_class }} extends Component {
24
24
  constructor() {
25
25
  super();
26
26
  } // constructor()
@@ -47,7 +47,7 @@ export default class {{ component_class_name }} extends Component {
47
47
 
48
48
  render() {
49
49
  return (
50
- <{{ component_root }} className="{{ component_class_name }}">
50
+ <{{ component_root }} className="{{ component_class }}">
51
51
  { this.renderContent() }
52
52
  </{{ component_root }}>
53
53
  );
@@ -56,20 +56,20 @@ export default class {{ component_class_name }} extends Component {
56
56
  // hook methods
57
57
  // ===========
58
58
 
59
- } // {{ component_class_name }}
59
+ } // {{ component_class }}
60
60
 
61
- {{ component_class_name }}.propTypes = {
61
+ {{ component_class }}.propTypes = {
62
62
 
63
63
  } // propTypes
64
64
 
65
65
  {% if component_data -%}
66
66
  // mixin that calls `component.getMeteorData()`
67
- reactMixin({{ component_class_name }}.prototype, ReactDataMixin);
67
+ reactMixin({{ component_class}}.prototype, ReactDataMixin);
68
68
  {% endif %}
69
69
 
70
70
  {% if component_blaze -%}
71
71
  // register component globally to be used by Blaze
72
- Template.registerHelper('{{ component_class_name }}', () => {
73
- return {{ component_class_name }};
72
+ Template.registerHelper('{{ component_class}}', () => {
73
+ return {{ component_class }};
74
74
  });
75
75
  {% endif %}
@@ -1,4 +1,4 @@
1
- // styles for {{ component_class_name }} component
2
- .{{ component_class_name }} {
1
+ // styles for {{ component_class }} component
2
+ .{{ component_class }} {
3
3
 
4
4
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
@@ -153,7 +153,6 @@ files:
153
153
  - roles/qb.install_gem/meta/qb.yml
154
154
  - roles/qb.install_gem/tasks/main.yml
155
155
  - roles/qb.meteor_react_component/defaults/main.yml
156
- - roles/qb.meteor_react_component/library/component_facts.py
157
156
  - roles/qb.meteor_react_component/meta/main.yml
158
157
  - roles/qb.meteor_react_component/meta/qb.yml
159
158
  - roles/qb.meteor_react_component/tasks/main.yml
@@ -1,39 +0,0 @@
1
- #!/usr/bin/python
2
-
3
- import os
4
-
5
- def main():
6
- module = AnsibleModule(
7
- argument_spec = dict(
8
- path = dict(required=True, type='str'),
9
- ),
10
- supports_check_mode = False,
11
- )
12
-
13
-
14
- facts = {}
15
- changed = False
16
-
17
- path = module.params.get('path')
18
- path_parts = path.split('/')
19
-
20
- dir = os.path.join(*path_parts[:-1])
21
- dashed = "-".join(path_parts)
22
- class_name = "".join([s.capitalize() for s in path_parts])
23
-
24
- facts['component_dir'] = dir
25
- facts['component_dashed'] = dashed
26
- facts['component_class_name'] = class_name
27
- facts['component_logger_name'] = ":".join(['imports', 'ui'] + path_parts)
28
-
29
- module.exit_json(
30
- changed = changed,
31
- ansible_facts = facts,
32
- )
33
-
34
- # import module snippets
35
- from ansible.module_utils.basic import *
36
- from ansible.module_utils.known_hosts import *
37
-
38
- if __name__ == '__main__':
39
- main()