qb 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/exe/qb +39 -1
  3. data/lib/qb/cli.rb +104 -1
  4. data/lib/qb/errors.rb +25 -2
  5. data/lib/qb/options.rb +33 -2
  6. data/lib/qb/options/option.rb +1 -0
  7. data/lib/qb/role.rb +53 -21
  8. data/lib/qb/role/errors.rb +3 -3
  9. data/lib/qb/version.rb +1 -1
  10. data/qb.gemspec +1 -1
  11. data/roles/qb.project/tasks/main.yml +1 -0
  12. data/roles/qb.role/defaults/main.yml +3 -1
  13. data/roles/qb/gem/new/defaults/main.yml +12 -0
  14. data/roles/{qb.git_check_clean → qb/gem/new}/meta/main.yml +1 -1
  15. data/roles/qb/gem/new/meta/qb.yml +90 -0
  16. data/roles/qb/gem/new/tasks/bundle_gem.yml +97 -0
  17. data/roles/qb/gem/new/tasks/main.yml +22 -0
  18. data/roles/qb/gem/release/defaults/main.yml +5 -0
  19. data/roles/{qb.release_gem → qb/gem/release}/meta/main.yml +1 -1
  20. data/roles/{qb.release_gem → qb/gem/release}/meta/qb.yml +2 -2
  21. data/roles/{qb.release_gem → qb/gem/release}/tasks/main.yml +57 -35
  22. data/roles/qb/git/check/clean/README.md +4 -0
  23. data/roles/qb/git/check/clean/meta/main.yml +8 -0
  24. data/roles/{qb.git_check_clean → qb/git/check/clean}/tasks/main.yml +5 -5
  25. data/roles/qb/osx/notif/defaults/main.yml +4 -0
  26. data/roles/qb/osx/notif/meta/main.yml +8 -0
  27. data/roles/qb/osx/notif/meta/qb.yml +81 -0
  28. data/roles/qb/osx/notif/tasks/main.yml +14 -0
  29. metadata +20 -32
  30. data/roles/qb.gem/.qb-options.yml +0 -4
  31. data/roles/qb.gem/defaults/main.yml +0 -17
  32. data/roles/qb.gem/files/.gitkeep +0 -0
  33. data/roles/qb.gem/files/.rspec +0 -2
  34. data/roles/qb.gem/files/Rakefile +0 -6
  35. data/roles/qb.gem/files/setup +0 -7
  36. data/roles/qb.gem/filter_plugins/ruby_constantize.py +0 -22
  37. data/roles/qb.gem/meta/main.yml +0 -8
  38. data/roles/qb.gem/meta/qb.yml +0 -26
  39. data/roles/qb.gem/tasks/main.yml +0 -105
  40. data/roles/qb.gem/templates/.gitkeep +0 -0
  41. data/roles/qb.gem/templates/.travis.yml.j2 +0 -4
  42. data/roles/qb.gem/templates/BSD2-LICENSE.txt.j2 +0 -23
  43. data/roles/qb.gem/templates/BSD3-LICENSE.txt.j2 +0 -27
  44. data/roles/qb.gem/templates/Gemfile.j2 +0 -4
  45. data/roles/qb.gem/templates/MIT-LICENSE.txt.j2 +0 -21
  46. data/roles/qb.gem/templates/console.j2 +0 -14
  47. data/roles/qb.gem/templates/gemspec.j2 +0 -36
  48. data/roles/qb.gem/templates/module.rb.j2 +0 -5
  49. data/roles/qb.gem/templates/spec.rb.j2 +0 -11
  50. data/roles/qb.gem/templates/spec_helper.rb.j2 +0 -2
  51. data/roles/qb.gem/templates/version.rb.j2 +0 -3
  52. data/roles/qb.release_gem/defaults/main.yml +0 -2
@@ -0,0 +1,8 @@
1
+ ---
2
+ # meta file for qb/git/check/clean
3
+
4
+ allow_duplicates: yes
5
+
6
+ dependencies: []
7
+ # - role: role-name
8
+
@@ -1,19 +1,19 @@
1
1
  ---
2
- # tasks file for qb.git_check_clean
2
+ # tasks file for qb/git/check/clean
3
3
 
4
4
  - name: >
5
- get git status for repo {{ git_check_clean_dir }}
5
+ Get git status for repo {{ git_root }}
6
6
  shell: git status --porcelain 2>/dev/null
7
7
  args:
8
- chdir: "{{ git_check_clean_dir }}"
8
+ chdir: "{{ git_root }}"
9
9
  register: git_check_clean_status
10
10
  changed_when: false
11
11
 
12
12
  - name: >
13
- fail if the repo has any untracked or modified files
13
+ Fail if the repo at {{ git_root }} has any untracked or modified files.
14
14
  fail:
15
15
  msg: >
16
- repo at {{ git_check_clean_dir }} can not have any untracked or
16
+ Repo at {{ git_root }} can not have any untracked or
17
17
  modified files, please commit or stash and retry.
18
18
  when: (git_check_clean_status.stdout_lines | length) != 0
19
19
 
@@ -0,0 +1,4 @@
1
+ ---
2
+ # defaults file for notif
3
+
4
+ osx_notif_terminal_notifier_path: /usr/local/bin/terminal-notifier
@@ -0,0 +1,8 @@
1
+ ---
2
+ # meta file for notif
3
+
4
+ allow_duplicates: yes
5
+
6
+ dependencies: []
7
+ # - role: role-name
8
+
@@ -0,0 +1,81 @@
1
+ ---
2
+ # meta/qb.yml file for notif
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: null
9
+
10
+ # Gemspec-style requirements. Right now only `gems:qb` is used, but plan to
11
+ # generalize in the future.
12
+ requirements:
13
+ gems:
14
+ qb: ~> 0.3.0
15
+
16
+ # prefix for role variables
17
+ var_prefix: osx_notif
18
+
19
+ # how to get a default for `dir` if it's not provided as the only
20
+ # positional argument. if a positional argument is provided it will
21
+ # override the method defined here.
22
+ #
23
+ # options:
24
+ #
25
+ # - null
26
+ # - require the value on the command line.
27
+ # - false
28
+ # - don't provide qb_dir (means doesn't load or save options either).
29
+ # - git_root
30
+ # - use the git root fof the directory that the `qb` command is invoked
31
+ # from. useful for 'project-centric' commands so they can be invoked
32
+ # from anywhere in the repo.
33
+ # - cwd
34
+ # - use the directory the `qb` command is invoked form.
35
+ # - {exe: PATH}
36
+ # - invoke an execuable, passing a JSON serialization of the options
37
+ # mapping their CLI names to values. path can be relative to role
38
+ # directory.
39
+ # - {find_up: FILENAME}
40
+ # - starting at the current direcotry and climbing up to parent
41
+ # directories, use the first one that contains FILENAME. error
42
+ # if none is found.
43
+ default_dir: false
44
+
45
+ # If `true`, QB will ensure the default dir exists before starting the play.
46
+ #
47
+ # For legacy reasons, this defaults to `true` if not present, but we want to
48
+ # default declare it as `false` here so new roles can turn it on only if
49
+ # they need it.
50
+ #
51
+ mkdir: false
52
+
53
+ # default user to become for play
54
+ default_user: null
55
+
56
+ # set to false to not save options in .qb-options.yml files
57
+ save_options: true
58
+
59
+ # options to pass to ansible-playbook
60
+ ansible_options: {}
61
+
62
+ options:
63
+ # - name: example
64
+ # description: an example of a variable.
65
+ # required: false
66
+ # type: boolean # boolean (default) | string
67
+ # short: e
68
+
69
+ - name: title
70
+ description: >-
71
+ Notification title.
72
+ required: true
73
+ type: string
74
+ short: t
75
+
76
+ - name: message
77
+ description: >-
78
+ Notification message.
79
+ required: true
80
+ type: string
81
+ short: m
@@ -0,0 +1,14 @@
1
+ ---
2
+ # tasks file for notif
3
+
4
+ - name: >-
5
+ Install `terminal-notifier` via Homebrew
6
+ homebrew:
7
+ name: terminal-notifier
8
+
9
+ - name: >-
10
+ Send notification.
11
+ command: >-
12
+ {{ osx_notif_terminal_notifier_path | quote }}
13
+ -title {{ osx_notif_title | quote }}
14
+ -message {{ osx_notif_message | quote }}
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-08 00:00:00.000000000 Z
11
+ date: 2017-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0.0'
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 0.0.20
112
+ version: 0.0.21
113
113
  type: :runtime
114
114
  prerelease: false
115
115
  version_requirements: !ruby/object:Gem::Requirement
@@ -119,7 +119,7 @@ dependencies:
119
119
  version: '0.0'
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 0.0.20
122
+ version: 0.0.21
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: nrser-extras
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -347,30 +347,6 @@ files:
347
347
  - roles/qb.bump/tasks/frontend/level/release.yml
348
348
  - roles/qb.bump/tasks/frontend/main.yml
349
349
  - roles/qb.bump/tasks/main.yml
350
- - roles/qb.gem/.qb-options.yml
351
- - roles/qb.gem/defaults/main.yml
352
- - roles/qb.gem/files/.gitkeep
353
- - roles/qb.gem/files/.rspec
354
- - roles/qb.gem/files/Rakefile
355
- - roles/qb.gem/files/setup
356
- - roles/qb.gem/filter_plugins/ruby_constantize.py
357
- - roles/qb.gem/meta/main.yml
358
- - roles/qb.gem/meta/qb.yml
359
- - roles/qb.gem/tasks/main.yml
360
- - roles/qb.gem/templates/.gitkeep
361
- - roles/qb.gem/templates/.travis.yml.j2
362
- - roles/qb.gem/templates/BSD2-LICENSE.txt.j2
363
- - roles/qb.gem/templates/BSD3-LICENSE.txt.j2
364
- - roles/qb.gem/templates/Gemfile.j2
365
- - roles/qb.gem/templates/MIT-LICENSE.txt.j2
366
- - roles/qb.gem/templates/console.j2
367
- - roles/qb.gem/templates/gemspec.j2
368
- - roles/qb.gem/templates/module.rb.j2
369
- - roles/qb.gem/templates/spec.rb.j2
370
- - roles/qb.gem/templates/spec_helper.rb.j2
371
- - roles/qb.gem/templates/version.rb.j2
372
- - roles/qb.git_check_clean/meta/main.yml
373
- - roles/qb.git_check_clean/tasks/main.yml
374
350
  - roles/qb.git_repo/defaults/main.yml
375
351
  - roles/qb.git_repo/meta/main.yml
376
352
  - roles/qb.git_repo/meta/qb.yml
@@ -628,10 +604,6 @@ files:
628
604
  - roles/qb.read_json/meta/main.yml
629
605
  - roles/qb.read_json/meta/qb.yml
630
606
  - roles/qb.read_json/tasks/main.yml
631
- - roles/qb.release_gem/defaults/main.yml
632
- - roles/qb.release_gem/meta/main.yml
633
- - roles/qb.release_gem/meta/qb.yml
634
- - roles/qb.release_gem/tasks/main.yml
635
607
  - roles/qb.role/.qb-options.yml
636
608
  - roles/qb.role/defaults/main.yml
637
609
  - roles/qb.role/meta/main.yml
@@ -679,12 +651,28 @@ files:
679
651
  - roles/qb/facts/meta/main.yml
680
652
  - roles/qb/facts/meta/qb.yml
681
653
  - roles/qb/facts/tasks/main.yml
654
+ - roles/qb/gem/new/defaults/main.yml
655
+ - roles/qb/gem/new/meta/main.yml
656
+ - roles/qb/gem/new/meta/qb.yml
657
+ - roles/qb/gem/new/tasks/bundle_gem.yml
658
+ - roles/qb/gem/new/tasks/main.yml
659
+ - roles/qb/gem/release/defaults/main.yml
660
+ - roles/qb/gem/release/meta/main.yml
661
+ - roles/qb/gem/release/meta/qb.yml
662
+ - roles/qb/gem/release/tasks/main.yml
663
+ - roles/qb/git/check/clean/README.md
664
+ - roles/qb/git/check/clean/meta/main.yml
665
+ - roles/qb/git/check/clean/tasks/main.yml
682
666
  - roles/qb/osx/git/change_case/README.md
683
667
  - roles/qb/osx/git/change_case/defaults/main.yml
684
668
  - roles/qb/osx/git/change_case/meta/main.yml
685
669
  - roles/qb/osx/git/change_case/meta/qb.yml
686
670
  - roles/qb/osx/git/change_case/tasks/main.yml
687
671
  - roles/qb/osx/git/change_case/tasks/upcase.yml
672
+ - roles/qb/osx/notif/defaults/main.yml
673
+ - roles/qb/osx/notif/meta/main.yml
674
+ - roles/qb/osx/notif/meta/qb.yml
675
+ - roles/qb/osx/notif/tasks/main.yml
688
676
  homepage: https://github.com/nrser/qb
689
677
  licenses:
690
678
  - MIT
@@ -1,4 +0,0 @@
1
- ---
2
- qb.role:
3
- templates: true
4
- files: true
@@ -1,17 +0,0 @@
1
- ---
2
- # defaults file for qb.gem
3
-
4
- # like some_gem
5
- gem_name: "{{ dir | basename }}"
6
-
7
- # folder in /lib as you would use in `require some_gem`
8
- gem_dirname: "{{ gem_name }}"
9
-
10
- # the ruby constant (class or module name), like "SomeGem"
11
- gem_constant: "{{ gem_dirname | ruby_constantize }}"
12
-
13
- gem_authors:
14
- - "{{ git_user_name }}"
15
-
16
- gem_emails:
17
- - "{{ git_user_email }}"
File without changes
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,22 +0,0 @@
1
- import re
2
- import subprocess
3
- import pipes
4
- from ansible import errors
5
-
6
- # from bundler's implementation
7
- #
8
- # name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
9
- #
10
- # https://github.com/bundler/bundler/blob/7ae072865e3fc23d9844322dde6ad0f6906e3f2c/lib/bundler/cli/gem.rb#L29
11
- #
12
- def ruby_constantize(s):
13
- ruby = 'puts "%s".gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }' % s
14
- return subprocess.check_output("/usr/bin/env ruby -e %s" % pipes.quote(ruby), shell=True).rstrip()
15
-
16
- class FilterModule(object):
17
- '''ruby_constantize filter'''
18
-
19
- def filters(self):
20
- return {
21
- 'ruby_constantize': ruby_constantize,
22
- }
@@ -1,8 +0,0 @@
1
- ---
2
- # meta file for qb.gem
3
-
4
- dependencies:
5
- - role: qb.gitignore
6
- gitignore_name: Ruby
7
- - role: qb.gitignore
8
- gitignore_name: Gem
@@ -1,26 +0,0 @@
1
- ---
2
- vars:
3
- - name: name
4
- description: name of gem
5
- type: string
6
-
7
- - name: dirname
8
- description: folder name in /lib as you would use in `require some_gem`
9
- type: string
10
-
11
- - name: constant
12
- description: Ruby module or class name.
13
- type: string
14
-
15
- - name: license
16
- description: license to include.
17
- type: string
18
- options:
19
- - MIT
20
- - BSD
21
-
22
- - name: allowed_push_host
23
- description: >
24
- web address of server this gem is allowed to be pushed to. settings this
25
- prohibits pushing to RubyGems.org and should be done for private gems.
26
- type: string
@@ -1,105 +0,0 @@
1
- ---
2
- # tasks file for qb.gem
3
-
4
- # preamble... should move to facts?
5
-
6
- - name: get ruby version
7
- command: ruby -e "puts RUBY_VERSION"
8
- register: gem_ruby_version
9
- changed_when: false
10
-
11
- - name: get bundler version
12
- command: bundle --version
13
- register: gem_bundler_version
14
- changed_when: false
15
-
16
- # ok, actual work....
17
-
18
- - name: add /bin/console
19
- template:
20
- src: console.j2
21
- dest: "{{ dir }}/bin/console"
22
- force: false
23
- mode: a+x
24
-
25
- - name: add /bin/setup
26
- copy:
27
- src: setup
28
- dest: "{{ dir }}/bin/setup"
29
- force: false
30
- mode: a+x
31
-
32
- - name: create /lib
33
- file:
34
- path: "{{ dir }}/lib"
35
- state: directory
36
-
37
- - name: add /lib/<dirname>.rb
38
- template:
39
- src: module.rb.j2
40
- dest: "{{ dir }}/lib/{{ gem_dirname }}.rb"
41
- force: false
42
-
43
- - name: create /lib/<dirname>
44
- file:
45
- path: "{{ dir }}/lib/{{ gem_dirname }}"
46
- state: directory
47
-
48
- - name: add /lib/<dirname>/version.rb
49
- template:
50
- src: version.rb.j2
51
- dest: "{{ dir }}/lib/{{ gem_dirname }}/version.rb"
52
- force: false
53
-
54
- - name: create /spec
55
- file:
56
- path: "{{ dir }}/spec"
57
- state: directory
58
-
59
- - name: add /spec/spec_helper.rb
60
- template:
61
- src: spec_helper.rb.j2
62
- dest: "{{ dir }}/spec/spec_helper.rb"
63
- force: false
64
-
65
- - name: add /spec/<dirname>_spec.rb
66
- template:
67
- src: spec.rb.j2
68
- dest: "{{ dir }}/spec/{{ gem_dirname }}_spec.rb"
69
- force: false
70
-
71
- - name: add /.rspec
72
- copy:
73
- src: .rspec
74
- dest: "{{ dir }}/.rspec"
75
- force: false
76
-
77
- - name: add /.travis.yml
78
- template:
79
- src: .travis.yml.j2
80
- dest: "{{ dir }}/.travis.yml"
81
- force: false
82
-
83
- - name: add {{ gem_name }}.gemspec
84
- template:
85
- src: gemspec.j2
86
- dest: "{{ dir }}/{{ gem_name }}.gemspec"
87
- force: false
88
-
89
- - name: add /Gemfile
90
- template:
91
- src: Gemfile.j2
92
- dest: "{{ dir }}/Gemfile"
93
- force: false
94
-
95
- - name: add /LICENSE.txt
96
- template:
97
- src: "{{ gem_license }}-LICENSE.txt.j2"
98
- dest: "{{ dir }}/LICENSE.txt"
99
- force: false
100
- when: gem_license is defined
101
-
102
- - name: add /Rakefile
103
- copy:
104
- src: Rakefile
105
- dest: "{{ dir }}/Rakefile"