squared 0.3.5 → 0.4.0

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.
@@ -7,7 +7,13 @@ module Squared
7
7
  attr_accessor :line_width
8
8
 
9
9
  def max_width(lines)
10
- [lines.max_by(&:size).size, line_width].max
10
+ win = 0
11
+ if $stdout.tty?
12
+ require 'io/console'
13
+ win = $stdout.winsize[1] rescue nil
14
+ end
15
+ n = [lines.max_by(&:size).size, line_width].max
16
+ [n, win > 0 ? win : ::Float::INFINITY].min
11
17
  end
12
18
  end
13
19
 
@@ -31,14 +31,14 @@ module Squared
31
31
  @root = nil unless repo_confirm
32
32
  end
33
33
  end
34
- raise_error('REPO_HOME', val, hint: 'invalid') unless @root
34
+ raise_error("path invalid: #{val}", hint: 'REPO_HOME') unless @root
35
35
  path.realdirpath
36
36
  elsif (val = env('REPO_ROOT'))
37
37
  @root = Pathname.new(val).realdirpath
38
38
  if !@root.exist?
39
39
  @root.mkpath
40
40
  elsif !repo_install?(parent: true)
41
- raise_error('REPO_ROOT', val, hint: 'exist') unless repo_confirm
41
+ raise_error("path does not exist: #{val}", hint: 'REPO_ROOT') unless repo_confirm
42
42
  end
43
43
  @root.join(main).realdirpath
44
44
  elsif repo_install?(parent: true) && (!@home.exist? || @root.join(main) == @home)
@@ -154,11 +154,13 @@ module Squared
154
154
  parse_opts.(args)
155
155
  stage ||= 'all'
156
156
  repo['sync'].invoke
157
+ next if env('REPO_DRYRUN', equals: '2')
158
+
157
159
  @project.select do |_, proj|
158
160
  next unless proj.enabled?(proj.workspace.baseref)
159
161
 
160
162
  proj.depend(sync: true) if proj.depend?
161
- proj.build?
163
+ proj.build? unless env('REPO_DRYRUN', ignore: '0')
162
164
  end
163
165
  .each_value do |proj|
164
166
  proj.build(sync: true)
@@ -184,7 +186,7 @@ module Squared
184
186
  desc.('sync[{0}]')
185
187
  task 'sync', [:opts] do |_, args|
186
188
  unless branch || stage == 'init'
187
- raise_error('repo is not initialized', "rake #{task_name('repo:init')}", kind: LoadError)
189
+ raise_error('repo not initialized', hint: task_name('repo:init'), kind: LoadError)
188
190
  end
189
191
  parse_opts.(args)
190
192
  cmd << "-j#{ENV.fetch('REPO_JOBS', Rake::CpuCounter.count)}"
@@ -192,6 +194,9 @@ module Squared
192
194
  puts if newline && stage != 'init'
193
195
  begin
194
196
  Common::System.shell("repo sync #{cmd.join(' ')}", chdir: root, exception: failfast)
197
+ rescue Errno::ENOENT => e
198
+ emphasize(e, title: root)
199
+ raise
195
200
  rescue StandardError => e
196
201
  emphasize(e, title: "rake stash #{task_name(task_join('repo', stage || 'sync'))}")
197
202
  raise
@@ -119,7 +119,7 @@ module Squared
119
119
  val = format_desc(key, out: true)
120
120
  if items.size > 1
121
121
  @multiple << key
122
- if parallel.include?(t) || pattern.any? { |pat| t =~ pat } || subcheck.(t)
122
+ if parallel.include?(t) || pattern.any? { |pat| t.match?(pat) } || subcheck.(t)
123
123
  task_desc("#{val} (thread)", name: key)
124
124
  multitask key => items
125
125
  @parallel << key
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.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -92,6 +92,7 @@ files:
92
92
  - lib/squared/workspace/application.rb
93
93
  - lib/squared/workspace/project.rb
94
94
  - lib/squared/workspace/project/base.rb
95
+ - lib/squared/workspace/project/docker.rb
95
96
  - lib/squared/workspace/project/git.rb
96
97
  - lib/squared/workspace/project/node.rb
97
98
  - lib/squared/workspace/project/python.rb