canoe 0.3.3.2 → 0.3.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/canoe.rb +3 -12
- data/lib/dependence.rb +11 -13
- data/lib/source_files.rb +9 -13
- data/lib/util.rb +6 -1
- data/lib/workspace/add.rb +1 -0
- data/lib/workspace/test.rb +1 -1
- 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: e7002afc65c5738fb7929e1b81cc491b9d7a7196b2ada01f3b6f580ccfe25133
|
|
4
|
+
data.tar.gz: 48632ed95d610599712de7f84fbfb8108c1195d9460cf1a96b8b22cccb59891c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa9c3ccf050acd66acd89bdc4b7f4fc280c68e926be7d027cfbb44cecf9f89b51aa7b61b44269f6f7d4a2c2524f4b67e65ba507a074824bba7018940dfb19d82
|
|
7
|
+
data.tar.gz: 23f4cd1c8e5bb9e57d8bda28974366d7486efca3a5d7c275c1042a27a7c039dd80e699d792330417647a72b3615ba164aba502c7e16097a549fd16b41fc45135
|
data/lib/canoe.rb
CHANGED
|
@@ -3,20 +3,11 @@ require_relative 'cmd'
|
|
|
3
3
|
require_relative 'source_files'
|
|
4
4
|
|
|
5
5
|
module Canoe
|
|
6
|
+
##
|
|
7
|
+
# Main class for building a canoe project
|
|
6
8
|
class Builder
|
|
7
9
|
def initialize
|
|
8
|
-
options = [
|
|
9
|
-
'add',
|
|
10
|
-
'build',
|
|
11
|
-
'generate',
|
|
12
|
-
'make',
|
|
13
|
-
'run',
|
|
14
|
-
'dep',
|
|
15
|
-
'clean',
|
|
16
|
-
'version',
|
|
17
|
-
'help',
|
|
18
|
-
'update',
|
|
19
|
-
'test']
|
|
10
|
+
options = %w[new add build generate make run dep clean version help update test]
|
|
20
11
|
@cmd = CmdParser.new options
|
|
21
12
|
end
|
|
22
13
|
|
data/lib/dependence.rb
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
require_relative 'source_files'
|
|
2
2
|
require_relative 'util'
|
|
3
|
-
##
|
|
4
|
-
# class DepAnalyzer
|
|
5
|
-
# This class is the key component of canoe, which offers file dependency analysis functionality.
|
|
6
|
-
# A DepAnalyzer takes a directory as input, sources files and corresponding header files in this
|
|
7
|
-
# directory should have same name, e.g. test.cpp and test.hpp.
|
|
8
|
-
# DepAnalyzer would read every source file and recursively process user header files included in this source file to
|
|
9
|
-
# find out all user header files this source file depends on.
|
|
10
|
-
# Based on dependencies built in previous stage, DepAnalyzer determines which files should be recompiled and return
|
|
11
|
-
# these files to caller.
|
|
12
|
-
#
|
|
13
|
-
# Dependencies could be written to a file to avoid wasting time parsing all files, Depanalyzer would read from
|
|
14
|
-
# this file to construct dependencies. But if sources files included new headers or included headers are revmoed,
|
|
15
|
-
# Depanalyzer should rebuild the whole dependencies.
|
|
16
3
|
module Canoe
|
|
4
|
+
##
|
|
5
|
+
# This class is the key component of canoe, which offers file dependency analysis functionality.
|
|
6
|
+
#
|
|
7
|
+
# A DepAnalyzer takes a directory as input, sources files and corresponding header files in this
|
|
8
|
+
# directory should have same name, e.g. test.cpp and test.hpp. DepAnalyzer would read every source file and
|
|
9
|
+
# recursively process user header files included in this source file to find out all user header files this
|
|
10
|
+
# source file depends on. Based on dependencies built in previous stage, DepAnalyzer determines which files
|
|
11
|
+
# should be recompiled and return these files to caller. Dependencies could be written to a file to avoid
|
|
12
|
+
# wasting time parsing all files, Depanalyzer would read from this file to construct dependencies. But if
|
|
13
|
+
# sources files included new headers or included headers are revmoed, Depanalyzer should rebuild the whole
|
|
14
|
+
# dependencies.
|
|
17
15
|
class DepAnalyzer
|
|
18
16
|
include Err
|
|
19
17
|
include SystemCommand
|
data/lib/source_files.rb
CHANGED
|
@@ -13,13 +13,11 @@ class SourceFiles
|
|
|
13
13
|
@files = []
|
|
14
14
|
Dir.each_child(dir) do |f|
|
|
15
15
|
file = "#{dir}/#{f}"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
end
|
|
16
|
+
next unless File.file?(file)
|
|
17
|
+
|
|
18
|
+
add = true
|
|
19
|
+
add = yield(f) if block_given?
|
|
20
|
+
@files << file.to_s if add
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
@files
|
|
@@ -32,13 +30,11 @@ class SourceFiles
|
|
|
32
30
|
file = "#{dir}/#{f}"
|
|
33
31
|
# we don't handle symlinks
|
|
34
32
|
if File.file? file
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@files << "#{file}"
|
|
39
|
-
end
|
|
33
|
+
add = true
|
|
34
|
+
add = yield(f) if block_given?
|
|
35
|
+
@files << file if add
|
|
40
36
|
elsif File.directory? file
|
|
41
|
-
get_all_helper(
|
|
37
|
+
get_all_helper(file, &block)
|
|
42
38
|
end
|
|
43
39
|
end
|
|
44
40
|
end
|
data/lib/util.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# Many useful classes to record compiling progress, change file's name and issueing system commands
|
|
1
2
|
require_relative 'coloring'
|
|
2
3
|
|
|
3
4
|
require 'English'
|
|
@@ -59,6 +60,8 @@ module Canoe
|
|
|
59
60
|
end
|
|
60
61
|
end
|
|
61
62
|
|
|
63
|
+
##
|
|
64
|
+
# issueing system commands by accepting a command string
|
|
62
65
|
module SystemCommand
|
|
63
66
|
def issue_command(cmd_str)
|
|
64
67
|
puts cmd_str
|
|
@@ -72,7 +75,9 @@ module Canoe
|
|
|
72
75
|
status
|
|
73
76
|
end
|
|
74
77
|
end
|
|
75
|
-
|
|
78
|
+
|
|
79
|
+
##
|
|
80
|
+
# Colorized error messages with abortion
|
|
76
81
|
module Err
|
|
77
82
|
def warn_on_err(err)
|
|
78
83
|
puts <<~ERR
|
data/lib/workspace/add.rb
CHANGED
data/lib/workspace/test.rb
CHANGED
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.3.
|
|
4
|
+
version: 0.3.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-12-
|
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |+
|
|
14
14
|
Canoe offers project management and building facilities to C/C++ projects.
|