qb 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/qb +39 -1
- data/lib/qb/cli.rb +104 -1
- data/lib/qb/errors.rb +25 -2
- data/lib/qb/options.rb +33 -2
- data/lib/qb/options/option.rb +1 -0
- data/lib/qb/role.rb +53 -21
- data/lib/qb/role/errors.rb +3 -3
- data/lib/qb/version.rb +1 -1
- data/qb.gemspec +1 -1
- data/roles/qb.project/tasks/main.yml +1 -0
- data/roles/qb.role/defaults/main.yml +3 -1
- data/roles/qb/gem/new/defaults/main.yml +12 -0
- data/roles/{qb.git_check_clean → qb/gem/new}/meta/main.yml +1 -1
- data/roles/qb/gem/new/meta/qb.yml +90 -0
- data/roles/qb/gem/new/tasks/bundle_gem.yml +97 -0
- data/roles/qb/gem/new/tasks/main.yml +22 -0
- data/roles/qb/gem/release/defaults/main.yml +5 -0
- data/roles/{qb.release_gem → qb/gem/release}/meta/main.yml +1 -1
- data/roles/{qb.release_gem → qb/gem/release}/meta/qb.yml +2 -2
- data/roles/{qb.release_gem → qb/gem/release}/tasks/main.yml +57 -35
- data/roles/qb/git/check/clean/README.md +4 -0
- data/roles/qb/git/check/clean/meta/main.yml +8 -0
- data/roles/{qb.git_check_clean → qb/git/check/clean}/tasks/main.yml +5 -5
- data/roles/qb/osx/notif/defaults/main.yml +4 -0
- data/roles/qb/osx/notif/meta/main.yml +8 -0
- data/roles/qb/osx/notif/meta/qb.yml +81 -0
- data/roles/qb/osx/notif/tasks/main.yml +14 -0
- metadata +20 -32
- data/roles/qb.gem/.qb-options.yml +0 -4
- data/roles/qb.gem/defaults/main.yml +0 -17
- data/roles/qb.gem/files/.gitkeep +0 -0
- data/roles/qb.gem/files/.rspec +0 -2
- data/roles/qb.gem/files/Rakefile +0 -6
- data/roles/qb.gem/files/setup +0 -7
- data/roles/qb.gem/filter_plugins/ruby_constantize.py +0 -22
- data/roles/qb.gem/meta/main.yml +0 -8
- data/roles/qb.gem/meta/qb.yml +0 -26
- data/roles/qb.gem/tasks/main.yml +0 -105
- data/roles/qb.gem/templates/.gitkeep +0 -0
- data/roles/qb.gem/templates/.travis.yml.j2 +0 -4
- data/roles/qb.gem/templates/BSD2-LICENSE.txt.j2 +0 -23
- data/roles/qb.gem/templates/BSD3-LICENSE.txt.j2 +0 -27
- data/roles/qb.gem/templates/Gemfile.j2 +0 -4
- data/roles/qb.gem/templates/MIT-LICENSE.txt.j2 +0 -21
- data/roles/qb.gem/templates/console.j2 +0 -14
- data/roles/qb.gem/templates/gemspec.j2 +0 -36
- data/roles/qb.gem/templates/module.rb.j2 +0 -5
- data/roles/qb.gem/templates/spec.rb.j2 +0 -11
- data/roles/qb.gem/templates/spec_helper.rb.j2 +0 -2
- data/roles/qb.gem/templates/version.rb.j2 +0 -3
- data/roles/qb.release_gem/defaults/main.yml +0 -2
data/lib/qb/version.rb
CHANGED
data/qb.gemspec
CHANGED
@@ -95,7 +95,7 @@ Gem::Specification.new do |spec|
|
|
95
95
|
spec.add_development_dependency "pry"
|
96
96
|
|
97
97
|
spec.add_dependency "cmds",'~> 0.0', ">= 0.2.1"
|
98
|
-
spec.add_dependency "nrser",'~> 0.0', ">= 0.0.
|
98
|
+
spec.add_dependency "nrser",'~> 0.0', ">= 0.0.21"
|
99
99
|
spec.add_dependency "nrser-extras", '~> 0.0', ">= 0.0.3"
|
100
100
|
spec.add_dependency "state_mate", '~> 0.0', ">= 0.0.9"
|
101
101
|
spec.add_dependency 'parseconfig', '~> 1.0', '>= 1.0.8'
|
@@ -1,8 +1,10 @@
|
|
1
1
|
---
|
2
2
|
role_dest: "{{ qb_dir }}"
|
3
3
|
role_force: false
|
4
|
-
|
4
|
+
|
5
|
+
# can't be named `role_name` 'cause Ansible sets that?
|
5
6
|
role_role_name: "{{ role_dest | basename }}"
|
7
|
+
|
6
8
|
role_defaults: true
|
7
9
|
role_files: false
|
8
10
|
role_handlers: false
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
# meta/qb.yml file for qb/gem/new
|
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
|
+
Create a new Ruby gem, optionally as it's own project.
|
10
|
+
|
11
|
+
# Gemspec-style requirements. Right now only `gems:qb` is used, but plan to
|
12
|
+
# generalize in the future.
|
13
|
+
requirements:
|
14
|
+
gems:
|
15
|
+
qb: ~> 0.3.0
|
16
|
+
|
17
|
+
# prefix for role variables
|
18
|
+
var_prefix: gem
|
19
|
+
|
20
|
+
# how to get a default for `dir` if it's not provided as the only
|
21
|
+
# positional argument. if a positional argument is provided it will
|
22
|
+
# override the method defined here.
|
23
|
+
#
|
24
|
+
# options:
|
25
|
+
#
|
26
|
+
# - null
|
27
|
+
# - require the value on the command line.
|
28
|
+
# - false
|
29
|
+
# - don't provide qb_dir (means doesn't load or save options either).
|
30
|
+
# - git_root
|
31
|
+
# - use the git root fof the directory that the `qb` command is invoked
|
32
|
+
# from. useful for 'project-centric' commands so they can be invoked
|
33
|
+
# from anywhere in the repo.
|
34
|
+
# - cwd
|
35
|
+
# - use the directory the `qb` command is invoked form.
|
36
|
+
# - {exe: PATH}
|
37
|
+
# - invoke an execuable, passing a JSON serialization of the options
|
38
|
+
# mapping their CLI names to values. path can be relative to role
|
39
|
+
# directory.
|
40
|
+
# - {find_up: FILENAME}
|
41
|
+
# - starting at the current direcotry and climbing up to parent
|
42
|
+
# directories, use the first one that contains FILENAME. error
|
43
|
+
# if none is found.
|
44
|
+
default_dir: null
|
45
|
+
|
46
|
+
# If `true`, QB will ensure the default dir exists before starting the play.
|
47
|
+
#
|
48
|
+
# For legacy reasons, this defaults to `true` if not present, but we want to
|
49
|
+
# default declare it as `false` here so new roles can turn it on only if
|
50
|
+
# they need it.
|
51
|
+
#
|
52
|
+
mkdir: false
|
53
|
+
|
54
|
+
# default user to become for play
|
55
|
+
default_user: null
|
56
|
+
|
57
|
+
# set to false to not save options in .qb-options.yml files
|
58
|
+
save_options: true
|
59
|
+
|
60
|
+
# options to pass to ansible-playbook
|
61
|
+
ansible_options: {}
|
62
|
+
|
63
|
+
options:
|
64
|
+
# - name: example
|
65
|
+
# description: an example of a variable.
|
66
|
+
# required: false
|
67
|
+
# type: boolean # boolean (default) | string
|
68
|
+
# short: e
|
69
|
+
|
70
|
+
- name: name
|
71
|
+
description: >-
|
72
|
+
Name of the new gem.
|
73
|
+
type: string
|
74
|
+
short: n
|
75
|
+
|
76
|
+
- name: is_project
|
77
|
+
description: >-
|
78
|
+
Structure the gem as a project.
|
79
|
+
type: boolean
|
80
|
+
short: p
|
81
|
+
|
82
|
+
- include: qb.project
|
83
|
+
as: false
|
84
|
+
|
85
|
+
- name: force
|
86
|
+
var_name: force
|
87
|
+
description: >-
|
88
|
+
Override existing files with newly generated ones.
|
89
|
+
type: boolean
|
90
|
+
short: f
|
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
# Run `bundle gem <gem_name>` targeting a temp directory, then merge the
|
3
|
+
# results into `gem_root`.
|
4
|
+
|
5
|
+
- name: >-
|
6
|
+
Create a tempdir to run `bundle gem {{ gem_name }}` in.
|
7
|
+
tempfile:
|
8
|
+
state: directory
|
9
|
+
suffix: gem
|
10
|
+
register: tempdir
|
11
|
+
changed_when: false
|
12
|
+
|
13
|
+
|
14
|
+
- name: >-
|
15
|
+
Run `bundle gem {{ gem_name }}` in tempdir `{{ tempdir.path }}`.
|
16
|
+
stream:
|
17
|
+
cmd: >-
|
18
|
+
bundle gem %{gem_name}
|
19
|
+
kwds:
|
20
|
+
gem_name: >-
|
21
|
+
{{ gem_name }}
|
22
|
+
chdir: >-
|
23
|
+
{{ tempdir.path }}
|
24
|
+
changed_when: false
|
25
|
+
|
26
|
+
|
27
|
+
- name: >-
|
28
|
+
Get rid of the `.git` directory and `.gitignore` file since we don't want
|
29
|
+
to merge them.
|
30
|
+
with_items:
|
31
|
+
- .git
|
32
|
+
- .gitignore
|
33
|
+
file:
|
34
|
+
path: >-
|
35
|
+
{{ tempdir.path | path_join(gem_name, item) }}
|
36
|
+
state: absent
|
37
|
+
changed_when: false
|
38
|
+
|
39
|
+
|
40
|
+
- name: >-
|
41
|
+
Create destination directories in gem root `{{ gem_root }}`.
|
42
|
+
with_filetree: >-
|
43
|
+
{{ tempdir.path | path_join(gem_name) }}
|
44
|
+
when: item.state == 'directory'
|
45
|
+
file:
|
46
|
+
dest: >-
|
47
|
+
{{ gem_root | path_join(item.path) }}
|
48
|
+
state: directory
|
49
|
+
changed_when: false
|
50
|
+
|
51
|
+
|
52
|
+
- name: >-
|
53
|
+
Copy files from tempdir to gem root `{{ gem_root }}`.
|
54
|
+
with_filetree: >-
|
55
|
+
{{ tempdir.path | path_join(gem_name) }}
|
56
|
+
when: item.state == 'file'
|
57
|
+
copy:
|
58
|
+
src: >-
|
59
|
+
{{ item.src }}
|
60
|
+
dest: >-
|
61
|
+
{{ gem_root | path_join(item.path) }}
|
62
|
+
force: >-
|
63
|
+
{{ force }}
|
64
|
+
|
65
|
+
|
66
|
+
# Prob don't need this, but what the hell...
|
67
|
+
#
|
68
|
+
# From
|
69
|
+
#
|
70
|
+
# http://docs.ansible.com/ansible/latest/playbooks_loops.html#looping-over-filetrees
|
71
|
+
#
|
72
|
+
# along with the rest of it. Seem to work for relative symlinks.
|
73
|
+
#
|
74
|
+
- name: >-
|
75
|
+
Recreate symlinks from tempdir to gem root `{{ gem_root }}`.
|
76
|
+
with_filetree: >-
|
77
|
+
{{ tempdir.path | path_join(gem_name) }}
|
78
|
+
when: item.state == 'link'
|
79
|
+
file:
|
80
|
+
src: >-
|
81
|
+
{{ item.src }}
|
82
|
+
dest: >-
|
83
|
+
{{ gem_root | path_join(item.path) }}
|
84
|
+
state: link
|
85
|
+
force: >-
|
86
|
+
{{ force }}
|
87
|
+
mode: >-
|
88
|
+
{{ item.mode }}
|
89
|
+
|
90
|
+
|
91
|
+
- name: >-
|
92
|
+
Remove the temp dir at `{{ tempdir.path }}`.
|
93
|
+
file:
|
94
|
+
path: >-
|
95
|
+
{{ tempdir.path }}
|
96
|
+
state: absent
|
97
|
+
changed_when: false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
# tasks file for qb/gem/new
|
3
|
+
|
4
|
+
- include: >-
|
5
|
+
{{ role_path }}/tasks/bundle_gem.yml
|
6
|
+
|
7
|
+
- name: >-
|
8
|
+
Add gitignore blocks.
|
9
|
+
with_items:
|
10
|
+
- Ruby
|
11
|
+
- Gem
|
12
|
+
include_role:
|
13
|
+
name: qb.gitignore
|
14
|
+
vars:
|
15
|
+
gitignore_name: >-
|
16
|
+
{{ item }}
|
17
|
+
|
18
|
+
- when: gem_is_project
|
19
|
+
name: >-
|
20
|
+
Include `qb.project` role.
|
21
|
+
include_role:
|
22
|
+
name: qb.project
|
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
# meta/qb.yml file for qb
|
2
|
+
# meta/qb.yml file for qb/gem/release
|
3
3
|
#
|
4
4
|
# qb settings for this role. see README.md for more info.
|
5
5
|
#
|
@@ -10,7 +10,7 @@ var_prefix: null
|
|
10
10
|
# how to get a default for `dir` if it's not provided as the
|
11
11
|
default_dir: null
|
12
12
|
|
13
|
-
# set to false to not save options in /Users/nrser/dev/gh/nrser/qb/roles/qb
|
13
|
+
# set to false to not save options in /Users/nrser/dev/gh/nrser/qb/roles/qb/gem/release/.qb-options.yml
|
14
14
|
save_options: true
|
15
15
|
|
16
16
|
vars: []
|
@@ -1,13 +1,31 @@
|
|
1
1
|
---
|
2
|
-
# tasks file for qb
|
2
|
+
# tasks file for qb/gem/release
|
3
3
|
|
4
|
-
- name:
|
4
|
+
- name: >-
|
5
|
+
Check that the git repo at {{ gem_root }} is clean.
|
6
|
+
include_role:
|
7
|
+
name: qb/git/check/clean
|
8
|
+
vars:
|
9
|
+
git_root: >-
|
10
|
+
{{ gem_root }}
|
11
|
+
|
12
|
+
|
13
|
+
- name: >-
|
14
|
+
Do a `bundle install`.
|
15
|
+
bundler:
|
16
|
+
state: present
|
17
|
+
chdir: >-
|
18
|
+
{{ gem_root }}
|
19
|
+
|
20
|
+
|
21
|
+
- name: >-
|
22
|
+
Get gem and version info
|
5
23
|
vars.rb:
|
6
|
-
namespace:
|
24
|
+
namespace: gem
|
7
25
|
bind:
|
8
|
-
|
26
|
+
gem_root: "{{ gem_root }}"
|
9
27
|
src: |
|
10
|
-
spec_pattern = "#{
|
28
|
+
spec_pattern = "#{ gem_root }/*.gemspec"
|
11
29
|
spec_path = Dir.glob(spec_pattern)[0]
|
12
30
|
|
13
31
|
if spec_path.nil?
|
@@ -50,68 +68,72 @@
|
|
50
68
|
'current_version' => version.version,
|
51
69
|
'release_version' => version.release,
|
52
70
|
'next_version' => next_version,
|
53
|
-
'version_path' => "#{
|
71
|
+
'version_path' => "#{ gem_root }/lib/#{ name }/version.rb",
|
54
72
|
'spec_path' => spec_path,
|
55
73
|
}
|
56
74
|
|
57
75
|
- debug:
|
58
76
|
msg:
|
59
77
|
# - spec_path: >-
|
60
|
-
# {{
|
78
|
+
# {{ gem_spec_path }}
|
61
79
|
# - version_path: >-
|
62
|
-
# {{
|
80
|
+
# {{ gem_version_path }}
|
63
81
|
- current: >-
|
64
|
-
{{
|
82
|
+
{{ gem_current_version }}
|
65
83
|
- release: >-
|
66
|
-
{{
|
84
|
+
{{ gem_release_version }}
|
67
85
|
- next: >-
|
68
|
-
{{
|
86
|
+
{{ gem_next_version }}
|
69
87
|
|
70
|
-
- name: "change version to release version {{
|
88
|
+
- name: "change version to release version {{ gem_release_version }}"
|
71
89
|
replace:
|
72
|
-
dest: "{{
|
73
|
-
regexp: "VERSION\\s*=\\s*\"{{
|
74
|
-
replace: "VERSION = \"{{
|
75
|
-
when:
|
90
|
+
dest: "{{ gem_version_path }}"
|
91
|
+
regexp: "VERSION\\s*=\\s*\"{{ gem_current_version }}\""
|
92
|
+
replace: "VERSION = \"{{ gem_release_version }}\""
|
93
|
+
when: gem_current_version != gem_release_version
|
94
|
+
|
76
95
|
|
77
|
-
- name:
|
78
|
-
|
96
|
+
- name: >-
|
97
|
+
Add version file {{ gem_version_path }} to Git.
|
98
|
+
command: "git add {{ gem_version_path }}"
|
79
99
|
args:
|
80
|
-
chdir: "{{
|
81
|
-
when:
|
100
|
+
chdir: "{{ gem_root }}"
|
101
|
+
when: gem_current_version != gem_release_version
|
102
|
+
|
82
103
|
|
83
|
-
- name:
|
84
|
-
|
104
|
+
- name: >-
|
105
|
+
Commit version file {{ gem_version_path }} in Git.
|
106
|
+
command: git commit -m "bump to v{{ gem_release_version }}"
|
85
107
|
args:
|
86
|
-
chdir: "{{
|
87
|
-
when:
|
108
|
+
chdir: "{{ gem_root }}"
|
109
|
+
when: gem_current_version != gem_release_version
|
88
110
|
|
89
111
|
- name: release with bundler
|
90
112
|
shell: bundle exec rake release
|
91
113
|
args:
|
92
|
-
chdir: "{{
|
114
|
+
chdir: "{{ gem_root }}"
|
93
115
|
|
94
|
-
- name: "change version to next version {{
|
116
|
+
- name: "change version to next version {{ gem_next_version }}"
|
95
117
|
replace:
|
96
|
-
dest: "{{
|
97
|
-
regexp: "VERSION\\s*=\\s*\"{{
|
98
|
-
replace: "VERSION = \"{{
|
118
|
+
dest: "{{ gem_version_path }}"
|
119
|
+
regexp: "VERSION\\s*=\\s*\"{{ gem_release_version }}\""
|
120
|
+
replace: "VERSION = \"{{ gem_next_version }}\""
|
99
121
|
|
100
122
|
- name: add next dev version to git
|
101
|
-
command: "git add {{
|
123
|
+
command: "git add {{ gem_version_path }}"
|
102
124
|
args:
|
103
|
-
chdir: "{{
|
125
|
+
chdir: "{{ gem_root }}"
|
104
126
|
|
105
127
|
- name: commit next dev version
|
106
|
-
command: git commit -m "start {{
|
128
|
+
command: git commit -m "start {{ gem_next_version }}"
|
107
129
|
args:
|
108
|
-
chdir: "{{
|
130
|
+
chdir: "{{ gem_root }}"
|
109
131
|
|
110
132
|
- name: push next dev version
|
111
133
|
command: git push
|
112
134
|
args:
|
113
|
-
chdir: "{{
|
135
|
+
chdir: "{{ gem_root }}"
|
114
136
|
|
115
137
|
- debug:
|
116
138
|
msg: >
|
117
|
-
v{{
|
139
|
+
v{{ gem_release_version }} released.
|