qb 0.3.4 → 0.3.5
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 +4 -4
- data/ansible.cfg +0 -1
- data/exe/qb +22 -306
- data/lib/qb/ansible/cmds/playbook.rb +59 -8
- data/lib/qb/cli.rb +26 -3
- data/lib/qb/cli/help.rb +56 -0
- data/lib/qb/cli/play.rb +22 -10
- data/lib/qb/cli/run.rb +291 -0
- data/lib/qb/cli/setup.rb +57 -0
- data/lib/qb/role.rb +859 -771
- data/lib/qb/version.rb +1 -1
- data/qb.gemspec +1 -1
- data/roles/qb/dev/ref/repo/git/defaults/main.yml +5 -4
- data/roles/qb/dev/ref/repo/git/tasks/main.yml +9 -0
- data/roles/qb/yarn/setup/README.md +47 -0
- data/roles/{qb.yarn_setup → qb/yarn/setup}/defaults/main.yml +1 -1
- data/roles/{qb.yarn_setup → qb/yarn/setup}/meta/main.yml +1 -1
- data/roles/{qb.yarn_setup → qb/yarn/setup}/meta/qb.yml +2 -2
- data/roles/{qb.yarn_setup → qb/yarn/setup}/tasks/distribution/MacOSX/brew_create.yml +1 -1
- data/roles/qb/yarn/setup/tasks/distribution/MacOSX/main.yml +57 -0
- data/roles/{qb.yarn_setup → qb/yarn/setup}/tasks/main.yml +1 -1
- data/roles/qb/yarn/setup/templates/yarn@M.m.p.rb.j2 +29 -0
- metadata +14 -11
- data/roles/qb.yarn_setup/tasks/distribution/MacOSX/main.yml +0 -42
- data/roles/qb.yarn_setup/templates/yarn@M.m.p.rb.j2 +0 -22
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.2"
|
98
|
-
spec.add_dependency "nrser",'~> 0.0', ">= 0.0.
|
98
|
+
spec.add_dependency "nrser",'~> 0.0', ">= 0.0.23"
|
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'
|
@@ -18,14 +18,15 @@ update: false
|
|
18
18
|
owner: >-
|
19
19
|
{{ full_name.split('/')[0] }}
|
20
20
|
|
21
|
-
name
|
22
|
-
|
21
|
+
# `name` is a reserved name :/
|
22
|
+
repo_name: >-
|
23
|
+
{{ full_name.split('/')[1] }}
|
23
24
|
|
24
25
|
full_name: >-
|
25
|
-
{{ owner }}/{{
|
26
|
+
{{ owner }}/{{ repo_name }}
|
26
27
|
|
27
28
|
rel_dest: >-
|
28
|
-
{{
|
29
|
+
{{ repo_name }}@{{ version }}
|
29
30
|
|
30
31
|
dest: >-
|
31
32
|
{{ project_root }}/dev/ref/{{ rel_dest }}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
qb/yarn/setup Role
|
2
|
+
========================================================================
|
3
|
+
|
4
|
+
------------------------------------------------------------------------
|
5
|
+
Examples
|
6
|
+
------------------------------------------------------------------------
|
7
|
+
|
8
|
+
1. Installing a specific `yarn` version on macOS
|
9
|
+
|
10
|
+
qb qb/yarn/setup --version=1.0.2
|
11
|
+
|
12
|
+
This will create a `yarn@1.0.2` Homebrew formula if it doesn't exist.
|
13
|
+
|
14
|
+
See the [Homebrew Formula Creation](#homebrew-formula-creation) section for more details.
|
15
|
+
|
16
|
+
|
17
|
+
------------------------------------------------------------------------
|
18
|
+
Homebrew Formula Creation
|
19
|
+
------------------------------------------------------------------------
|
20
|
+
|
21
|
+
Homebrew for some reason (probably many reasons, I just don't know them) doesn't really work like most package managers that allow you to specify what version you want to install... it kinda just has a current version. Since it can be important to control what version you and the rest of your team are using, we create a Homebrew formula for it (if it doesn't already exist).
|
22
|
+
|
23
|
+
The formula is created using the `yarn@M.m.p.rb.j2` template, and is added to the Homebrew tap in the `yarn_setup_brew_tap` variable, which defaults to
|
24
|
+
|
25
|
+
{{ qb_git_user_name }}/versions
|
26
|
+
|
27
|
+
which will lead Homebrew to pull the Github repo at
|
28
|
+
|
29
|
+
git@github.com:{{ qb_git_user_name }}/homebrew-versions.git
|
30
|
+
|
31
|
+
(or of course the `https` version of the URL, I don't know if using the SSH version is something I personally set up at some point because I use them for everything, but I find stuff tends to default to the `https` ones unless told otherwise.)
|
32
|
+
|
33
|
+
So, for myself, the tap would be
|
34
|
+
|
35
|
+
nrser/versions
|
36
|
+
|
37
|
+
and the repo would be
|
38
|
+
|
39
|
+
git@github.com:nrser/homebrew-versions.git
|
40
|
+
|
41
|
+
**The tap repo is not created if it doesn't already exist!**
|
42
|
+
|
43
|
+
You can override `yarn_setup_brew_tap` in Ansible or from the command line with the `-t, --brew-tap=BREW_TAP` option:
|
44
|
+
|
45
|
+
qb qb/yarn/setup --version=1.0.2 --brew-tap=someone-else/versions
|
46
|
+
|
47
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
# meta/qb.yml file for qb
|
2
|
+
# meta/qb.yml file for qb/yarn/setup
|
3
3
|
#
|
4
4
|
# qb settings for this role. see README.md for more info.
|
5
5
|
#
|
@@ -9,7 +9,7 @@ description: >-
|
|
9
9
|
Install and configure Yarn package manager (for Node).
|
10
10
|
|
11
11
|
# prefix for role variables
|
12
|
-
var_prefix:
|
12
|
+
var_prefix: yarn_setup
|
13
13
|
|
14
14
|
# how to get a default for `dir` if it's not provided as the only
|
15
15
|
# positional argument. if a positional argument is provided it will
|
@@ -46,7 +46,7 @@
|
|
46
46
|
- name: >-
|
47
47
|
Commit new formula to {{ yarn_setup_brew_tap }}
|
48
48
|
command: >-
|
49
|
-
git commit -m "qb
|
49
|
+
git commit -m "qb/yarn/setup role added {{ yarn_setup_formula_name }} formula"
|
50
50
|
args:
|
51
51
|
chdir: "{{ yarn_setup_brew_tap_dir.stdout }}"
|
52
52
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
- name: >-
|
3
|
+
homebrew_name is 'yarn' if no versions is specified,
|
4
|
+
else it is 'yarn@<version>'.
|
5
|
+
set_fact:
|
6
|
+
yarn_setup_brew_name: >-
|
7
|
+
{{ 'yarn@'+yarn_setup_version if yarn_setup_version else 'yarn' }}
|
8
|
+
|
9
|
+
|
10
|
+
- name: >-
|
11
|
+
`yarn_setup_can_brew_create` is true when the `yarn_setup_brew_create`
|
12
|
+
option is `true` and the state is either 'linked' or 'present'.
|
13
|
+
set_fact:
|
14
|
+
yarn_setup_can_brew_create: >-
|
15
|
+
{{ yarn_setup_brew_create and yarn_setup_state == 'present' }}
|
16
|
+
|
17
|
+
- debug:
|
18
|
+
msg: >-
|
19
|
+
update_homebrew {{ lookup( 'every', 'update_homebrew', days=1 ) }}
|
20
|
+
|
21
|
+
- name: >-
|
22
|
+
Make sure `{{ yarn_setup_brew_name }}` is {{ yarn_setup_state }}
|
23
|
+
on macOS via Homebrew.
|
24
|
+
homebrew:
|
25
|
+
name: >-
|
26
|
+
{{ yarn_setup_brew_name }}
|
27
|
+
state: >-
|
28
|
+
{{ yarn_setup_state }}
|
29
|
+
update_homebrew: >-
|
30
|
+
{{ lookup( 'every', 'update_homebrew', days=1 ) }}
|
31
|
+
# ignore errors if we're in a config where we can create the formula
|
32
|
+
ignore_errors: >-
|
33
|
+
{{ yarn_setup_can_brew_create }}
|
34
|
+
register: yarn_setup_brew_result
|
35
|
+
|
36
|
+
# - debug: var=yarn_setup_brew_result
|
37
|
+
#
|
38
|
+
# - fail: msg=HERE
|
39
|
+
|
40
|
+
|
41
|
+
- when: >-
|
42
|
+
'failed' in yarn_setup_brew_result and
|
43
|
+
yarn_setup_can_brew_create
|
44
|
+
name: >-
|
45
|
+
Create Homebrew formula
|
46
|
+
include: "{{ role_path }}/tasks/distribution/MacOSX/brew_create.yml"
|
47
|
+
|
48
|
+
|
49
|
+
- name: >-
|
50
|
+
Link Yarn in Homebrew
|
51
|
+
when: yarn_setup_brew_link
|
52
|
+
homebrew:
|
53
|
+
name: "{{ yarn_setup_brew_name }}"
|
54
|
+
state: linked
|
55
|
+
install_options:
|
56
|
+
- overwrite
|
57
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class YarnAT{{ yarn_setup_version | regex_replace('\\D', '') }} < Formula
|
2
|
+
desc "Yarn JavaScript package manager version {{ yarn_setup_version }}"
|
3
|
+
homepage "https://yarnpkg.com/"
|
4
|
+
url "https://github.com/yarnpkg/yarn/releases/download/v{{ yarn_setup_version }}/yarn-v{{ yarn_setup_version }}.tar.gz"
|
5
|
+
head "https://github.com/yarnpkg/yarn.git"
|
6
|
+
|
7
|
+
bottle :unneeded
|
8
|
+
|
9
|
+
depends_on "node" => :recommended
|
10
|
+
|
11
|
+
def install
|
12
|
+
libexec.install Dir["*"]
|
13
|
+
|
14
|
+
# old way:
|
15
|
+
# bin.install_symlink "#{libexec}/bin/yarn.js" => "yarn"
|
16
|
+
# bin.install_symlink "#{libexec}/bin/yarn.js" => "yarnpkg"
|
17
|
+
|
18
|
+
# new way: (https://github.com/Homebrew/homebrew-core/commit/b465fc700ad7c617b30c86ed985d0dbbdf9e7455#diff-049797e41058fd9c5475703be58fcb60)
|
19
|
+
(bin/"yarn").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX
|
20
|
+
(bin/"yarnpkg").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX
|
21
|
+
|
22
|
+
inreplace "#{libexec}/package.json", '"installationMethod": "tar"', '"installationMethod": "homebrew"'
|
23
|
+
end
|
24
|
+
|
25
|
+
test do
|
26
|
+
(testpath/"package.json").write('{"name": "test"}')
|
27
|
+
system bin/"yarn", "add", "jquery"
|
28
|
+
end
|
29
|
+
end
|
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.
|
4
|
+
version: 0.3.5
|
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-
|
11
|
+
date: 2017-09-17 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.
|
112
|
+
version: 0.0.23
|
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.
|
122
|
+
version: 0.0.23
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: nrser-extras
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,8 +201,10 @@ files:
|
|
201
201
|
- lib/qb/ansible/module.rb
|
202
202
|
- lib/qb/ansible_module.rb
|
203
203
|
- lib/qb/cli.rb
|
204
|
+
- lib/qb/cli/help.rb
|
204
205
|
- lib/qb/cli/play.rb
|
205
206
|
- lib/qb/cli/run.rb
|
207
|
+
- lib/qb/cli/setup.rb
|
206
208
|
- lib/qb/errors.rb
|
207
209
|
- lib/qb/options.rb
|
208
210
|
- lib/qb/options/option.rb
|
@@ -638,13 +640,6 @@ files:
|
|
638
640
|
- roles/qb.yarn_release/meta/main.yml
|
639
641
|
- roles/qb.yarn_release/meta/qb.yml
|
640
642
|
- roles/qb.yarn_release/tasks/main.yml
|
641
|
-
- roles/qb.yarn_setup/defaults/main.yml
|
642
|
-
- roles/qb.yarn_setup/meta/main.yml
|
643
|
-
- roles/qb.yarn_setup/meta/qb.yml
|
644
|
-
- roles/qb.yarn_setup/tasks/distribution/MacOSX/brew_create.yml
|
645
|
-
- roles/qb.yarn_setup/tasks/distribution/MacOSX/main.yml
|
646
|
-
- roles/qb.yarn_setup/tasks/main.yml
|
647
|
-
- roles/qb.yarn_setup/templates/yarn@M.m.p.rb.j2
|
648
643
|
- roles/qb/dev/ref/repo/git/defaults/main.yml
|
649
644
|
- roles/qb/dev/ref/repo/git/meta/main.yml
|
650
645
|
- roles/qb/dev/ref/repo/git/meta/qb.yml
|
@@ -675,6 +670,14 @@ files:
|
|
675
670
|
- roles/qb/osx/notif/meta/main.yml
|
676
671
|
- roles/qb/osx/notif/meta/qb.yml
|
677
672
|
- roles/qb/osx/notif/tasks/main.yml
|
673
|
+
- roles/qb/yarn/setup/README.md
|
674
|
+
- roles/qb/yarn/setup/defaults/main.yml
|
675
|
+
- roles/qb/yarn/setup/meta/main.yml
|
676
|
+
- roles/qb/yarn/setup/meta/qb.yml
|
677
|
+
- roles/qb/yarn/setup/tasks/distribution/MacOSX/brew_create.yml
|
678
|
+
- roles/qb/yarn/setup/tasks/distribution/MacOSX/main.yml
|
679
|
+
- roles/qb/yarn/setup/tasks/main.yml
|
680
|
+
- roles/qb/yarn/setup/templates/yarn@M.m.p.rb.j2
|
678
681
|
homepage: https://github.com/nrser/qb
|
679
682
|
licenses:
|
680
683
|
- MIT
|
@@ -1,42 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- name: >-
|
3
|
-
homebrew_name is 'yarn' if no versions is specified,
|
4
|
-
else it is 'yarn@<version>'
|
5
|
-
set_fact:
|
6
|
-
yarn_setup_brew_name: >-
|
7
|
-
{% if yarn_setup_version -%}
|
8
|
-
yarn@{{ yarn_setup_version }}
|
9
|
-
{%- else -%}
|
10
|
-
yarn
|
11
|
-
{%- endif %}
|
12
|
-
|
13
|
-
- name: >-
|
14
|
-
can_brew_create is true when the brew_create option is true and the state
|
15
|
-
is either 'linked' or 'present'
|
16
|
-
set_fact:
|
17
|
-
yarn_setup_can_brew_create: >-
|
18
|
-
{{ yarn_setup_brew_create and yarn_setup_state == 'present' }}
|
19
|
-
|
20
|
-
- name: Manage Yarn installtion state on MacOSX via Homebrew
|
21
|
-
homebrew:
|
22
|
-
name: "{{ yarn_setup_brew_name }}"
|
23
|
-
state: "{{ yarn_setup_state }}"
|
24
|
-
update_homebrew: >-
|
25
|
-
{{ lookup('every', 'update_homebrew', days=1) }}
|
26
|
-
# ignore errors if we're in a config where we can create the formula
|
27
|
-
ignore_errors: "{{ yarn_setup_can_brew_create }}"
|
28
|
-
register: yarn_setup_brew_result
|
29
|
-
|
30
|
-
- name: Create Homebrew formula
|
31
|
-
when: >-
|
32
|
-
yarn_setup_brew_result.failed and yarn_setup_can_brew_create
|
33
|
-
include: "{{ role_path }}/tasks/distribution/MacOSX/brew_create.yml"
|
34
|
-
|
35
|
-
- name: Link Yarn in Homebrew
|
36
|
-
when: yarn_setup_brew_link
|
37
|
-
homebrew:
|
38
|
-
name: "{{ yarn_setup_brew_name }}"
|
39
|
-
state: linked
|
40
|
-
install_options:
|
41
|
-
- overwrite
|
42
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class YarnAT{{ yarn_setup_version | regex_replace('\\D', '') }} < Formula
|
2
|
-
desc "JavaScript package manager"
|
3
|
-
homepage "https://yarnpkg.com/"
|
4
|
-
url "https://github.com/yarnpkg/yarn/releases/download/v{{ yarn_setup_version }}/yarn-v{{ yarn_setup_version }}.tar.gz"
|
5
|
-
head "https://github.com/yarnpkg/yarn.git"
|
6
|
-
|
7
|
-
bottle :unneeded
|
8
|
-
|
9
|
-
depends_on "node"
|
10
|
-
|
11
|
-
def install
|
12
|
-
libexec.install Dir["*"]
|
13
|
-
bin.install_symlink "#{libexec}/bin/yarn.js" => "yarn"
|
14
|
-
bin.install_symlink "#{libexec}/bin/yarn.js" => "yarnpkg"
|
15
|
-
inreplace "#{libexec}/package.json", '"installationMethod": "tar"', '"installationMethod": "homebrew"'
|
16
|
-
end
|
17
|
-
|
18
|
-
test do
|
19
|
-
(testpath/"package.json").write('{"name": "test"}')
|
20
|
-
system bin/"yarn", "add", "jquery"
|
21
|
-
end
|
22
|
-
end
|