qb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +146 -0
- data/.qb-options.yml +4 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +4 -0
- data/Rakefile +6 -0
- data/ansible.cfg +5 -0
- data/bin/console +14 -0
- data/bin/qb +287 -0
- data/bin/setup +9 -0
- data/dev/bin/.gitkeep +0 -0
- data/dev/bin/ungem +19 -0
- data/dev/setup.yml +58 -0
- data/lib/qb.rb +5 -0
- data/lib/qb/version.rb +3 -0
- data/library/git_mkdir.py +70 -0
- data/library/qb_facts.py +38 -0
- data/qb.gemspec +27 -0
- data/requirements.yml +2 -0
- data/roles/qb.gem/.qb-options.yml +4 -0
- data/roles/qb.gem/defaults/main.yml +17 -0
- data/roles/qb.gem/files/.gitkeep +0 -0
- data/roles/qb.gem/files/.rspec +2 -0
- data/roles/qb.gem/files/Rakefile +6 -0
- data/roles/qb.gem/files/setup +7 -0
- data/roles/qb.gem/filter_plugins/ruby_constantize.py +22 -0
- data/roles/qb.gem/meta/main.yml +35 -0
- data/roles/qb.gem/tasks/main.yml +105 -0
- data/roles/qb.gem/templates/.gitkeep +0 -0
- data/roles/qb.gem/templates/.travis.yml.j2 +4 -0
- data/roles/qb.gem/templates/BSD2-LICENSE.txt.j2 +23 -0
- data/roles/qb.gem/templates/BSD3-LICENSE.txt.j2 +27 -0
- data/roles/qb.gem/templates/Gemfile.j2 +4 -0
- data/roles/qb.gem/templates/MIT-LICENSE.txt.j2 +21 -0
- data/roles/qb.gem/templates/console.j2 +14 -0
- data/roles/qb.gem/templates/gemspec.j2 +36 -0
- data/roles/qb.gem/templates/module.rb.j2 +5 -0
- data/roles/qb.gem/templates/spec.rb.j2 +11 -0
- data/roles/qb.gem/templates/spec_helper.rb.j2 +2 -0
- data/roles/qb.gem/templates/version.rb.j2 +3 -0
- data/roles/qb.git_repo/defaults/main.yml +2 -0
- data/roles/qb.git_repo/meta/main.yml +5 -0
- data/roles/qb.git_repo/tasks/main.yml +9 -0
- data/roles/qb.gitignore/defaults/main.yml +4 -0
- data/roles/qb.gitignore/meta/main.yml +12 -0
- data/roles/qb.gitignore/tasks/main.yml +31 -0
- data/roles/qb.project/.qb-options.yml +3 -0
- data/roles/qb.project/defaults/main.yml +12 -0
- data/roles/qb.project/meta/main.yml +49 -0
- data/roles/qb.project/qb/get_dir +13 -0
- data/roles/qb.project/tasks/main.yml +102 -0
- data/roles/qb.project/templates/.gitkeep +0 -0
- data/roles/qb.project/templates/README.md.j2 +2 -0
- data/roles/qb.project/templates/setup.yml.j2 +52 -0
- data/roles/qb.role/.qb-options.yml +3 -0
- data/roles/qb.role/defaults/main.yml +9 -0
- data/roles/qb.role/meta/main.yml +31 -0
- data/roles/qb.role/tasks/main.yml +117 -0
- data/roles/qb.role/templates/.gitkeep +0 -0
- data/roles/qb.role/templates/defaults/main.yml.j2 +2 -0
- data/roles/qb.role/templates/handlers/main.yml.j2 +2 -0
- data/roles/qb.role/templates/meta/main.yml.j2 +5 -0
- data/roles/qb.role/templates/tasks/main.yml.j2 +2 -0
- data/roles/qb.role/templates/vars/main.yml.j2 +2 -0
- data/scratch/case.rb +38 -0
- data/temp.yml +19 -0
- metadata +169 -0
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) {{ ansible_date_time.year }}, {{ gem_authors | join(',') }}
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
15
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
20
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
21
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
22
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
23
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) {{ ansible_date_time.year }}, {{ gem_authors | join(',') }}
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
* Neither the name of {{ gem_authors | join(',') }} nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from
|
16
|
+
this software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) {{ ansible_date_time.year }} {{ gem_authors | join(',') }}
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "{{ gem_dirname }}"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require '{{ gem_dirname }}/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "{{ gem_name }}"
|
8
|
+
spec.version = {{ gem_constant }}::VERSION
|
9
|
+
spec.authors = {{ gem_authors | to_json }}
|
10
|
+
spec.email = {{ gem_emails | to_json }}
|
11
|
+
|
12
|
+
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
|
13
|
+
spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/{{ git_user_name }}/{{ dir | basename }}"
|
15
|
+
{% if gem_license is defined -%}
|
16
|
+
spec.license = "{{ gem_license }}"
|
17
|
+
{%- endif %}
|
18
|
+
|
19
|
+
{% if gem_allowed_push_host is defined -%}
|
20
|
+
# Prevent pushing this gem to RubyGems.org
|
21
|
+
if spec.respond_to?(:metadata)
|
22
|
+
spec.metadata['allowed_push_host'] = "{{ gem_allowed_push_host }}"
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
25
|
+
end
|
26
|
+
{%- endif %}
|
27
|
+
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec"
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
# tasks file for qb.gitignore
|
3
|
+
|
4
|
+
- name: check out nrser/gitignore
|
5
|
+
git:
|
6
|
+
repo: git@github.com:nrser/gitignore.git
|
7
|
+
dest: ./tmp/gitignore
|
8
|
+
version: master
|
9
|
+
depth: 1
|
10
|
+
update: "{{ gitignore_update }}"
|
11
|
+
|
12
|
+
- name: create .gitignore
|
13
|
+
copy:
|
14
|
+
content: ''
|
15
|
+
dest: "{{ dir }}/.gitignore"
|
16
|
+
force: false
|
17
|
+
register: gitignore_created
|
18
|
+
|
19
|
+
- name: add the gitignore
|
20
|
+
blockinfile:
|
21
|
+
content: "{{ lookup('file', './tmp/gitignore/' + gitignore_name + '.gitignore') }}"
|
22
|
+
dest: "{{ dir }}/.gitignore"
|
23
|
+
marker: "# {mark} {{ gitignore_name }}.gitignore"
|
24
|
+
register: gitignore_added
|
25
|
+
|
26
|
+
- command: git add -f .gitignore
|
27
|
+
args:
|
28
|
+
chdir: "{{ dir }}"
|
29
|
+
when: >
|
30
|
+
gitignore_created.changed or
|
31
|
+
gitignore_added.changed
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
# defaults file for qb.project
|
3
|
+
project_owner: "{{ ansible_env.GITHUB_USER }}"
|
4
|
+
project_name: "{{ dir | realpath | basename }}"
|
5
|
+
project_bin: true
|
6
|
+
project_dev: true
|
7
|
+
project_setup: true
|
8
|
+
project_scratch: true
|
9
|
+
project_tmp: true
|
10
|
+
project_readme: true
|
11
|
+
project_hub: false
|
12
|
+
project_private: true
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
# meta file for qb.project
|
3
|
+
|
4
|
+
dependencies:
|
5
|
+
- role: qb.gitignore
|
6
|
+
gitignore_name: Global/OSX
|
7
|
+
|
8
|
+
qb_info:
|
9
|
+
vars:
|
10
|
+
- name: owner
|
11
|
+
desciption: github owner of directory
|
12
|
+
type: string
|
13
|
+
|
14
|
+
- name: name
|
15
|
+
description: github name of directory
|
16
|
+
type: string
|
17
|
+
|
18
|
+
- name: bin
|
19
|
+
description: create a /bin directory
|
20
|
+
type: boolean
|
21
|
+
|
22
|
+
- name: dev
|
23
|
+
description: create a /dev directory
|
24
|
+
type: boolean
|
25
|
+
|
26
|
+
- name: setup
|
27
|
+
description: create a /dev/setup.yml playbook
|
28
|
+
type: boolean
|
29
|
+
|
30
|
+
- name: scratch
|
31
|
+
description: create a /scratch directory
|
32
|
+
type: boolean
|
33
|
+
|
34
|
+
- name: tmp
|
35
|
+
description: create a /tmp directory
|
36
|
+
type: boolean
|
37
|
+
|
38
|
+
- name: readme
|
39
|
+
description: create a /README.md file
|
40
|
+
type: boolean
|
41
|
+
|
42
|
+
- name: hub
|
43
|
+
description: run `hub create` in the directory
|
44
|
+
type: boolean
|
45
|
+
|
46
|
+
- name: private
|
47
|
+
description: create as private when using hub
|
48
|
+
type: boolean
|
49
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
options = JSON.parse STDIN.read
|
7
|
+
|
8
|
+
name = options['name']
|
9
|
+
owner = options['owner'] || ENV.fetch('GITHUB_USER')
|
10
|
+
|
11
|
+
abort unless name
|
12
|
+
|
13
|
+
puts "#{ ENV.fetch('GITHUB_ROOT') }/#{ owner }/#{ name }"
|
@@ -0,0 +1,102 @@
|
|
1
|
+
---
|
2
|
+
# tasks file for qb.project
|
3
|
+
|
4
|
+
# bin
|
5
|
+
# ===
|
6
|
+
|
7
|
+
- name: create /bin directory
|
8
|
+
git_mkdir:
|
9
|
+
path: "{{ dir }}/bin"
|
10
|
+
when: project_bin
|
11
|
+
|
12
|
+
# dev
|
13
|
+
# ===
|
14
|
+
|
15
|
+
- name: create /dev and /dev/bin directories
|
16
|
+
git_mkdir:
|
17
|
+
path: "{{ dir }}/dev/bin"
|
18
|
+
when: project_dev
|
19
|
+
|
20
|
+
# setup
|
21
|
+
# =====
|
22
|
+
|
23
|
+
- name: create /dev/setup.yml
|
24
|
+
template:
|
25
|
+
src: setup.yml.j2
|
26
|
+
dest: "{{ dir }}/dev/setup.yml"
|
27
|
+
force: false
|
28
|
+
when: project_setup
|
29
|
+
register: setup_yml
|
30
|
+
|
31
|
+
- command: git add dev/setup.yml
|
32
|
+
args:
|
33
|
+
chdir: "{{ dir }}"
|
34
|
+
when: setup_yml.changed
|
35
|
+
|
36
|
+
- name: ignore /dev/repos in git
|
37
|
+
lineinfile:
|
38
|
+
line: /dev/repos
|
39
|
+
dest: "{{ dir }}/.gitignore"
|
40
|
+
register: ignore_dev_repos
|
41
|
+
|
42
|
+
- name: ignore /dev/ref/repos in git
|
43
|
+
lineinfile:
|
44
|
+
line: /dev/ref/repos
|
45
|
+
dest: "{{ dir }}/.gitignore"
|
46
|
+
register: ignore_dev_ref_repos
|
47
|
+
|
48
|
+
# scratch
|
49
|
+
# =======
|
50
|
+
|
51
|
+
- name: create scratch directory
|
52
|
+
git_mkdir:
|
53
|
+
path: "{{ dir }}/scratch"
|
54
|
+
|
55
|
+
# tmp
|
56
|
+
# ===
|
57
|
+
|
58
|
+
- name: create tmp directory
|
59
|
+
git_mkdir:
|
60
|
+
path: "{{ dir }}/tmp"
|
61
|
+
|
62
|
+
- name: ignore tmp dir in git
|
63
|
+
lineinfile:
|
64
|
+
line: /tmp
|
65
|
+
dest: "{{ dir }}/.gitignore"
|
66
|
+
register: ignore_tmp
|
67
|
+
|
68
|
+
# readme
|
69
|
+
# ======
|
70
|
+
|
71
|
+
- name: create readme
|
72
|
+
template:
|
73
|
+
src: README.md.j2
|
74
|
+
dest: "{{ dir }}/README.md"
|
75
|
+
force: false
|
76
|
+
when: project_readme
|
77
|
+
register: readme
|
78
|
+
|
79
|
+
- command: git add README.md
|
80
|
+
args:
|
81
|
+
chdir: "{{ dir }}"
|
82
|
+
when: readme.changed
|
83
|
+
|
84
|
+
# hub
|
85
|
+
# ===
|
86
|
+
|
87
|
+
- name: run `hub create`
|
88
|
+
command: "hub create{% if project_private %} -p{% endif %}"
|
89
|
+
args:
|
90
|
+
chdir: "{{ dir }}"
|
91
|
+
when: project_hub
|
92
|
+
|
93
|
+
# postamble
|
94
|
+
# =========
|
95
|
+
|
96
|
+
- command: git add .gitignore
|
97
|
+
args:
|
98
|
+
chdir: "{{ dir }}"
|
99
|
+
when: >
|
100
|
+
ignore_dev_repos.changed or
|
101
|
+
ignore_dev_ref_repos.changed or
|
102
|
+
ignore_tmp.changed
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
# playbook to setup the dev env for this repo
|
3
|
+
- name: dev setup for {{ project_owner }}/{{ project_name }}
|
4
|
+
{% raw %}
|
5
|
+
hosts: localhost
|
6
|
+
|
7
|
+
vars:
|
8
|
+
# repos that are co-developed
|
9
|
+
repos: []
|
10
|
+
# example:
|
11
|
+
# - owner: nrser
|
12
|
+
# name: qb
|
13
|
+
|
14
|
+
# repos that are used for reference only
|
15
|
+
ref_repos: []
|
16
|
+
# example:
|
17
|
+
# - owner: ansible
|
18
|
+
# name: ansible
|
19
|
+
# version: v1.9.4-1
|
20
|
+
# dir_name: ansible-v1.9.4
|
21
|
+
# depth: 1
|
22
|
+
|
23
|
+
tasks:
|
24
|
+
- name: clone co-dev repos
|
25
|
+
git:
|
26
|
+
repo: git@github.com:{{ item.owner }}/{{ item.name }}.git
|
27
|
+
dest: ./repos/{{ item.dir_name | default(item.name) }}
|
28
|
+
version: "{{ item.version | default('HEAD') }}"
|
29
|
+
update: no
|
30
|
+
with_items: repos
|
31
|
+
|
32
|
+
- name: see if the repos have a Gemfile
|
33
|
+
stat:
|
34
|
+
path: "./repos/{{ item.dir_name | default(item.name) }}/Gemfile"
|
35
|
+
with_items: repos
|
36
|
+
register: gemfile_stats
|
37
|
+
|
38
|
+
- name: install bunlde for any that have a Gemfile
|
39
|
+
shell: bash -lc "bundle install --path=./.bundle"
|
40
|
+
args:
|
41
|
+
chdir: "{{ item.invocation.module_complex_args.path | dirname }}"
|
42
|
+
when: item.stat.exists
|
43
|
+
with_items: gemfile_stats.results | default([])
|
44
|
+
|
45
|
+
- name: clone ref repos
|
46
|
+
git:
|
47
|
+
repo: git@github.com:{{ item.owner }}/{{ item.name }}.git
|
48
|
+
dest: ./ref/repos/{{ item.dir_name | default(item.name) }}
|
49
|
+
version: "{{ item.version | default('HEAD') }}"
|
50
|
+
depth: "{{ item.depth | default(0) }}"
|
51
|
+
with_items: ref_repos
|
52
|
+
{% endraw %}
|