qb 0.1.45 → 0.1.46

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: bcb1a17b0a0de1df2f3c2204495d65961bccf3c9
4
- data.tar.gz: cb96ea3f64119b67ca44ba31e301cecee3b70582
3
+ metadata.gz: ff68700805b2dbcd27abea8754ef0c5ea66e2151
4
+ data.tar.gz: 5ca65baf700375df21a47b3b225fc6cf396bcff6
5
5
  SHA512:
6
- metadata.gz: e166103c65024a4617fbc718881bddbd42670f5982f1ba660c740cf55d9e9bbf809d7d25f1adfdcad8bc82228be39e7065c4b83ad5f6a11f13ea1a56fd66f419
7
- data.tar.gz: f614153b02e88e36ba18bf41e5a6a4a672004fc50cc13e970466e9c779d57da10d172e1a0930f4b7ee6caaaadc3493dcd03f3a5abfea35a77a1dffdaae4de1a2
6
+ metadata.gz: cbe87af1aa353cc72495d365b90d0491a92dee4d3b9f7dfa69ca398f3efb2dcfe3a7ac475ef73f3aedc966af8af9d6bb8e6ea82215d59c9a6de78ff574f48ea0
7
+ data.tar.gz: cb7da6e5098071a6c59371e254e04338d516f4cf507e65ea01935885f1d0fab7ba6e9dc5ce8fe9495e8d9269143c2a091a93c62d1680c0f31a88e823693f68a1
@@ -138,17 +138,43 @@ module QB
138
138
 
139
139
  # get an array of QB::Role that match an input string
140
140
  def self.matches input
141
+ # keep this here to we don't re-gen every loop
141
142
  available = self.available
142
143
 
144
+ # first off, see if input matches any relative paths exactly
143
145
  available.each {|role|
144
- # exact match to relative path
145
146
  return [role] if role.rel_path.to_s == input
146
- }.each {|role|
147
- # exact match to full name
148
- return [role] if role.name == input
149
- }.each {|role|
150
- # exact match without the namespace prefix ('qb.' or similar)
151
- return [role] if role.namespaceless == input
147
+ }
148
+
149
+ # create an array of "separator" variations to try *exact* matching
150
+ # against. in order of preference:
151
+ #
152
+ # 1. exact input
153
+ # - this means if you ended up with roles that actually *are*
154
+ # differnetiated by '_/-' differences (which, IMHO, is a
155
+ # horrible fucking idea), you can get exactly what you ask for
156
+ # as a first priority
157
+ # 2. input with '-' changed to '_'
158
+ # - prioritized because convetion is to underscore-separate
159
+ # role names.
160
+ # 3. input with '_' changed to '-'
161
+ # - really just for convience's sake so you don't really have to
162
+ # remember what separator is used.
163
+ #
164
+ separator_variations = [
165
+ input,
166
+ input.gsub('-', '_'),
167
+ input.gsub('_', '_'),
168
+ ]
169
+
170
+ separator_variations.each {|variation|
171
+ available.each {|role|
172
+ # exact match to full name
173
+ return [role] if role.name == variation
174
+ }.each {|role|
175
+ # exact match without the namespace prefix ('qb.' or similar)
176
+ return [role] if role.namespaceless == variation
177
+ }
152
178
  }
153
179
 
154
180
  # see if we prefix match any full names
@@ -1,7 +1,7 @@
1
1
  module QB
2
2
  GEM_NAME = 'qb'
3
3
 
4
- VERSION = "0.1.45"
4
+ VERSION = "0.1.46"
5
5
 
6
6
  def self.gemspec
7
7
  Gem.loaded_specs[GEM_NAME]
@@ -18,6 +18,9 @@ def gemspec_path(dir):
18
18
 
19
19
 
20
20
  def is_gem(dir):
21
+ if dir is None:
22
+ return False
23
+
21
24
  return dir and bool(gemspec_path(dir))
22
25
 
23
26
 
@@ -26,6 +29,9 @@ def package_json_path(dir):
26
29
 
27
30
 
28
31
  def has_package_json(dir):
32
+ if dir is None:
33
+ return False
34
+
29
35
  return os.path.isfile(package_json_path(dir))
30
36
 
31
37
 
@@ -1,2 +1,3 @@
1
1
  ---
2
2
  # defaults file for qb.git_repo
3
+ git_repo_dest: "{{ qb_dir }}"
@@ -4,4 +4,5 @@
4
4
  dependencies:
5
5
  - role: qb.gitignore
6
6
  gitignore_name: Global/OSX
7
+ gitignore_dest: "{{ git_repo_dest }}"
7
8
  when: ansible_distribution == "MacOSX"
@@ -4,6 +4,6 @@
4
4
  - name: initialize git
5
5
  command: git init
6
6
  args:
7
- chdir: "{{ dir }}"
8
- creates: "{{ dir }}/.git"
7
+ chdir: "{{ git_repo_dest }}"
8
+ creates: "{{ git_repo_dest }}/.git"
9
9
 
@@ -1,4 +1,5 @@
1
1
  ---
2
2
  # defaults file for qb.gitignore
3
3
 
4
+ gitignore_dest: "{{ qb_dir }}"
4
5
  gitignore_force: false
@@ -1,16 +1,21 @@
1
1
  ---
2
2
  # tasks file for qb.gitignore
3
3
 
4
+ - name: create directory
5
+ file:
6
+ path: "{{ gitignore_dest }}"
7
+ state: directory
8
+
4
9
  - name: create .gitignore
5
10
  copy:
6
11
  content: ''
7
- dest: "{{ qb_dir }}/.gitignore"
12
+ dest: "{{ gitignore_dest }}/.gitignore"
8
13
  force: "{{ gitignore_force }}"
9
14
 
10
15
  - name: modify .gitignore
11
16
  blockinfile:
12
17
  content: "{{ lookup('file', 'gitignore/' + gitignore_name + '.gitignore') }}"
13
- dest: "{{ qb_dir }}/.gitignore"
18
+ dest: "{{ gitignore_dest }}/.gitignore"
14
19
  beginmarker: |
15
20
  {{ '#' * 78 }}
16
21
  # BEGIN {{ gitignore_name }}.gitignore
@@ -2,8 +2,23 @@
2
2
  # defaults file for qb.install
3
3
 
4
4
  install_path: "{{ qb_user_roles_dir }}"
5
- install_src: "{{ install_name.split('.')[0] }}/ansible-{{ install_name }}"
5
+
6
+ install_src: "{% if install_create -%}
7
+ {{ ansible_env.GITHUB_HOME }}/{{ install_name.split('.')[0] }}/ansible-{{ install_name }}
8
+ {%- else -%}
9
+ {{ install_name.split('.')[0] }}/ansible-{{ install_name }}
10
+ {%- endif %}"
11
+
6
12
  install_version: master
13
+
7
14
  install_force: false
15
+
8
16
  install_update: false
9
- install_link: false
17
+
18
+ install_link: "{% if install_create -%}
19
+ true
20
+ {%- else -%}
21
+ false
22
+ {%- endif %}"
23
+
24
+ install_create: false
@@ -3,6 +3,12 @@
3
3
 
4
4
  allow_duplicates: yes
5
5
 
6
- dependencies: []
6
+ dependencies: # []
7
7
  # - role: role-name
8
-
8
+ - role: qb.qb_role
9
+ when: "{{ install_create }}"
10
+ role_dest: "{{ install_src }}"
11
+ role_role_name: "{{ install_name }}"
12
+ role_project: true
13
+ project_hub: true
14
+ project_dest: "{{ install_src }}"
@@ -86,3 +86,9 @@ options:
86
86
  required: false
87
87
  type: boolean
88
88
  short: l
89
+
90
+ - name: create
91
+ description: create a repo for a new role to install in $GITHUB_HOME.
92
+ required: false
93
+ type: boolean
94
+ short: c
@@ -0,0 +1,4 @@
1
+ ---
2
+ - name: open new qb role repo in atom
3
+ shell: "atom {{ install_src }}"
4
+
@@ -6,4 +6,6 @@
6
6
 
7
7
  - include: link.yml
8
8
  when: install_link
9
-
9
+
10
+ - include: create.yml
11
+ when: install_create
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  # defaults file for qb.project
3
+ project_dest: "{{ qb_dir }}"
3
4
  project_owner: "{{ ansible_env.GITHUB_USER }}"
4
- project_name: "{{ qb_dir | realpath | basename }}"
5
+ project_name: "{{ project_dest | realpath | basename }}"
5
6
  project_bin: true
6
7
  project_dev: true
7
8
  project_dev_bin: true
@@ -2,4 +2,5 @@
2
2
  # meta file for qb.project
3
3
 
4
4
  dependencies:
5
- - role: qb.git_repo
5
+ - role: qb.git_repo
6
+ git_repo_dest: "{{ project_dest }}"
@@ -3,6 +3,10 @@ default_dir:
3
3
  exe: qb/get_dir
4
4
 
5
5
  vars:
6
+ - name: dest
7
+ description: destination directory.
8
+ type: string
9
+
6
10
  - name: owner
7
11
  desciption: github owner of directory
8
12
  type: string
@@ -1,7 +1,7 @@
1
1
  ---
2
2
 
3
3
  - set_fact:
4
- project_dev_dir: "{{ qb_dir }}/dev"
4
+ project_dev_dir: "{{ project_dest }}/dev"
5
5
 
6
6
  - set_fact:
7
7
  project_dev_gitignore: "{{ project_dev_dir }}/.gitignore"
@@ -6,7 +6,7 @@
6
6
 
7
7
  - name: create /bin directory
8
8
  git_mkdir:
9
- path: "{{ qb_dir }}/bin"
9
+ path: "{{ project_dest }}/bin"
10
10
  when: project_bin
11
11
 
12
12
  # dev
@@ -20,7 +20,7 @@
20
20
 
21
21
  - name: create tmp directory
22
22
  git_mkdir:
23
- path: "{{ qb_dir }}/tmp"
23
+ path: "{{ project_dest }}/tmp"
24
24
  # have to explicitly commit it since it's ignored
25
25
  commit: true
26
26
  when: project_tmp
@@ -28,7 +28,7 @@
28
28
  - name: ignore tmp dir in git
29
29
  lineinfile:
30
30
  line: /tmp
31
- dest: "{{ qb_dir }}/.gitignore"
31
+ dest: "{{ project_dest }}/.gitignore"
32
32
  when: project_tmp
33
33
 
34
34
  # readme
@@ -37,7 +37,7 @@
37
37
  - name: create readme
38
38
  template:
39
39
  src: README.md.j2
40
- dest: "{{ qb_dir }}/README.md"
40
+ dest: "{{ project_dest }}/README.md"
41
41
  force: "{{ project_force }}"
42
42
  when: project_readme
43
43
 
@@ -47,7 +47,7 @@
47
47
  - name: run `hub create`
48
48
  command: "hub create{% if project_private %} -p{% endif %} {{ project_owner }}/{{ project_name }}"
49
49
  args:
50
- chdir: "{{ qb_dir }}"
50
+ chdir: "{{ project_dest }}"
51
51
  when: project_hub
52
52
 
53
53
  # qb artifacts
@@ -56,5 +56,5 @@
56
56
  - name: ignore .qb-playbook.yml
57
57
  lineinfile:
58
58
  line: .qb-playbook.yml
59
- dest: "{{ qb_dir }}/.gitignore"
59
+ dest: "{{ project_dest }}/.gitignore"
60
60
  when: project_tmp
@@ -2,3 +2,4 @@
2
2
  qb.qb_role:
3
3
  defaults: true
4
4
  templates: true
5
+ vars: true
@@ -1,4 +1,8 @@
1
1
  ---
2
2
  # defaults file for qb.qb_role
3
- qb_role_dest: "{{ qb_dir }}"
3
+
4
+ # default the encapsulated qb.role's `role-dest` to `qb_dir` so we can be
5
+ # sure to be able to use it here... not sure if needed.
6
+ role_dest: "{{ qb_dir }}"
7
+
4
8
  qb_role_modules: []
@@ -3,13 +3,13 @@
3
3
 
4
4
  - name: create meta directory
5
5
  file:
6
- path: "{{ dir }}/meta"
6
+ path: "{{ role_dest }}/meta"
7
7
  state: directory
8
8
 
9
9
  - name: create meta/qb.yml
10
10
  template:
11
11
  src: qb.yml.j2
12
- dest: "{{ dir }}/meta/qb.yml"
12
+ dest: "{{ role_dest }}/meta/qb.yml"
13
13
  force: false
14
14
 
15
15
  - include: module.yml
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  - set_fact:
3
3
  qb_role_module_class: "{{ qb_role_module | class_case }}"
4
- qb_role_module_path: "{{ qb_role_dest }}/library/{{ qb_role_module }}"
4
+ qb_role_module_path: "{{ role_dest }}/library/{{ qb_role_module }}"
5
5
 
6
6
  - name: "create {{ qb_role_module }} module"
7
7
  template:
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.45
4
+ version: 0.1.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-28 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -385,6 +385,7 @@ files:
385
385
  - roles/qb.gitignore/files/gitignore/Global/NetBeans.gitignore
386
386
  - roles/qb.gitignore/files/gitignore/Global/Ninja.gitignore
387
387
  - roles/qb.gitignore/files/gitignore/Global/NotepadPP.gitignore
388
+ - roles/qb.gitignore/files/gitignore/Global/OSX.gitignore
388
389
  - roles/qb.gitignore/files/gitignore/Global/Otto.gitignore
389
390
  - roles/qb.gitignore/files/gitignore/Global/README.md
390
391
  - roles/qb.gitignore/files/gitignore/Global/Redcar.gitignore
@@ -502,6 +503,7 @@ files:
502
503
  - roles/qb.install/defaults/main.yml
503
504
  - roles/qb.install/meta/main.yml
504
505
  - roles/qb.install/meta/qb.yml
506
+ - roles/qb.install/tasks/create.yml
505
507
  - roles/qb.install/tasks/git.yml
506
508
  - roles/qb.install/tasks/link.yml
507
509
  - roles/qb.install/tasks/main.yml