monoz 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +99 -11
- data/bin/monoz +6 -2
- data/lib/monoz/application.rb +53 -0
- data/lib/monoz/project.rb +16 -23
- data/lib/monoz/project_collection.rb +28 -13
- data/lib/monoz/services/run_service.rb +102 -0
- data/lib/monoz/version.rb +1 -1
- data/lib/monoz.rb +42 -7
- metadata +4 -6
- data/lib/monoz/cli/inspect.rb +0 -27
- data/lib/monoz/cli/main.rb +0 -37
- data/lib/monoz/services/bundle_service.rb +0 -19
- data/lib/monoz/services/run_action_service.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e73d1688f568042f98029b57b070f6541c3a19ba0ae206c7f89a3ecb60dda061
|
4
|
+
data.tar.gz: 3f9a57bfc7abacf3bf67783e713d3e92bcc6bea586c0c8c53b1b298c3ecfc990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d5a0d391b17475e9a5d0a05a1bacf8815d5f8d23ed79608dabd1fd31c4df491dad9fa0f33c9ae058e69ffaaa1138a4c0def0cb4e5e1a752ff13281822191fd0
|
7
|
+
data.tar.gz: ae0449a70ae6c4b0a8474fd4d80fc8d39e26c4316b2a6191eccf16e3a6dc55bbc310902db0a0fae04423d35ca3421b8f016e3594dcb8a72df07b585c03483d26
|
data/README.md
CHANGED
@@ -57,6 +57,13 @@ To bundle all the projects in the Monoz repository, simply run:
|
|
57
57
|
|
58
58
|
```console
|
59
59
|
$ monoz bundle
|
60
|
+
|
61
|
+
kiqr_core: bundle ✓
|
62
|
+
content_api: bundle ✓
|
63
|
+
core_api: bundle ✓
|
64
|
+
kiqr_cloud: bundle ✓
|
65
|
+
|
66
|
+
The command ran successfully in all projects without any errors.
|
60
67
|
```
|
61
68
|
|
62
69
|
If you instead want to update the dependencies of your projects, you can use the `monoz bundle update` command. This command will update the `Gemfile.lock` file of each project based on the latest available versions of their dependencies.
|
@@ -71,27 +78,108 @@ Note that when you add a new dependency to a project, you'll need to run `monoz
|
|
71
78
|
|
72
79
|
#### Run other bundler commands
|
73
80
|
|
74
|
-
You can also run other bundler commands on all projects in the repository using the `monoz bundle` command followed by the desired arguments. For example, to run
|
81
|
+
You can also run other bundler commands on all projects in the repository using the `monoz bundle` command followed by the desired arguments. For example, to run Rubocop tests in all projects, you can use the following command:
|
75
82
|
|
76
83
|
```console
|
77
|
-
$ monoz bundle exec
|
84
|
+
$ monoz bundle exec rubocop
|
85
|
+
|
86
|
+
kiqr_core: bundle exec rubocop ✓
|
87
|
+
content_api: bundle exec rubocop ✗
|
88
|
+
Configuration file not found: /some/path/.rubocop.yml
|
78
89
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
90
|
+
core_api: bundle exec rubocop ✓
|
91
|
+
kiqr_cloud: bundle exec rubocop ✓
|
92
|
+
|
93
|
+
Error: The command bundle exec rubocop failed to run in one or more project directories
|
83
94
|
```
|
84
95
|
|
85
|
-
This will execute the `bundle exec
|
96
|
+
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
|
+
|
98
|
+
### Running commands in projects
|
99
|
+
|
100
|
+
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.
|
101
|
+
|
102
|
+
For example, to create an empty file named test.txt in the tmp/ directory of all projects, you can use the following command:
|
103
|
+
|
104
|
+
```console
|
105
|
+
$ monoz run touch tmp/test.txt
|
106
|
+
|
107
|
+
kiqr_core: touch tmp/test.txt ✓
|
108
|
+
content_api: touch tmp/test.txt ✓
|
109
|
+
core_api: touch tmp/test.txt ✓
|
110
|
+
kiqr_cloud: touch tmp/test.txt ✓
|
111
|
+
|
112
|
+
The command ran successfully in all projects without any errors.
|
113
|
+
```
|
114
|
+
|
115
|
+
This will execute the `touch tmp/test.txt` command in each project directory, creating the test.txt file in the tmp/ directory. If a command fails to run in a project directory, Monoz will display an error message with the output of the command.
|
116
|
+
|
117
|
+
Note that if you need to run a command in a specific project, you can simply navigate to the project directory and run the command as you would in a regular Ruby project. The monoz run command is primarily useful for running commands across one ore many projects in a Monoz repository at once.
|
118
|
+
|
119
|
+
### Run in foreground / interactive mode
|
120
|
+
|
121
|
+
You can run commands in interactive mode using the flag `--tty`, or `-t`:
|
122
|
+
|
123
|
+
```console
|
124
|
+
$ monoz run bin/dev --filter=example_com --tty
|
125
|
+
|
126
|
+
example_com: bin/dev
|
127
|
+
23:41:04 web.1 | started with pid 96841
|
128
|
+
23:41:04 css.1 | started with pid 96842
|
129
|
+
23:41:05 web.1 | => Booting Puma
|
130
|
+
23:41:05 web.1 | => Rails 7.0.4.3 application starting in development
|
131
|
+
23:41:05 web.1 | => Run `bin/rails server --help` for more startup options
|
132
|
+
23:41:06 web.1 | Puma starting in single mode...
|
133
|
+
23:41:06 web.1 | * Puma version: 5.6.5 (ruby 3.2.0-p0) ("Birdie's Version")
|
134
|
+
23:41:06 web.1 | * Min threads: 5
|
135
|
+
23:41:06 web.1 | * Max threads: 5
|
136
|
+
23:41:06 web.1 | * Environment: development
|
137
|
+
23:41:06 web.1 | * PID: 96841
|
138
|
+
23:41:06 web.1 | * Listening on http://127.0.0.1:3000
|
139
|
+
23:41:06 web.1 | * Listening on http://[::1]:3000
|
140
|
+
23:41:06 web.1 | Use Ctrl-C to stop
|
141
|
+
23:41:06 css.1 |
|
142
|
+
23:41:06 css.1 | Rebuilding...
|
143
|
+
23:41:06 css.1 |
|
144
|
+
23:41:06 css.1 | Done in 354ms.
|
145
|
+
```
|
146
|
+
|
147
|
+
### Filter projects
|
148
|
+
|
149
|
+
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
|
+
|
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:
|
152
|
+
|
153
|
+
```console
|
154
|
+
$ monoz bundle --filter=apps
|
155
|
+
```
|
156
|
+
|
157
|
+
Similarly, if you only want to list only gem projects, you can use the following command:
|
158
|
+
|
159
|
+
```console
|
160
|
+
$ monoz projects --filter=gems
|
161
|
+
```
|
162
|
+
|
163
|
+
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:
|
164
|
+
|
165
|
+
```console
|
166
|
+
$ monoz run mrsk deploy --filter="apps,apis"
|
167
|
+
```
|
168
|
+
|
169
|
+
Finally, you can also specify individual project names in the filter expression. For example, to run the `rubocop` command on only the **gem1** and **gem2** projects, you can use the following command:
|
170
|
+
|
171
|
+
```console
|
172
|
+
$ monoz run rubocop --filter="gem1,gem2"
|
173
|
+
```
|
86
174
|
|
87
|
-
###
|
175
|
+
### List projects
|
88
176
|
|
89
|
-
You can inspect the projects in your Monoz repository using the `monoz
|
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.
|
90
178
|
|
91
|
-
Here's an example output of the `monoz
|
179
|
+
Here's an example output of the `monoz projects` command:
|
92
180
|
|
93
181
|
```console
|
94
|
-
$ monoz
|
182
|
+
$ monoz projects
|
95
183
|
|
96
184
|
o---------------o--------o-------------o---------------------o-------------------------------------o
|
97
185
|
| Project | Type | Gem Name | Test Framework(s) | Dependants |
|
data/bin/monoz
CHANGED
@@ -4,8 +4,12 @@
|
|
4
4
|
require "monoz"
|
5
5
|
|
6
6
|
begin
|
7
|
-
Monoz::
|
7
|
+
Monoz::Application.start(ARGV)
|
8
8
|
rescue Monoz::Errors::ConfigurationNotFound
|
9
|
-
puts "This is not a valid Monoz directory."
|
9
|
+
puts "Error: This is not a valid Monoz directory."
|
10
10
|
puts "Run monoz init to initialize Monoz in the current directory."
|
11
|
+
exit(1)
|
12
|
+
rescue Monoz::Errors::StandardError => e
|
13
|
+
puts "Error: #{e.message}"
|
14
|
+
exit(1)
|
11
15
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require "yaml"
|
5
|
+
require "fileutils"
|
6
|
+
|
7
|
+
module Monoz
|
8
|
+
class Application < Thor
|
9
|
+
class_option :tty, type: :boolean, aliases: ["--verbose", "-t"], default: false
|
10
|
+
class_option :filter
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
Monoz.app = self
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "init [PATH]", "Initialize a monozrepo at the specified PATH"
|
18
|
+
def init(path = ".")
|
19
|
+
Monoz::Services::InitService.new(self).call(path)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "bundle [COMMAND]", "Run bundle commands in all projects"
|
23
|
+
def bundle(*command)
|
24
|
+
return help("bundle") if command.nil? || command.first == "help"
|
25
|
+
|
26
|
+
projects = Monoz.projects.order(:dependants)
|
27
|
+
Monoz::Services::RunService.new(self).call(projects, "bundle", *command)
|
28
|
+
|
29
|
+
say "The command ran successfully in all project directories without any errors.", [:green]
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "projects", "Shows a list of projects in this repository"
|
33
|
+
def projects
|
34
|
+
Monoz.projects.order(:name).to_table
|
35
|
+
end
|
36
|
+
|
37
|
+
map "run" => "run_action"
|
38
|
+
desc "run [COMMAND]", "Run commands in all projects"
|
39
|
+
def run_action(*command)
|
40
|
+
return help("run") if command.empty? || command.first == "help"
|
41
|
+
|
42
|
+
projects = Monoz.projects.order(:dependants)
|
43
|
+
Monoz::Services::RunService.new(self).call(projects, *command)
|
44
|
+
|
45
|
+
say "The command ran successfully in all project directories without any errors.", [:green]
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "version", "Get the current version of Monoz"
|
49
|
+
def version
|
50
|
+
say "Monoz version: #{Monoz::VERSION}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/monoz/project.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Monoz
|
4
4
|
class Project
|
5
|
-
attr_reader :name, :root_path, :gemspec, :type, :dependencies, :gem_name, :dependants
|
5
|
+
attr_reader :name, :root_path, :gemspec, :type, :dependencies, :gem_name, :dependants, :frameworks
|
6
6
|
|
7
7
|
def initialize(root_path)
|
8
8
|
@root_path = root_path
|
@@ -21,33 +21,27 @@ module Monoz
|
|
21
21
|
@root_path != nil && gemfile_path != nil
|
22
22
|
end
|
23
23
|
|
24
|
-
def run(*command)
|
25
|
-
FileUtils.chdir(root_path) do
|
26
|
-
system(*command)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
24
|
def text_color
|
31
25
|
is_gem? ? :green : :blue
|
32
26
|
end
|
33
27
|
|
34
|
-
|
35
|
-
|
28
|
+
private
|
29
|
+
def find_frameworks
|
30
|
+
frameworks = []
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
rspec_files = Dir.glob(File.join(@root_path, "**/*_spec.rb"))
|
33
|
+
if !rspec_files.empty?
|
34
|
+
frameworks << "rspec"
|
35
|
+
end
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
minitest_files = Dir.glob(File.join(@root_path, "test/**/*_test.rb"))
|
38
|
+
if !minitest_files.empty?
|
39
|
+
frameworks << "minitest"
|
40
|
+
end
|
46
41
|
|
47
|
-
|
48
|
-
|
42
|
+
frameworks
|
43
|
+
end
|
49
44
|
|
50
|
-
private
|
51
45
|
def parse_project_files
|
52
46
|
@gemspec = parse_gemspec
|
53
47
|
end
|
@@ -61,8 +55,7 @@ module Monoz
|
|
61
55
|
|
62
56
|
spec = Gem::Specification.load(gemspec_file)
|
63
57
|
{
|
64
|
-
name: spec.name
|
65
|
-
version: spec.version.to_s
|
58
|
+
name: spec.name
|
66
59
|
}
|
67
60
|
end
|
68
61
|
|
@@ -70,7 +63,7 @@ module Monoz
|
|
70
63
|
@name = File.basename(root_path)
|
71
64
|
@gem_name = @gemspec.dig(:name) if is_gem?
|
72
65
|
@type = is_gem? ? "gem" : "app"
|
73
|
-
@
|
66
|
+
@frameworks = find_frameworks
|
74
67
|
@dependants = []
|
75
68
|
end
|
76
69
|
|
@@ -51,27 +51,42 @@ module Monoz
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def filter(
|
55
|
-
if
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@items =
|
60
|
-
self
|
61
|
-
|
62
|
-
|
54
|
+
def filter(filters = [])
|
55
|
+
if filters.is_a?(String)
|
56
|
+
filters = filters.split(",").map(&:strip)
|
57
|
+
end
|
58
|
+
if filters.empty?
|
59
|
+
@items = []
|
60
|
+
return self
|
61
|
+
end
|
62
|
+
filtered_items = []
|
63
|
+
filters.each do |filter|
|
64
|
+
if filter == "gems"
|
65
|
+
filtered_items += @items.select { |i| i.type == "gem" }
|
66
|
+
elsif filter == "apps"
|
67
|
+
filtered_items += @items.select { |i| i.type == "app" }
|
68
|
+
else
|
69
|
+
project = find(filter)
|
70
|
+
if project
|
71
|
+
filtered_items << project
|
72
|
+
else
|
73
|
+
raise Monoz::Errors::StandardError.new("Invalid key: #{filter}")
|
74
|
+
end
|
75
|
+
end
|
63
76
|
end
|
77
|
+
@items = filtered_items.uniq
|
78
|
+
self
|
64
79
|
end
|
65
80
|
|
66
81
|
def to_table
|
67
82
|
rows = []
|
68
83
|
@items.each do |project|
|
69
|
-
rows << [project.name, project.type, project.gem_name, project.
|
84
|
+
rows << [project.name, project.type, project.gem_name, project.frameworks.join(", "), project.dependants.join(", ")]
|
70
85
|
end
|
71
86
|
table = Terminal::Table.new(
|
72
|
-
headings: ["Project", "Type", "Gem
|
73
|
-
rows
|
74
|
-
style: { padding_left: 2, padding_right: 2, border_i: "o" }
|
87
|
+
headings: ["Project", "Type", "Gem name", "Found Framework(s)", "Dependants"],
|
88
|
+
rows: rows,
|
89
|
+
style: { padding_left: 2, padding_right: 2, border_i: "o" }
|
75
90
|
)
|
76
91
|
puts table
|
77
92
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require "fileutils"
|
5
|
+
require "open3"
|
6
|
+
|
7
|
+
module Monoz
|
8
|
+
module Services
|
9
|
+
class RunService < Monoz::Services::BaseService
|
10
|
+
attr_reader :errors, :warnings
|
11
|
+
|
12
|
+
def initialize(thor_instance)
|
13
|
+
@projects = nil
|
14
|
+
@errors = []
|
15
|
+
@warnings = []
|
16
|
+
super(thor_instance)
|
17
|
+
end
|
18
|
+
|
19
|
+
def success?
|
20
|
+
!errors? && !warnings?
|
21
|
+
end
|
22
|
+
|
23
|
+
def errors?
|
24
|
+
@errors.any?
|
25
|
+
end
|
26
|
+
|
27
|
+
def warnings?
|
28
|
+
@warnings.any?
|
29
|
+
end
|
30
|
+
|
31
|
+
def call(projects, *command)
|
32
|
+
raise ArgumentError.new("Missing command") if command.empty?
|
33
|
+
|
34
|
+
if projects.is_a?(Monoz::ProjectCollection)
|
35
|
+
@projects = projects.all
|
36
|
+
elsif projects.is_a?(Monoz::Project)
|
37
|
+
@projects = [projects]
|
38
|
+
else
|
39
|
+
raise "Invalid projects"
|
40
|
+
end
|
41
|
+
|
42
|
+
@projects.each do |project|
|
43
|
+
say "#{project.name}: ", [:bold, :blue]
|
44
|
+
Monoz.tty? ? say(command.join(" ")) : say("#{command.join(" ")} ")
|
45
|
+
|
46
|
+
response = run_commands_in_project(project, *command)
|
47
|
+
|
48
|
+
if response.success?
|
49
|
+
say "\u2713", [:green, :bold] unless Monoz.tty? # Checkmark symbol in green and bold
|
50
|
+
else
|
51
|
+
say "\u2717", [:red, :bold] unless Monoz.tty? # Cross symbol in red
|
52
|
+
say response.output
|
53
|
+
say ""
|
54
|
+
@errors << {
|
55
|
+
project: project.name,
|
56
|
+
command: command.join(" "),
|
57
|
+
exit_code: response.exit_code,
|
58
|
+
output: response.output
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
say ""
|
64
|
+
|
65
|
+
if errors?
|
66
|
+
say "Error: The command ", :red
|
67
|
+
say "#{command.join(" ")} ", [:red, :bold]
|
68
|
+
say "failed to run in one or more project directories", [:red]
|
69
|
+
exit(1)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
def run_commands_in_project(project, *command)
|
75
|
+
raise ArgumentError.new("Invalid command") if command.empty?
|
76
|
+
|
77
|
+
output = ""
|
78
|
+
exit_status = nil
|
79
|
+
|
80
|
+
FileUtils.chdir(project.root_path) do
|
81
|
+
if Monoz.tty?
|
82
|
+
Open3.popen2e(*command.map { |arg| Shellwords.escape(arg) }) do |stdin, stdout_err, wait_thr|
|
83
|
+
while line = stdout_err.gets
|
84
|
+
output += line
|
85
|
+
print line
|
86
|
+
end
|
87
|
+
|
88
|
+
exit_status = wait_thr.value.exitstatus
|
89
|
+
end
|
90
|
+
|
91
|
+
say ""
|
92
|
+
else
|
93
|
+
output, status = Open3.capture2e(*command.map { |arg| Shellwords.escape(arg) })
|
94
|
+
exit_status = status.exitstatus
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
return Monoz::Responses::CaptureRunResponse.new(output, exit_status)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/lib/monoz/version.rb
CHANGED
data/lib/monoz.rb
CHANGED
@@ -3,36 +3,71 @@
|
|
3
3
|
require_relative "monoz/version"
|
4
4
|
|
5
5
|
require "pathname"
|
6
|
+
require "shellwords"
|
6
7
|
|
7
8
|
module Monoz
|
8
9
|
module Errors
|
10
|
+
class StandardError < StandardError; end
|
9
11
|
class ConfigurationNotFound < StandardError; end
|
10
12
|
end
|
11
13
|
|
12
|
-
module
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
module Responses
|
15
|
+
class CaptureRunResponse
|
16
|
+
attr_reader :output, :exit_code
|
17
|
+
|
18
|
+
def initialize(output, exit_code)
|
19
|
+
@output = output
|
20
|
+
@exit_code = exit_code
|
21
|
+
end
|
22
|
+
|
23
|
+
def success?
|
24
|
+
exit_code == 0
|
25
|
+
end
|
26
|
+
|
27
|
+
def error?
|
28
|
+
exit_code == 1
|
29
|
+
end
|
30
|
+
end
|
16
31
|
end
|
17
32
|
|
18
33
|
module Services
|
19
34
|
autoload "BaseService", "monoz/services/base_service"
|
20
|
-
autoload "BundleService", "monoz/services/bundle_service"
|
21
35
|
autoload "InitService", "monoz/services/init_service"
|
22
|
-
autoload "
|
36
|
+
autoload "RunService", "monoz/services/run_service"
|
23
37
|
end
|
24
38
|
|
39
|
+
autoload "Application", "monoz/application"
|
25
40
|
autoload "Configuration", "monoz/configuration"
|
26
41
|
autoload "Project", "monoz/project"
|
27
42
|
autoload "ProjectCollection", "monoz/project_collection"
|
28
43
|
|
29
44
|
class << self
|
45
|
+
def app
|
46
|
+
@app
|
47
|
+
end
|
48
|
+
|
49
|
+
def app=(value)
|
50
|
+
@app = value
|
51
|
+
end
|
52
|
+
|
30
53
|
def config
|
31
54
|
@config ||= Monoz::Configuration.new(pwd)
|
32
55
|
end
|
33
56
|
|
57
|
+
def options
|
58
|
+
@app&.options
|
59
|
+
end
|
60
|
+
|
61
|
+
def tty?
|
62
|
+
Monoz.options.dig("tty") == true
|
63
|
+
end
|
64
|
+
|
34
65
|
def projects
|
35
|
-
Monoz
|
66
|
+
filter = Monoz.options&.dig("filter")
|
67
|
+
projects = Monoz::ProjectCollection.new(config.root_path)
|
68
|
+
projects = projects.filter(filter) unless filter.nil?
|
69
|
+
|
70
|
+
projects
|
36
71
|
end
|
37
72
|
|
38
73
|
def pwd
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kjellberg
|
@@ -64,15 +64,13 @@ files:
|
|
64
64
|
- README.md
|
65
65
|
- bin/monoz
|
66
66
|
- lib/monoz.rb
|
67
|
-
- lib/monoz/
|
68
|
-
- lib/monoz/cli/main.rb
|
67
|
+
- lib/monoz/application.rb
|
69
68
|
- lib/monoz/configuration.rb
|
70
69
|
- lib/monoz/project.rb
|
71
70
|
- lib/monoz/project_collection.rb
|
72
71
|
- lib/monoz/services/base_service.rb
|
73
|
-
- lib/monoz/services/bundle_service.rb
|
74
72
|
- lib/monoz/services/init_service.rb
|
75
|
-
- lib/monoz/services/
|
73
|
+
- lib/monoz/services/run_service.rb
|
76
74
|
- lib/monoz/version.rb
|
77
75
|
homepage: https://github.com/kjellberg/monoz
|
78
76
|
licenses:
|
@@ -89,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
87
|
requirements:
|
90
88
|
- - ">="
|
91
89
|
- !ruby/object:Gem::Version
|
92
|
-
version: 2.
|
90
|
+
version: 2.7.0
|
93
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
92
|
requirements:
|
95
93
|
- - ">="
|
data/lib/monoz/cli/inspect.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "thor"
|
4
|
-
require "yaml"
|
5
|
-
|
6
|
-
module Monoz
|
7
|
-
module Cli
|
8
|
-
class Inspect < Thor
|
9
|
-
default_task :all
|
10
|
-
|
11
|
-
desc "all", "Returns a list of all projects in this monozrepo"
|
12
|
-
def all
|
13
|
-
Monoz.projects.order(:name).to_table
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "apps", "Returns a list of apps in this monozrepo"
|
17
|
-
def apps
|
18
|
-
Monoz.projects.order(:name).filter(:apps).to_table
|
19
|
-
end
|
20
|
-
|
21
|
-
desc "gems", "Returns a list of gems in this monozrepo"
|
22
|
-
def gems
|
23
|
-
Monoz.projects.filter(:gems).order(:name).to_table
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/monoz/cli/main.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "thor"
|
4
|
-
require "yaml"
|
5
|
-
require "fileutils"
|
6
|
-
|
7
|
-
module Monoz
|
8
|
-
module Cli
|
9
|
-
class Main < Thor
|
10
|
-
desc "init [PATH]", "Initialize a monozrepo at the specified PATH"
|
11
|
-
def init(path = ".")
|
12
|
-
Monoz::Services::InitService.new(self).call(path)
|
13
|
-
end
|
14
|
-
|
15
|
-
desc "bundle [COMMAND]", "Run bundle commands in all projects"
|
16
|
-
def bundle(*command)
|
17
|
-
Monoz::Services::BundleService.new(self).call(*command)
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "inspect", "Inspect this monozrepo"
|
21
|
-
subcommand "inspect", Monoz::Cli::Inspect
|
22
|
-
|
23
|
-
map "run" => "run_action"
|
24
|
-
desc "run [action]", "Run commands in all projects"
|
25
|
-
def run_action(keys = nil)
|
26
|
-
return help("run") if keys.nil? || keys == "help"
|
27
|
-
|
28
|
-
Monoz::Services::RunActionService.new(self).call(keys)
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "version", "Get the current version of Monoz"
|
32
|
-
def version
|
33
|
-
say "Monoz version: #{Monoz::VERSION}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "yaml"
|
4
|
-
require "fileutils"
|
5
|
-
require "active_support"
|
6
|
-
|
7
|
-
module Monoz
|
8
|
-
module Services
|
9
|
-
class BundleService < Monoz::Services::BaseService
|
10
|
-
def call(*command)
|
11
|
-
Monoz.projects.order(:dependants).each do |project|
|
12
|
-
say "[#{project.name}] ", [:blue, :bold], false
|
13
|
-
say("bundle #{command.join(" ")}".strip, :green)
|
14
|
-
project.run "bundle", *command
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "yaml"
|
4
|
-
require "fileutils"
|
5
|
-
|
6
|
-
module Monoz
|
7
|
-
module Services
|
8
|
-
class RunActionService < Monoz::Services::BaseService
|
9
|
-
def call(keys = nil)
|
10
|
-
action = Monoz.config.dig("actions", *keys)
|
11
|
-
|
12
|
-
if action.nil?
|
13
|
-
say "Invalid action: ", :red, false
|
14
|
-
say keys, [:red, :bold]
|
15
|
-
exit 0
|
16
|
-
end
|
17
|
-
|
18
|
-
pp action
|
19
|
-
# Monoz.projects.order(:dependants).each do |project|
|
20
|
-
# project.run "ls"
|
21
|
-
# end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|