cobra_commander 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +38 -0
- data/CHANGELOG.md +4 -0
- data/README.md +8 -0
- data/lib/cobra_commander/affected.rb +9 -1
- data/lib/cobra_commander/cli.rb +2 -2
- data/lib/cobra_commander/executor.rb +7 -5
- data/lib/cobra_commander/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a07c92126bfb5a1179d1fb056a0c33452d5b9cab9087c9062d3c0e8203b3d165
|
4
|
+
data.tar.gz: a338e59737c442e533d7c9cf951dde539666617d2c571999c8d104b1dddb68aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b47bca554823ceaca8ce8449c0a0a955103d84dd979ebc232b577042ee3e2f6a5a99e976277cbe926a6f4e3929f072f69e086dfad6f9805f6c1bce6b5167ff01
|
7
|
+
data.tar.gz: 27ee91733374ae24fbb24fe26fa3692bd0a2afa22ebbd5a213431b51f55a84631b5e0d9fcaa8f30c1ccc15095afe090b94bbe7ff6a955e4f19120e3b2e9f942a
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: Tests
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby:
|
12
|
+
- "2.5"
|
13
|
+
- "2.6"
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
bundler: 1
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Install Graphviz
|
23
|
+
run: sudo apt -qq install graphviz
|
24
|
+
- name: Run tests
|
25
|
+
run: bundle exec rake spec
|
26
|
+
lint:
|
27
|
+
name: Lint Ruby
|
28
|
+
runs-on: ubuntu-latest
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v2
|
31
|
+
- name: rubocop
|
32
|
+
uses: reviewdog/action-rubocop@v1
|
33
|
+
with:
|
34
|
+
rubocop_version: 0.48.1
|
35
|
+
filter_mode: nofilter
|
36
|
+
fail_on_error: true
|
37
|
+
rubocop_extensions: ""
|
38
|
+
github_token: ${{ secrets.github_token }}
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -136,6 +136,14 @@ After checking out the repo, run `bin/setup` to install dependencies. You will a
|
|
136
136
|
|
137
137
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
138
138
|
|
139
|
+
### Bundled App
|
140
|
+
|
141
|
+
In order to maintain the features around umbrella apps and specially `changes`, a bundled [`umbrella app repo`](spec/fixtures/app.tgz) is included in this repository. This repo is compacted by `tar`/`gzip` in order to keep isolation, the format was chosen to avoid issues described in https://github.com/swcarpentry/git-novice/issues/272. To avoid the same issues, the workflow for this fixture app is the following:
|
142
|
+
|
143
|
+
1. unpack it somewhere outside your repo
|
144
|
+
1. do your changes and commit (locally only, it doesn't have a remote)
|
145
|
+
1. from within the app run `tar cfz path/to/cobra/spec/fixtures/app.tgz .`
|
146
|
+
|
139
147
|
## Contributing
|
140
148
|
|
141
149
|
Bug reports and pull requests are welcome on GitHub at https://github.com/powerhome/cobra_commander. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -49,8 +49,16 @@ module CobraCommander
|
|
49
49
|
@directly = @directly.sort_by(&:name)
|
50
50
|
end
|
51
51
|
|
52
|
+
def component_changed?(component)
|
53
|
+
component.root_paths.any? do |component_path|
|
54
|
+
@changes.any? do |file_path|
|
55
|
+
file_path.start_with?(component_path)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
52
60
|
def add_if_changed(component)
|
53
|
-
return
|
61
|
+
return unless component_changed?(component)
|
54
62
|
|
55
63
|
@directly << component
|
56
64
|
@transitively.merge(component.deep_dependents)
|
data/lib/cobra_commander/cli.rb
CHANGED
@@ -32,8 +32,8 @@ module CobraCommander
|
|
32
32
|
puts options.total ? components.size : CobraCommander::Output::FlatList.new(components).to_s
|
33
33
|
end
|
34
34
|
|
35
|
-
desc "exec [component] <command>", "Executes the command in the context of a given component or set
|
36
|
-
"
|
35
|
+
desc "exec [component] <command>", "Executes the command in the context of a given component or set thereof. " \
|
36
|
+
"Defaults to all components."
|
37
37
|
method_option :dependencies, type: :boolean, desc: "Run the command on each dependency of a given component"
|
38
38
|
method_option :dependents, type: :boolean, desc: "Run the command on each dependency of a given component"
|
39
39
|
def exec(command_or_component, command = nil)
|
@@ -4,11 +4,13 @@ module CobraCommander
|
|
4
4
|
# Execute commands on all components of a ComponentTree
|
5
5
|
module Executor
|
6
6
|
def self.exec(components, command, printer = $stdout)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
Bundler.with_original_env do
|
8
|
+
components.each do |component|
|
9
|
+
component.root_paths.each do |path|
|
10
|
+
printer.puts "===> #{component.name} (#{path})"
|
11
|
+
output, = Open3.capture2e(command, chdir: path)
|
12
|
+
printer.puts output
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobra_commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Langfeld
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-07-
|
13
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -172,6 +172,7 @@ extensions: []
|
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
174
|
- ".editorconfig"
|
175
|
+
- ".github/workflows/ci.yml"
|
175
176
|
- ".gitignore"
|
176
177
|
- ".rspec"
|
177
178
|
- ".rubocop.yml"
|