monoz 0.5.1 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6625aa97c175ce57eaff342c214f583d6ab09487d097b578ceedabfe6363cbdd
4
- data.tar.gz: 145ca2d3ac1e2d07fc4ec4a10b2e560ab7724d5544d270ce5ea3eb5ebbbdfbda
3
+ metadata.gz: a32f7cab2b3497cd922ecf25d69b22e38691000b3c159252cc2a858c7dc4e722
4
+ data.tar.gz: 41018578262df7e5d4af4889806bff2450923826a51fb43281ad180df330234b
5
5
  SHA512:
6
- metadata.gz: 8c59650aab90cb11f99e137433da29d74fa67de8ae9242edca28b8b68abb25b2358f3952bd47337a8ebb8cb97183b773890142905bbe81772c4a8dc7c72e16c5
7
- data.tar.gz: 250473dcdb394005cb58cd4413c7f2eb5103e4ce0935f098e4f85b6a8cebceb0be1789db1dda1f300422d3778d6f07f1929e1b93b0cacee73b574c36c6400416
6
+ metadata.gz: 26684e62c8a7cca445ab9a6b8e2720a5a662147ab2017e09ffc9fa51fdf8aaa20be1f4a0d62fcd5e5fee310b472cc885dd6fe2f37221bc54579fa287cf497455
7
+ data.tar.gz: 42dd417d6955edf51163a2430ec82621ab1cff11e530f7f9f020de54b546e1a831dc11a7a6849038010b048882f06e8359e566374fa40fb0849ddbdcdba44dcf
data/README.md CHANGED
@@ -172,7 +172,27 @@ example_com: bin/dev
172
172
  23:41:06 css.1 | Done in 354ms.
173
173
  ```
174
174
 
175
- ### Filtering projects
175
+ ## Actions
176
+ You can add custom actions to the `monoz.yml` file in the root directory of your project. Each action can be executed by running `monoz [ACTION]` on the command line.
177
+
178
+ To define a new action, add a new key under the actions section in the `monoz.yml` file. The key should be the name of the action, and its value should be a list of tasks to be executed.
179
+
180
+ Each task should have two keys: `in` and `run`. The `in` key specifies the projects in which the task should be executed. You can use the same filter syntax as when passing filters to the `--filter` option. The `run` key specifies the command to be executed.
181
+
182
+ Here's an example of a custom action that runs database migrations in all `apps`:
183
+
184
+ ```yaml
185
+ actions:
186
+ migrate:
187
+ - in: apps
188
+ run: bin/rails db:migrate
189
+ ```
190
+
191
+ To execute this action, simply run `monoz migrate` on the command line. This will run the `bin/rails db:migrate` command in all projects tagged as apps.
192
+
193
+ You can add as many custom actions as you like. Just make sure to follow the same format as in the example above.
194
+
195
+ ## Filters
176
196
 
177
197
  The `--filter` option in Monoz allows you to select certain projects based on specific criteria. This is useful if you only want to run a command on a specific subset of projects, rather than all of them. To use the `--filter` option, you simply specify a filter expression after the option. The filter expression is a comma-separated list of keywords that match the project names or tags in your Monoz configuration.
178
198
 
@@ -29,6 +29,19 @@ module Monoz
29
29
  say "The command ran successfully in all project directories without any errors.", [:green]
30
30
  end
31
31
 
32
+ desc "link", "Link gems to local directories in development."
33
+ def link
34
+ say "Linking gems to local directories by setting the source directory in bundle config", [:blue, :bold]
35
+ say "Please ensure you're not including ", :yellow
36
+ say ".bundle/config ", [:yellow, :bold]
37
+ say "file in your git repository by mistake", :yellow
38
+ say ""
39
+
40
+ Monoz::Services::BundleService.new(self).link_local_gems!(Monoz.projects)
41
+
42
+ say "Successfully linked all gem directories without any errors.", [:green]
43
+ end
44
+
32
45
  desc "projects", "Shows a list of projects in this repository"
33
46
  def projects
34
47
  Monoz.projects.order(:name).to_table
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Monoz
4
+ module Services
5
+ class BundleService < Monoz::Services::BaseService
6
+ def link_local_gems!(projects)
7
+ Monoz.projects.filter("gems").each do |gem|
8
+ command = "monoz bundle config local.#{gem.gem_name} #{gem.root_path}"
9
+ Monoz::Services::RunService.new(self).call(projects, *command.split(" "))
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -3,6 +3,7 @@
3
3
  require "yaml"
4
4
  require "fileutils"
5
5
  require "pty"
6
+ require "active_support/core_ext/array" # Import the necessary extension
6
7
 
7
8
  module Monoz
8
9
  module Responses
@@ -50,7 +51,7 @@ module Monoz
50
51
 
51
52
  say "Running ", nil, false
52
53
  say command.join(" "), [:bold], false
53
- say " in #{@projects.map { |p| p.name }.join(", ")}:"
54
+ say " in #{@projects.map { |p| p.name }.to_sentence}:"
54
55
 
55
56
  say ""
56
57
  run_commands
data/lib/monoz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Monoz
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.1"
3
3
  end
data/lib/monoz.rb CHANGED
@@ -14,6 +14,7 @@ module Monoz
14
14
  module Services
15
15
  autoload "ActionService", "monoz/services/action_service"
16
16
  autoload "BaseService", "monoz/services/base_service"
17
+ autoload "BundleService", "monoz/services/bundle_service"
17
18
  autoload "InitService", "monoz/services/init_service"
18
19
  autoload "RunService", "monoz/services/run_service"
19
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monoz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kjellberg
@@ -72,6 +72,7 @@ files:
72
72
  - lib/monoz/project_collection.rb
73
73
  - lib/monoz/services/action_service.rb
74
74
  - lib/monoz/services/base_service.rb
75
+ - lib/monoz/services/bundle_service.rb
75
76
  - lib/monoz/services/init_service.rb
76
77
  - lib/monoz/services/run_service.rb
77
78
  - lib/monoz/spinner.rb