canoe 0.3.2.4 → 0.3.3
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/lib/source_files.rb +2 -1
- data/lib/util.rb +10 -1
- data/lib/workspace/help.rb +2 -1
- data/lib/workspace/new.rb +15 -3
- data/lib/workspace/run.rb +1 -1
- data/lib/workspace/test.rb +7 -12
- data/lib/workspace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c8e08b29045ffc655f4dedf9cb358b70e643702dac79a88d81436e39ba9ace1
|
|
4
|
+
data.tar.gz: 2d5a877f870fa531b236f570c52f3b97ec9fc7efd35c0b05447f1e7e850f47e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a40625eaafec1023609c210a5d84710433b3d34557fc1079b9a0ca441da60ecfc6316ab4d9e1c40991530c6fb8c49155109561f3663699dfffe3bd23cf6e1c44
|
|
7
|
+
data.tar.gz: 47fde1b6a149e118d6b835e2d82e55654627a08c98faa2a8535a9e142f29a2eda5b0572da9f43c13084932e70777502df48cd608ac2db27f8586c0538acab5a2
|
data/lib/source_files.rb
CHANGED
|
@@ -30,13 +30,14 @@ class SourceFiles
|
|
|
30
30
|
def get_all_helper(dir, &block)
|
|
31
31
|
Dir.each_child(dir) do |f|
|
|
32
32
|
file = "#{dir}/#{f}"
|
|
33
|
+
# we don't handle symlinks
|
|
33
34
|
if File.file? file
|
|
34
35
|
if block_given?
|
|
35
36
|
@files << "#{file}" if yield(f)
|
|
36
37
|
else
|
|
37
38
|
@files << "#{file}"
|
|
38
39
|
end
|
|
39
|
-
|
|
40
|
+
elsif File.directory? file
|
|
40
41
|
get_all_helper("#{file}", &block)
|
|
41
42
|
end
|
|
42
43
|
end
|
data/lib/util.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
require_relative 'coloring'
|
|
2
2
|
|
|
3
|
+
require 'English'
|
|
4
|
+
|
|
3
5
|
module Canoe
|
|
4
6
|
##
|
|
5
7
|
# Stepper record the progress of a task
|
|
@@ -60,7 +62,14 @@ module Canoe
|
|
|
60
62
|
module SystemCommand
|
|
61
63
|
def issue_command(cmd_str)
|
|
62
64
|
puts cmd_str
|
|
63
|
-
system
|
|
65
|
+
system(cmd_str)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def run_command(cmd_str)
|
|
69
|
+
puts cmd_str
|
|
70
|
+
status = system(cmd_str)
|
|
71
|
+
puts $CHILD_STATUS unless status
|
|
72
|
+
status
|
|
64
73
|
end
|
|
65
74
|
end
|
|
66
75
|
|
data/lib/workspace/help.rb
CHANGED
|
@@ -53,9 +53,10 @@ module Canoe
|
|
|
53
53
|
build [all|test]:
|
|
54
54
|
build current project, 'all' builds both target and tests, 'test' builds tests only
|
|
55
55
|
|
|
56
|
-
test [tests]:
|
|
56
|
+
test [tests] [args]:
|
|
57
57
|
build and run tests
|
|
58
58
|
[tests]: 'all' for all tests, or a name of a test for a single test
|
|
59
|
+
[args]: args are passed to the single test
|
|
59
60
|
|
|
60
61
|
run [options]:
|
|
61
62
|
build current project with no specific compilation flags, and run this project, passing [options] as command line arguments to the binary
|
data/lib/workspace/new.rb
CHANGED
|
@@ -8,7 +8,8 @@ module Canoe
|
|
|
8
8
|
end
|
|
9
9
|
Dir.mkdir(@src)
|
|
10
10
|
Dir.mkdir(@components)
|
|
11
|
-
Dir.mkdir(
|
|
11
|
+
Dir.mkdir(@obj)
|
|
12
|
+
add_gitignore @obj
|
|
12
13
|
if @mode == :bin
|
|
13
14
|
DefaultFiles.create_main(@src, @source_suffix)
|
|
14
15
|
else
|
|
@@ -20,12 +21,23 @@ module Canoe
|
|
|
20
21
|
|
|
21
22
|
Dir.mkdir(@third)
|
|
22
23
|
Dir.mkdir(@target)
|
|
24
|
+
add_gitignore @target
|
|
23
25
|
Dir.mkdir(@tests)
|
|
24
26
|
Dir.chdir(@workspace) do
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
issue_command 'git init'
|
|
28
|
+
issue_command 'canoe add tests'
|
|
27
29
|
end
|
|
28
30
|
puts "workspace #{@workspace.blue} is created"
|
|
29
31
|
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def add_gitignore(dir)
|
|
36
|
+
Dir.chdir(dir) do
|
|
37
|
+
File.open('.gitignore', 'w') do |f|
|
|
38
|
+
f.write "*\n!.gitignore\n"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
30
42
|
end
|
|
31
43
|
end
|
data/lib/workspace/run.rb
CHANGED
data/lib/workspace/test.rb
CHANGED
|
@@ -5,15 +5,8 @@ module Canoe
|
|
|
5
5
|
test_all
|
|
6
6
|
return
|
|
7
7
|
end
|
|
8
|
-
|
|
9
|
-
args.
|
|
10
|
-
case arg
|
|
11
|
-
when 'all'
|
|
12
|
-
test_all
|
|
13
|
-
else
|
|
14
|
-
test_single arg
|
|
15
|
-
end
|
|
16
|
-
end
|
|
8
|
+
# we don't handle spaces
|
|
9
|
+
test_single(args[0], args[1..].join(" "))
|
|
17
10
|
end
|
|
18
11
|
|
|
19
12
|
# extract one test file's dependency
|
|
@@ -44,9 +37,10 @@ module Canoe
|
|
|
44
37
|
end
|
|
45
38
|
end
|
|
46
39
|
|
|
47
|
-
def test_single(name)
|
|
40
|
+
def test_single(name, args = "")
|
|
48
41
|
rebuild = false;
|
|
49
42
|
bin = "#{@target_short}/test_#{name}"
|
|
43
|
+
|
|
50
44
|
rebuild ||= !File.exist?(bin)
|
|
51
45
|
|
|
52
46
|
file = "#{@tests_short}/test_#{name}.#{@source_suffix}"
|
|
@@ -57,11 +51,12 @@ module Canoe
|
|
|
57
51
|
rebuild ||= File.mtime(bin) < File.mtime(f) || File.mtime(bin) < File.mtime(hdr_of_src(f))
|
|
58
52
|
end
|
|
59
53
|
|
|
54
|
+
cmd = "#{bin} #{args}"
|
|
60
55
|
if rebuild
|
|
61
56
|
build_compiler_from_config
|
|
62
|
-
|
|
57
|
+
run_command cmd if build_one_test(file, deps)
|
|
63
58
|
else
|
|
64
|
-
|
|
59
|
+
run_command cmd
|
|
65
60
|
end
|
|
66
61
|
end
|
|
67
62
|
|
data/lib/workspace/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: canoe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- XIONG Ziwei
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |+
|
|
14
14
|
Canoe offers project management and building facilities to C/C++ projects.
|