squared 0.2.12 → 0.2.14
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/CHANGELOG.md +56 -24
- data/README.md +311 -1280
- data/lib/squared/common/base.rb +1 -1
- data/lib/squared/common/format.rb +2 -2
- data/lib/squared/common/system.rb +1 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +19 -15
- data/lib/squared/workspace/project/base.rb +35 -7
- data/lib/squared/workspace/project/node.rb +9 -4
- data/squared.gemspec +4 -4
- metadata +5 -6
- data/README.ruby.md +0 -384
data/lib/squared/common/base.rb
CHANGED
@@ -127,11 +127,11 @@ module Squared
|
|
127
127
|
def apply_style(data, key, args, empty: true)
|
128
128
|
return if data.is_a?(::Symbol) && (data = __get__(:theme)[data]).nil?
|
129
129
|
|
130
|
-
set = ->(k, v) { data[k] = check_style(v, empty: empty) }
|
130
|
+
set = ->(k, v) { data[k.to_sym] = check_style(v, empty: empty) }
|
131
131
|
if key.is_a?(::Hash)
|
132
132
|
key.each { |k, v| set.(k, v || args) }
|
133
133
|
else
|
134
|
-
set.(key
|
134
|
+
set.(key, args)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
data/lib/squared/version.rb
CHANGED
@@ -589,9 +589,14 @@ module Squared
|
|
589
589
|
private
|
590
590
|
|
591
591
|
def __build__(default: nil, **)
|
592
|
-
|
593
|
-
|
594
|
-
|
592
|
+
unless task_defined?('squared:version')
|
593
|
+
task 'squared:version' do
|
594
|
+
puts Squared::VERSION
|
595
|
+
end
|
596
|
+
end
|
597
|
+
if default && task_defined?(out = task_name(default))
|
598
|
+
task Rake.application.default_task_name => out
|
599
|
+
end
|
595
600
|
end
|
596
601
|
|
597
602
|
def puts(*args)
|
@@ -627,20 +632,19 @@ module Squared
|
|
627
632
|
end
|
628
633
|
|
629
634
|
def data_get(*args, group: nil, ref: nil, target: nil)
|
630
|
-
if group
|
631
|
-
|
632
|
-
elsif ref
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
ref.each do |key|
|
637
|
-
next unless (ret = target[:ref][key])
|
635
|
+
if group && (ret = target[:group][group.to_sym])
|
636
|
+
ret
|
637
|
+
elsif ref
|
638
|
+
if ref.is_a?(Enumerable)
|
639
|
+
ref.each do |key|
|
640
|
+
next unless (ret = target[:ref][key])
|
638
641
|
|
639
|
-
|
642
|
+
return ret if args.empty? || args.any? { |val| ret.key?(val) }
|
643
|
+
end
|
644
|
+
nil
|
645
|
+
else
|
646
|
+
target[:ref][ref]
|
640
647
|
end
|
641
|
-
nil
|
642
|
-
elsif ref
|
643
|
-
target[:ref][ref]
|
644
648
|
end
|
645
649
|
end
|
646
650
|
|
@@ -15,7 +15,7 @@ module Squared
|
|
15
15
|
include Rake::DSL
|
16
16
|
|
17
17
|
VAR_SET = %i[parent global envname dependfile theme run script env pass].freeze
|
18
|
-
SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+)(\S+)
|
18
|
+
SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?[-.]?(\S+)?\b/.freeze
|
19
19
|
private_constant :VAR_SET, :SEM_VER
|
20
20
|
|
21
21
|
class << self
|
@@ -245,7 +245,7 @@ module Squared
|
|
245
245
|
flags.each do |flag|
|
246
246
|
case action
|
247
247
|
when 'graph'
|
248
|
-
|
248
|
+
break unless graph?
|
249
249
|
|
250
250
|
check = lambda do |args|
|
251
251
|
next args if (args = args.to_a).empty?
|
@@ -745,7 +745,7 @@ module Squared
|
|
745
745
|
done
|
746
746
|
end
|
747
747
|
|
748
|
-
def graph_collect(target, start = [], data: {})
|
748
|
+
def graph_collect(target, start = [], data: {}, root: [])
|
749
749
|
deps = []
|
750
750
|
(start.empty? ? target.instance_variable_get(:@graph) : start)&.each do |val|
|
751
751
|
if (obj = workspace.find(name: val))
|
@@ -756,14 +756,19 @@ module Squared
|
|
756
756
|
items = workspace.find(group: val, ref: val.to_sym)
|
757
757
|
end
|
758
758
|
items.each do |proj|
|
759
|
-
|
760
|
-
|
759
|
+
name = proj.name
|
760
|
+
if proj.graph? && !data.key?(name) && !root.include?(name)
|
761
|
+
graph_collect(proj, data: data, root: root + [name, target.name])
|
762
|
+
end
|
763
|
+
next if (objs = data.fetch(name, [])).include?(target)
|
761
764
|
|
762
765
|
deps << proj
|
763
|
-
deps
|
766
|
+
deps.concat(objs)
|
764
767
|
end
|
765
768
|
end
|
766
|
-
|
769
|
+
deps.uniq!
|
770
|
+
deps.delete(target)
|
771
|
+
data[target.name] = deps
|
767
772
|
data
|
768
773
|
end
|
769
774
|
|
@@ -1076,6 +1081,29 @@ module Squared
|
|
1076
1081
|
fill ? semver(ret) : ret
|
1077
1082
|
end
|
1078
1083
|
|
1084
|
+
def semcmp(val, other)
|
1085
|
+
return 0 if val == other
|
1086
|
+
|
1087
|
+
a, b = [val, other].map! { |ver| ver.scan(SEM_VER) }
|
1088
|
+
return -1 if b.empty?
|
1089
|
+
return 1 if a.empty?
|
1090
|
+
|
1091
|
+
a, b = [a.first, b.first].map! do |c|
|
1092
|
+
begin
|
1093
|
+
d = Integer(c[5]).to_s
|
1094
|
+
rescue StandardError
|
1095
|
+
d = c[5] ? '-1' : '0'
|
1096
|
+
end
|
1097
|
+
[c[0], c[2], c[4] || '0', d]
|
1098
|
+
end
|
1099
|
+
a.each_with_index do |c, index|
|
1100
|
+
next if c == (d = b[index])
|
1101
|
+
|
1102
|
+
return c.to_i < d.to_i ? 1 : -1
|
1103
|
+
end
|
1104
|
+
0
|
1105
|
+
end
|
1106
|
+
|
1079
1107
|
def indexitem(val)
|
1080
1108
|
[$1.to_i, $2 && $2[1..-1]] if val =~ /\A#{Regexp.escape(indexchar)}(\d+)(:.+)?\z/
|
1081
1109
|
end
|
@@ -512,15 +512,18 @@ module Squared
|
|
512
512
|
when :major
|
513
513
|
if seg[0] != '0' || seg[2].nil?
|
514
514
|
seg[0] = seg[0].succ
|
515
|
+
seg[2] = '0'
|
515
516
|
else
|
516
517
|
seg[2] = seg[2].succ
|
517
518
|
end
|
519
|
+
seg[4] = '0'
|
518
520
|
when :minor
|
519
521
|
if seg[0] == '0'
|
520
522
|
seg[4] &&= seg[4].succ
|
521
523
|
else
|
522
524
|
seg[2] = seg[2].succ
|
523
525
|
end
|
526
|
+
seg[4] = '0'
|
524
527
|
when :patch
|
525
528
|
seg[4] &&= seg[4].succ
|
526
529
|
end
|
@@ -690,7 +693,7 @@ module Squared
|
|
690
693
|
def read_packagemanager(key = nil, version: nil, update: false)
|
691
694
|
if @pm[:_].nil? || update
|
692
695
|
doc = JSON.parse(dependfile.read)
|
693
|
-
@pm[:_] = (val = doc['packageManager']) ? val[0
|
696
|
+
@pm[:_] = (val = doc['packageManager']) ? val[0, val.index('+') || val.size] : false
|
694
697
|
@pm[:name] = doc['name']
|
695
698
|
@pm[:scripts] = doc['scripts']
|
696
699
|
@pm[:version] = doc['version']
|
@@ -701,9 +704,11 @@ module Squared
|
|
701
704
|
@pm[:_] = false
|
702
705
|
nil
|
703
706
|
else
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
+
if key
|
708
|
+
@pm[key]
|
709
|
+
elsif (ret = @pm[:_]) && !(version && semcmp(ret[(ret.index('@') + 1)..-1], version) == 1)
|
710
|
+
ret
|
711
|
+
end
|
707
712
|
end
|
708
713
|
|
709
714
|
def read_install
|
data/squared.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
version = File.read(File.join(__dir__, "lib/squared/version.rb"))[/\bVERSION = '(.+)'$/, 1]
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "squared"
|
7
|
-
spec.version =
|
7
|
+
spec.version = version
|
8
8
|
spec.authors = ["An Pham"]
|
9
9
|
spec.email = ["anpham6@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = %q{Rake task generator for managing multi-language workspaces.}
|
12
12
|
spec.description = %q{Rake task generator for managing multi-language workspaces.}
|
13
|
-
spec.homepage = "https://github.com/anpham6/squared"
|
13
|
+
spec.homepage = "https://github.com/anpham6/squared-ruby"
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
15
15
|
spec.licenses = ["BSD-3-Clause"]
|
16
16
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.metadata["documentation_uri"] = "https://squared.readthedocs.io"
|
20
20
|
|
21
21
|
spec.files = Dir["lib/**/*"] +
|
22
|
-
%w[CHANGELOG.md LICENSE README.md
|
22
|
+
%w[CHANGELOG.md LICENSE README.md squared.gemspec]
|
23
23
|
spec.bindir = "exe"
|
24
24
|
spec.executables = []
|
25
25
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
@@ -75,7 +75,6 @@ files:
|
|
75
75
|
- CHANGELOG.md
|
76
76
|
- LICENSE
|
77
77
|
- README.md
|
78
|
-
- README.ruby.md
|
79
78
|
- lib/squared.rb
|
80
79
|
- lib/squared/app.rb
|
81
80
|
- lib/squared/common.rb
|
@@ -99,12 +98,12 @@ files:
|
|
99
98
|
- lib/squared/workspace/repo.rb
|
100
99
|
- lib/squared/workspace/series.rb
|
101
100
|
- squared.gemspec
|
102
|
-
homepage: https://github.com/anpham6/squared
|
101
|
+
homepage: https://github.com/anpham6/squared-ruby
|
103
102
|
licenses:
|
104
103
|
- BSD-3-Clause
|
105
104
|
metadata:
|
106
|
-
homepage_uri: https://github.com/anpham6/squared
|
107
|
-
source_code_uri: https://github.com/anpham6/squared
|
105
|
+
homepage_uri: https://github.com/anpham6/squared-ruby
|
106
|
+
source_code_uri: https://github.com/anpham6/squared-ruby
|
108
107
|
documentation_uri: https://squared.readthedocs.io
|
109
108
|
rdoc_options: []
|
110
109
|
require_paths:
|
@@ -120,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
119
|
- !ruby/object:Gem::Version
|
121
120
|
version: '0'
|
122
121
|
requirements: []
|
123
|
-
rubygems_version: 3.6.
|
122
|
+
rubygems_version: 3.6.9
|
124
123
|
specification_version: 4
|
125
124
|
summary: Rake task generator for managing multi-language workspaces.
|
126
125
|
test_files: []
|
data/README.ruby.md
DELETED
@@ -1,384 +0,0 @@
|
|
1
|
-
# squared 0.2
|
2
|
-
|
3
|
-
* [source](https://github.com/anpham6/squared)
|
4
|
-
* [manifest](https://github.com/anpham6/squared-repo)
|
5
|
-
* [docs](https://squared.readthedocs.io)
|
6
|
-
|
7
|
-
## Version Compatibility
|
8
|
-
|
9
|
-
| Date | squared | Min | Max |
|
10
|
-
| :--------: | ------: | -----: | -----: |
|
11
|
-
| 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 |
|
12
|
-
| 2025-01-07 | 0.2.0 | 2.4.0 | 3.4.0 |
|
13
|
-
|
14
|
-
The range chart indicates the latest Ruby tested against at the time of release.
|
15
|
-
|
16
|
-
## Installation
|
17
|
-
|
18
|
-
```sh
|
19
|
-
gem install squared
|
20
|
-
```
|
21
|
-
|
22
|
-
### Optional
|
23
|
-
|
24
|
-
* [Repo](https://source.android.com/docs/setup/reference/repo)
|
25
|
-
* Python 3.6
|
26
|
-
* Not compatible with Windows
|
27
|
-
|
28
|
-
```sh
|
29
|
-
mkdir -p ~/.bin
|
30
|
-
PATH="${HOME}/.bin:${PATH}"
|
31
|
-
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
|
32
|
-
chmod a+rx ~/.bin/repo
|
33
|
-
```
|
34
|
-
|
35
|
-
## Example - Rakefile
|
36
|
-
|
37
|
-
Projects from any accessible folder can be added relative to the parent directory (e.g. *REPO_ROOT*) or absolutely. The same Rakefile can also manage other similarly cloned `Repo` repositories remotely by setting the `REPO_ROOT` environment variable to the location. Missing projects will simply be excluded from the task runner.
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
require "squared"
|
41
|
-
|
42
|
-
require "squared/workspace"
|
43
|
-
require "squared/workspace/repo" # Optional
|
44
|
-
require "squared/workspace/project/node" #
|
45
|
-
require "squared/workspace/project/python" #
|
46
|
-
require "squared/workspace/project/ruby" #
|
47
|
-
# OR
|
48
|
-
require "squared/app" # All workspace related modules
|
49
|
-
|
50
|
-
# NODE_ENV = production
|
51
|
-
|
52
|
-
# REPO_ROOT = /workspaces #
|
53
|
-
# REPO_HOME = /workspaces/squared # Dir.pwd
|
54
|
-
# rake = /workspaces/squared/Rakefile # main?
|
55
|
-
# OR
|
56
|
-
# REPO_ROOT = /workspaces # Dir.pwd
|
57
|
-
# rake = /workspaces/Rakefile #
|
58
|
-
# REPO_HOME = /workspaces/squared # main: "squared"
|
59
|
-
|
60
|
-
# pathname = /workspaces/pathname
|
61
|
-
# optparse = /workspaces/optparse
|
62
|
-
# log = /workspaces/logger
|
63
|
-
# emc = /workspaces/e-mc
|
64
|
-
# pir = /workspaces/pi-r
|
65
|
-
# squared = /workspaces/squared
|
66
|
-
# cli = /workspaces/squared/publish/sqd-cli
|
67
|
-
# sqd-serve = /workspaces/squared/publish/sqd-serve
|
68
|
-
# sqd = /workspaces/squared/sqd
|
69
|
-
|
70
|
-
Workspace::Application
|
71
|
-
.new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
|
72
|
-
.banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
|
73
|
-
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
|
74
|
-
.run("rake install", ref: :ruby)
|
75
|
-
.depend(false, group: "default")
|
76
|
-
.clean("rake clean", group: "default")
|
77
|
-
.clean(["build/"], group: "app")
|
78
|
-
.log({ file: "tmp/%Y-%m-%d.log", level: "debug" }, group: "app")
|
79
|
-
.add("pathname", run: "rake compile", copy: "rake install", test: "rake test", group: "default", env: { # Ruby (with C extensions)
|
80
|
-
"CFLAGS" => "-fPIC -O1"
|
81
|
-
})
|
82
|
-
.add("optparse", doc: "rake rdoc", group: "default") # Uses bundler/gem_tasks (without C extensions)
|
83
|
-
.add("logger", copy: { from: "lib", glob: "**/*.rb", into: "~/.rvm/gems/ruby-3.4.0/gems/logger-1.6.1" }, clean: ["tmp/"]) # autodetect: true
|
84
|
-
.add("e-mc", "emc", copy: { from: "publish", scope: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
|
85
|
-
.add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
|
86
|
-
.add("squared", script: ["build:stage1", "build:stage2"], group: "app") do # Copy target (main)
|
87
|
-
add("publish/sqd-cli", "cli", exclude: [:git]) # rake cli:build
|
88
|
-
add("publish/sqd-serve") # rake sqd-serve:build
|
89
|
-
add("publish/sqd-admin", group: "sqd", exclude: [:base])
|
90
|
-
# OR
|
91
|
-
with(exclude: [:base]) { add("publish/*", "packages") } # rake packages:sqd-serve:build
|
92
|
-
# OR
|
93
|
-
add(["publish/sqd-cli", "publish/sqd-serve", "publish/sqd-admin"], true, exclude: [:base]) # rake squared:sqd-serve:build
|
94
|
-
end
|
95
|
-
.add("squared/sqd", exclude: :git, pass: [:node, 'checkout', 'bump']) do # Skip initialize(:node) + squared:checkout:* + squared:bump:*
|
96
|
-
variable_set :script, "build:sqd" # Override detection
|
97
|
-
variable_set :depend, false
|
98
|
-
variable_set :clean, ["build/sqd/"]
|
99
|
-
end
|
100
|
-
.style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
|
101
|
-
.build(default: "build", parallel: ["pull", "fetch", "rebase", "copy", "clean", /^outdated:/]) do |workspace|
|
102
|
-
workspace
|
103
|
-
.enable_aixterm
|
104
|
-
.style({
|
105
|
-
banner: ["bright_cyan", "bold", "bright_black!"],
|
106
|
-
border: "bright_white"
|
107
|
-
})
|
108
|
-
end
|
109
|
-
|
110
|
-
# default = /workspaces/ruby/*
|
111
|
-
# pathname = /workspaces/ruby/pathname
|
112
|
-
# optparse = /workspaces/ruby/optparse
|
113
|
-
# logger = /workspaces/ruby/logger
|
114
|
-
# android = /workspaces/android-docs
|
115
|
-
# chrome = /workspaces/chrome-docs
|
116
|
-
|
117
|
-
Workspace::Application
|
118
|
-
.new(ENV["SQUARED_HOME"], prefix: "rb", common: false) # Local styles
|
119
|
-
.group("ruby", "default", run: "rake build", copy: "rake install", clean: "rake clean", ref: :ruby, override: {
|
120
|
-
pathname: {
|
121
|
-
run: "rake compile" # rake rb:pathname:build
|
122
|
-
}
|
123
|
-
})
|
124
|
-
.with(:python) do # ref=Symbol | group=String
|
125
|
-
banner([:name, ": ", :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
|
126
|
-
doc("make html") # rake rb:doc:python
|
127
|
-
run(false) # rake rb:build:python (disabled)
|
128
|
-
exclude(%i[base git]) # Project::Git.ref (superclass)
|
129
|
-
add("android-docs", "android") # rake rb:android:doc
|
130
|
-
add("chrome-docs", "chrome") # rake rb:chrome:doc
|
131
|
-
end
|
132
|
-
.style("inline", "bold")
|
133
|
-
.build
|
134
|
-
```
|
135
|
-
|
136
|
-
**NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
|
137
|
-
|
138
|
-
### Clone
|
139
|
-
|
140
|
-
The task is only active when the project directory is empty or does not exist.
|
141
|
-
|
142
|
-
```ruby
|
143
|
-
Workspace::Application
|
144
|
-
.new(main: "squared")
|
145
|
-
.git(
|
146
|
-
"emc": "https://github.com/anpham6/e-mc", # rake emc:clone
|
147
|
-
"pir": { # rake pir:clone
|
148
|
-
uri: "https://github.com/anpham6/pi-r", #
|
149
|
-
options: { #
|
150
|
-
"origin": "github", # --origin='github'
|
151
|
-
"recurse-submodules": false, # --no-recurse-submodules
|
152
|
-
"shallow-exclude": ["v0.0.1", "v0.0.2"] # --shallow-exclude='v0.0.1' --shallow-exclude='v0.0.2'
|
153
|
-
}
|
154
|
-
}
|
155
|
-
)
|
156
|
-
.git("squared", "/path/to/squared", options: { local: true }) # Relative paths resolve from workspace root
|
157
|
-
.git(
|
158
|
-
{
|
159
|
-
emc: { uri: "e-mc", options: { "depth": 2 } }, # https://github.com/anpham6/e-mc
|
160
|
-
pir: "pi-r" # Maps task alias to repository folder
|
161
|
-
},
|
162
|
-
base: "https://github.com/anpham6", # Required
|
163
|
-
repo: ["squared", "android-docs", "chrome-docs"], # https://github.com/anpham6/squared
|
164
|
-
options: { # Only "repo"
|
165
|
-
"depth": 1,
|
166
|
-
"quiet": true
|
167
|
-
}
|
168
|
-
)
|
169
|
-
.with(:node) do # rake clone:node
|
170
|
-
add("e-mc", "emc") # https://github.com/anpham6/e-mc
|
171
|
-
add("pi-r", "pir") # https://github.com/anpham6/pi-r
|
172
|
-
add("squared") # https://github.com/anpham6/squared
|
173
|
-
end
|
174
|
-
.with(:python) do # rake clone:python
|
175
|
-
add("android-docs")
|
176
|
-
add("chrome-docs")
|
177
|
-
end
|
178
|
-
.git("https://github.com/anpham6") # Uses already defined root projects
|
179
|
-
.git("https://github.com/anpham6", ["emc", "pir"]) # Targets any defined project
|
180
|
-
.build(parallel: ["clone"]) # rake clone + rake clone:sync
|
181
|
-
```
|
182
|
-
|
183
|
-
### Graph
|
184
|
-
|
185
|
-
```ruby
|
186
|
-
Workspace::Application
|
187
|
-
.new(main: "squared")
|
188
|
-
.graph(["depend"], ref: :git) # Optional
|
189
|
-
.with(:python) do
|
190
|
-
add("android-docs", "android")
|
191
|
-
add("chrome-docs", "chrome", graph: "android")
|
192
|
-
end
|
193
|
-
.with(:node) do
|
194
|
-
graph(["build", "copy"], on: { # Overrides "git"
|
195
|
-
first: proc { puts "1" },
|
196
|
-
last: proc { puts "2" }
|
197
|
-
})
|
198
|
-
add("e-mc", "emc") do
|
199
|
-
first("build", "emc:clean", "emc:depend") # rake emc:clean; rake emc:depend; rake emc:build; puts "123";
|
200
|
-
last("build", out: "123") { |out: nil| puts out } #
|
201
|
-
error("build") { |err: nil| log.debug err } #
|
202
|
-
end
|
203
|
-
add("pi-r", "pir", graph: "emc", first: {
|
204
|
-
build: proc { puts self.name } # puts "pir"
|
205
|
-
})
|
206
|
-
add("squared-express", "express", graph: "pir")
|
207
|
-
add("squared", graph: ["chrome", "express"]) do
|
208
|
-
first("git:ls-files") { puts path }
|
209
|
-
last("git:ls-files") { puts workspace.root }
|
210
|
-
end
|
211
|
-
end
|
212
|
-
.with(:ruby) do
|
213
|
-
add("pathname")
|
214
|
-
add("fileutils", graph: "pathname")
|
215
|
-
add("optparse")
|
216
|
-
add("rake", graph: ["fileutils", "optparse"])
|
217
|
-
banner(command: false) # Always hide banner
|
218
|
-
end
|
219
|
-
.build
|
220
|
-
```
|
221
|
-
|
222
|
-
```sh
|
223
|
-
rake pir:graph # emc + pir
|
224
|
-
rake express:graph # emc + pir + express
|
225
|
-
rake chrome:graph # android + chrome
|
226
|
-
rake graph:python # same
|
227
|
-
rake squared:graph # android + chrome + emc + pir + express + squared
|
228
|
-
rake graph:node # same
|
229
|
-
rake rake:graph # pathname + fileutils + optparse + rake
|
230
|
-
rake graph:ruby # same
|
231
|
-
rake graph # graph:node + graph:ruby
|
232
|
-
```
|
233
|
-
|
234
|
-
### Batch
|
235
|
-
|
236
|
-
```ruby
|
237
|
-
Workspace::Series.batch(:ruby, :node, {
|
238
|
-
stage: %i[graph test],
|
239
|
-
reset: %i[stash pull]
|
240
|
-
})
|
241
|
-
```
|
242
|
-
|
243
|
-
### Rename
|
244
|
-
|
245
|
-
```ruby
|
246
|
-
Workspace::Series.rename("depend", "install")
|
247
|
-
```
|
248
|
-
|
249
|
-
## Usage
|
250
|
-
|
251
|
-
```sh
|
252
|
-
rake -T # List tasks
|
253
|
-
rake # rake status (usually "build")
|
254
|
-
|
255
|
-
# GIT_OPTIONS=rebase
|
256
|
-
rake pull # All except "default" + "app"
|
257
|
-
rake pull:ruby # pathname + optparse + logger
|
258
|
-
rake pull:default # pathname + optparse
|
259
|
-
rake pull:app # squared
|
260
|
-
rake pull:node # emc + pir + squared
|
261
|
-
|
262
|
-
rake build # All except "android"
|
263
|
-
rake doc # optparse + android
|
264
|
-
rake depend # All except "default"
|
265
|
-
|
266
|
-
rake build:ruby # rake compile + rake install + rake install
|
267
|
-
|
268
|
-
rake clean # All except "default" + "app"
|
269
|
-
rake clean:ruby # rake clean + rake clean + ["tmp/"]
|
270
|
-
rake clean:default # rake clean + rake clean + skip
|
271
|
-
rake clean:app # none + skip + ["build/"]
|
272
|
-
rake clean:node # none + ["publish/**/*.js", "tmp/"] + ["build/"]
|
273
|
-
|
274
|
-
rake squared:run[#] # List scripts (node)
|
275
|
-
rake squared:rake[#] # List tasks (ruby)
|
276
|
-
```
|
277
|
-
|
278
|
-
```sh
|
279
|
-
rake build:app # squared + cli + sqd-serve
|
280
|
-
rake squared:build:workspace # cli + sqd-serve
|
281
|
-
rake pull:sqd # sqd-admin
|
282
|
-
rake squared:pull:workspace # sqd-serve + sqd-admin
|
283
|
-
rake squared:outdated:workspace # cli + sqd-serve + sqd-admin
|
284
|
-
```
|
285
|
-
|
286
|
-
## Methods
|
287
|
-
|
288
|
-
Task:
|
289
|
-
|
290
|
-
* run
|
291
|
-
* depend
|
292
|
-
* graph
|
293
|
-
* test
|
294
|
-
* doc
|
295
|
-
* clean
|
296
|
-
|
297
|
-
Non-task:
|
298
|
-
|
299
|
-
* log
|
300
|
-
* exclude
|
301
|
-
|
302
|
-
## Styles
|
303
|
-
|
304
|
-
* banner
|
305
|
-
* border
|
306
|
-
* header
|
307
|
-
* active
|
308
|
-
* inline
|
309
|
-
* current
|
310
|
-
* major
|
311
|
-
* red
|
312
|
-
* yellow
|
313
|
-
* green
|
314
|
-
|
315
|
-
## Environment
|
316
|
-
|
317
|
-
### Path
|
318
|
-
|
319
|
-
All project executable programs can have their binary path set to a non-global alias.
|
320
|
-
|
321
|
-
```ruby
|
322
|
-
Common::PATH.merge!({
|
323
|
-
GIT: '/usr/bin/git',
|
324
|
-
GEM: '~/.rvm/rubies/ruby-3.4.0/bin/gem',
|
325
|
-
BUNDLE: '~/.rvm/gems/ruby-3.4.0/bin/bundle',
|
326
|
-
RAKE: '~/.rvm/gems/ruby-3.4.0/bin/rake',
|
327
|
-
NPM: '/opt/node/v22.0.0/bin/npm',
|
328
|
-
PYTHON: "#{ENV['PYTHONPATH']}/bin/python"
|
329
|
-
})
|
330
|
-
```
|
331
|
-
|
332
|
-
### Build
|
333
|
-
|
334
|
-
```ruby
|
335
|
-
# :env :run :opts
|
336
|
-
# LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -c
|
337
|
-
BUILD_${NAME} # gcc a.c -o a.o
|
338
|
-
BUILD_${NAME}_OPTS # -c
|
339
|
-
BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
|
340
|
-
|
341
|
-
# :env :opts :script
|
342
|
-
# NODE_ENV="production" NO_COLOR="1" npm run --loglevel=error --workspaces=false build:dev
|
343
|
-
BUILD_${NAME} # build:dev
|
344
|
-
BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
|
345
|
-
BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
|
346
|
-
BUILD_${NAME}_DEV # pattern,0,1 (:dev)
|
347
|
-
BUILD_${NAME}_PROD # pattern,0,1 (:prod)
|
348
|
-
|
349
|
-
BUILD_${NAME}=0 # skip project
|
350
|
-
```
|
351
|
-
|
352
|
-
These options also support the project specific suffix `${NAME}`. (e.g. LOG_FILE_SQUARED)
|
353
|
-
|
354
|
-
### Logger
|
355
|
-
|
356
|
-
```ruby
|
357
|
-
LOG_FILE # %Y-%m-%d.log
|
358
|
-
# OR
|
359
|
-
LOG_AUTO # year,y,month,m,day,d,1
|
360
|
-
# Optional
|
361
|
-
LOG_DIR # exist?
|
362
|
-
LOG_LEVEL # See gem "logger"
|
363
|
-
LOG_COLUMNS # terminal width (default: 80)
|
364
|
-
```
|
365
|
-
|
366
|
-
### Repo
|
367
|
-
|
368
|
-
```ruby
|
369
|
-
REPO_ROOT # parent dir
|
370
|
-
REPO_HOME # project dir (main)
|
371
|
-
REPO_BUILD # run,script
|
372
|
-
REPO_GROUP # string
|
373
|
-
REPO_REF # e.g. ruby,node
|
374
|
-
REPO_DEV # pattern,0,1
|
375
|
-
REPO_PROD # pattern,0,1
|
376
|
-
REPO_WARN # 0,1
|
377
|
-
REPO_SYNC # 0,1
|
378
|
-
REPO_MANIFEST # e.g. latest,nightly,prod
|
379
|
-
REPO_TIMEOUT # confirm dialog (seconds)
|
380
|
-
```
|
381
|
-
|
382
|
-
## LICENSE
|
383
|
-
|
384
|
-
BSD 3-Clause
|