monoz 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e73d1688f568042f98029b57b070f6541c3a19ba0ae206c7f89a3ecb60dda061
4
- data.tar.gz: 3f9a57bfc7abacf3bf67783e713d3e92bcc6bea586c0c8c53b1b298c3ecfc990
3
+ metadata.gz: 8690b4b3d6adc785adfa22b77c24f72fb2524aa57f337b9d58723b29d9c95e37
4
+ data.tar.gz: ffce67da4773d0a25c7c0844fcbe35e5ee21b6e8aff7ada1541e5cf7fdaf6feb
5
5
  SHA512:
6
- metadata.gz: 4d5a0d391b17475e9a5d0a05a1bacf8815d5f8d23ed79608dabd1fd31c4df491dad9fa0f33c9ae058e69ffaaa1138a4c0def0cb4e5e1a752ff13281822191fd0
7
- data.tar.gz: ae0449a70ae6c4b0a8474fd4d80fc8d39e26c4316b2a6191eccf16e3a6dc55bbc310902db0a0fae04423d35ca3421b8f016e3594dcb8a72df07b585c03483d26
6
+ metadata.gz: bf09e686e3baddbe8bb618d7372044f0d862a0cbe2b2f787490d98b8d5dce1f40d0c78891c4a910c1d162c3998586d9d96e24671c49a8ea6f23b54d6a4f4fe2d
7
+ data.tar.gz: 21015ca0dbdf5b9ac345043415156003c1ed02e46244b0ca6f20858a8d9b9d99d35060d6f23a4f44ca9076c2ece7f6868466b0a73bbe660336de79284340f95d
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Monoz is a command-line tool that helps you manage your **ruby** monorepo. It provides an easy way to manage multiple related **ruby** projects and their dependencies in a single repository. Monoz helps you keep track of your projects and their interdependencies, making it easier to maintain and scale your codebase.
4
4
 
5
- ## Installation
5
+ ## Getting started
6
6
 
7
7
  You can install Monoz by running the following command:
8
8
 
@@ -10,8 +10,6 @@ You can install Monoz by running the following command:
10
10
  $ gem install monoz
11
11
  ```
12
12
 
13
- ## Getting started
14
-
15
13
  To initialize a Monoz repository in the current directory, simply run:
16
14
 
17
15
  ```console
@@ -29,7 +27,9 @@ This will create a new Monoz repo with the following structure:
29
27
  └── monoz.yml
30
28
  ```
31
29
 
32
- ### Adding projects
30
+ ## Projects
31
+
32
+ ### Add a project
33
33
 
34
34
  Once you've initialized your Monoz repository, you can start adding projects to it.
35
35
 
@@ -72,6 +72,13 @@ To update the dependencies of all projects in the Monoz repository, simply run:
72
72
 
73
73
  ```console
74
74
  $ monoz bundle update
75
+
76
+ kiqr_core: bundle update ✓
77
+ content_api: bundle update ✓
78
+ core_api: bundle update ✓
79
+ kiqr_cloud: bundle update ✓
80
+
81
+ The command ran successfully in all projects without any errors.
75
82
  ```
76
83
 
77
84
  Note that when you add a new dependency to a project, you'll need to run `monoz bundle` to update its `Gemfile.lock` file before you can use the new dependency. Similarly, if you update the dependencies of a project's `Gemfile`, you'll need to run `monoz bundle` to update its `Gemfile.lock` file with the new versions.
@@ -95,6 +102,27 @@ Error: The command bundle exec rubocop failed to run in one or more project dire
95
102
 
96
103
  This will execute the `bundle exec rubocop` command in each project directory, ensuring that all the necessary dependencies are installed and loaded for each project. Similarly, you can run other bundler commands such as `bundle install`, `bundle update`, and so on, by appending the desired arguments to the `monoz bundle` command.
97
104
 
105
+ ### List projects
106
+
107
+ You can inspect the projects in your Monoz repository using the `monoz projects` command. This command will display a table that shows the projects in the repository, their type (app or gem), the gem name (if it's a gem), the test framework(s) used, and the projects that depend on them.
108
+
109
+ Here's an example output of the `monoz projects` command:
110
+
111
+ ```console
112
+ $ monoz projects
113
+
114
+ o---------------o--------o-------------o---------------------o-------------------------------------o
115
+ | Project | Type | Gem Name | Test Framework(s) | Dependants |
116
+ o---------------o--------o-------------o---------------------o-------------------------------------o
117
+ | content_api | app | | rspec | |
118
+ | core_api | app | | rspec | |
119
+ | kiqr_cloud | app | | rspec | |
120
+ | kiqr_core | gem | kiqr_core | rspec | content_api, core_api, kiqr_cloud |
121
+ o---------------o--------o-------------o---------------------o-------------------------------------o
122
+ ```
123
+
124
+ ## Runing commands
125
+
98
126
  ### Running commands in projects
99
127
 
100
128
  You can run any command in all projects of your Monoz repository using the `monoz run` command. Simply provide the command you want to run as an argument, and Monoz will execute it in each project directory.
@@ -144,20 +172,32 @@ example_com: bin/dev
144
172
  23:41:06 css.1 | Done in 354ms.
145
173
  ```
146
174
 
147
- ### Filter projects
175
+ ### Filtering projects
148
176
 
149
177
  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.
150
178
 
151
- For example, suppose you have a Monoz configuration with several projects, some of which are tagged as **apps** and some of which are tagged as **gems**. You can use the "--filter" option to select only the **apps** projects by running the following command:
179
+ For example, suppose you have a Monoz configuration with several projects, some of which are tagged as **apps** and some of which are tagged as **gems**. You can use the `--filter` option to select only the **apps** projects by running the following command:
152
180
 
153
181
  ```console
154
182
  $ monoz bundle --filter=apps
183
+
184
+ content_api: bundle ✓
185
+ core_api: bundle ✓
186
+ kiqr_cloud: bundle ✓
187
+
188
+ The command ran successfully in all project directories without any errors.
155
189
  ```
156
190
 
157
191
  Similarly, if you only want to list only gem projects, you can use the following command:
158
192
 
159
193
  ```console
160
194
  $ monoz projects --filter=gems
195
+
196
+ o-------------o--------o-------------o----------------------o-------------------------------------o
197
+ | Project | Type | Gem name | Found Framework(s) | Dependants |
198
+ o-------------o--------o-------------o----------------------o-------------------------------------o
199
+ | kiqr_core | gem | kiqr_core | rspec | content_api, core_api, kiqr_cloud |
200
+ o-------------o--------o-------------o----------------------o-------------------------------------o
161
201
  ```
162
202
 
163
203
  You can also use multiple keywords in the filter expression to select projects that match any of the keywords. For example, to run the `mrsk deploy` command on all **apps** and **apis** projects, you can use the following command:
@@ -172,25 +212,6 @@ Finally, you can also specify individual project names in the filter expression.
172
212
  $ monoz run rubocop --filter="gem1,gem2"
173
213
  ```
174
214
 
175
- ### List projects
176
-
177
- You can inspect the projects in your Monoz repository using the `monoz projects` command. This command will display a table that shows the projects in the repository, their type (app or gem), the gem name (if it's a gem), the test framework(s) used, and the projects that depend on them.
178
-
179
- Here's an example output of the `monoz projects` command:
180
-
181
- ```console
182
- $ monoz projects
183
-
184
- o---------------o--------o-------------o---------------------o-------------------------------------o
185
- | Project | Type | Gem Name | Test Framework(s) | Dependants |
186
- o---------------o--------o-------------o---------------------o-------------------------------------o
187
- | content_api | app | | rspec | |
188
- | core_api | app | | rspec | |
189
- | kiqr_cloud | app | | rspec | |
190
- | kiqr_core | gem | kiqr_core | rspec | content_api, core_api, kiqr_cloud |
191
- o---------------o--------o-------------o---------------------o-------------------------------------o
192
- ```
193
-
194
215
  ## Contributing
195
216
  We welcome contributions from everyone! If you're interested in contributing to Monoz, please check out our contributing guidelines for more information.
196
217
 
@@ -5,6 +5,67 @@ require "fileutils"
5
5
  require "open3"
6
6
 
7
7
  module Monoz
8
+ class Spinner
9
+ include Thor::Shell
10
+
11
+ def initialize(message, prefix: nil)
12
+ @spinner = nil
13
+ @message = message
14
+ @prefix = prefix
15
+ end
16
+
17
+ def start
18
+ @spinner = main
19
+ self
20
+ end
21
+
22
+ def success!
23
+ @spinner.kill
24
+ say_formatted(" \u2713 ", [:bold, :green])
25
+ say() # line break
26
+ end
27
+
28
+ def error!
29
+ @spinner.kill
30
+ say_formatted(" \u2717 ", [:bold, :red])
31
+ say() # line break
32
+ end
33
+
34
+ private
35
+ def reset
36
+ say("\r", nil, false)
37
+ end
38
+
39
+ def say_formatted(suffix, suffix_formatting = nil)
40
+ if @prefix != nil
41
+ say "\r[#{@prefix}] ", [:blue, :bold], nil
42
+ say @message, nil, false
43
+ say suffix, suffix_formatting, false
44
+ else
45
+ say "\r#{@message}", nil, false
46
+ say suffix, suffix_formatting, false
47
+ end
48
+ end
49
+
50
+ def main
51
+ spinner_count = 0
52
+
53
+ Thread.new do
54
+ loop do
55
+ dots = case spinner_count % 3
56
+ when 0 then "."
57
+ when 1 then ".."
58
+ when 2 then "..."
59
+ end
60
+
61
+ say_formatted(dots)
62
+ spinner_count += 1
63
+ sleep(0.5)
64
+ end
65
+ end
66
+ end
67
+ end
68
+
8
69
  module Services
9
70
  class RunService < Monoz::Services::BaseService
10
71
  attr_reader :errors, :warnings
@@ -40,17 +101,24 @@ module Monoz
40
101
  end
41
102
 
42
103
  @projects.each do |project|
43
- say "#{project.name}: ", [:bold, :blue]
44
- Monoz.tty? ? say(command.join(" ")) : say("#{command.join(" ")} ")
104
+ # say "#{project.name}: ", [:bold, :blue]
105
+ # Monoz.tty? ? say(command.join(" ")) : say("#{command.join(" ")} ")
106
+
107
+ if Monoz.tty?
108
+ say "[#{project.name}] ", [:blue, :bold], nil
109
+ say command.join(" ")
110
+ else
111
+ spinner = Monoz::Spinner.new(command.join(" "), prefix: project.name).start
112
+ end
45
113
 
46
114
  response = run_commands_in_project(project, *command)
47
115
 
48
116
  if response.success?
49
- say "\u2713", [:green, :bold] unless Monoz.tty? # Checkmark symbol in green and bold
117
+ spinner.success! unless Monoz.tty?
50
118
  else
51
- say "\u2717", [:red, :bold] unless Monoz.tty? # Cross symbol in red
119
+ spinner.error! unless Monoz.tty?
52
120
  say response.output
53
- say ""
121
+ say "" # line break
54
122
  @errors << {
55
123
  project: project.name,
56
124
  command: command.join(" "),
data/lib/monoz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Monoz
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monoz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kjellberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor