c-dependencies 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/c-dependencies/compiler_invocation.rb +33 -5
- data/lib/c-dependencies/dependency_list.rb +13 -3
- data/lib/c-dependencies/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09d1e1c95ea48673c0f6a108c92933f0efd6003e
|
4
|
+
data.tar.gz: c966beca09ab5b52bfd5e10924bb981862d8379f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7de1a7cd8d6f2ef0c096760ade5535ab1c8af6ff8b9813c01637dbe871cffd4791579ef948bd07ca2d6a284c7eb561f64f9977fd629afd1ebe50d4a71785c29f
|
7
|
+
data.tar.gz: bbe72d140e388907d9c28ea1a764dbc381ea77efbbe0379e9d8b2e650eb2c251a848557697cb1fe47eb29a01943a4ac24af49da54e74382fa4238c78f505ee7a
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,10 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install c-dependencies
|
20
20
|
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
24
|
+
|
21
25
|
## License
|
22
26
|
|
23
27
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
24
|
-
|
@@ -6,7 +6,6 @@ module CDependencies
|
|
6
6
|
attr_accessor :tool_name
|
7
7
|
attr_accessor :flags
|
8
8
|
attr_accessor :input_path
|
9
|
-
attr_accessor :output_file
|
10
9
|
attr_accessor :output_path
|
11
10
|
|
12
11
|
EXTENSION_MAP = { '.c' => 'cc',
|
@@ -30,6 +29,19 @@ module CDependencies
|
|
30
29
|
end
|
31
30
|
|
32
31
|
def tool_name
|
32
|
+
name = default_tool_name
|
33
|
+
|
34
|
+
case name
|
35
|
+
when 'c++'
|
36
|
+
get_env_named('CXX') || name
|
37
|
+
when 'cc'
|
38
|
+
get_env_named('CC') || name
|
39
|
+
else
|
40
|
+
name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def default_tool_name
|
33
45
|
EXTENSION_MAP[input_extension]
|
34
46
|
end
|
35
47
|
|
@@ -37,17 +49,22 @@ module CDependencies
|
|
37
49
|
"#{tool_cmd} #{dependency_flag} '#{input_path}'"
|
38
50
|
end
|
39
51
|
|
40
|
-
def
|
41
|
-
|
52
|
+
def compile_cmd
|
53
|
+
cmd = tool_cmd
|
54
|
+
cmd += " -c '#{input_path}'"
|
55
|
+
cmd += " -o '#{output_path}'"
|
56
|
+
cmd
|
42
57
|
end
|
43
58
|
|
44
59
|
private
|
45
60
|
def tool_cmd
|
46
|
-
|
61
|
+
cmd = tool_name
|
62
|
+
cmd += ' ' + flags if !flags.nil? && flags != ''
|
63
|
+
cmd
|
47
64
|
end
|
48
65
|
|
49
66
|
def dependency_flag
|
50
|
-
case
|
67
|
+
case default_tool_name
|
51
68
|
when 'cc', 'c++'
|
52
69
|
# -MM suppresses system header dependencies
|
53
70
|
'-MM'
|
@@ -55,5 +72,16 @@ module CDependencies
|
|
55
72
|
'-M'
|
56
73
|
end
|
57
74
|
end
|
75
|
+
|
76
|
+
private
|
77
|
+
def get_env_named(name)
|
78
|
+
env_var = ENV[name]
|
79
|
+
|
80
|
+
if env_var.nil? || env_var == ''
|
81
|
+
nil
|
82
|
+
else
|
83
|
+
env_var
|
84
|
+
end
|
85
|
+
end
|
58
86
|
end
|
59
87
|
end
|
@@ -19,15 +19,25 @@ module CDependencies
|
|
19
19
|
list = File.readlines(path)
|
20
20
|
list.map! { |x| x.chomp() }
|
21
21
|
|
22
|
-
# make a non-empty list of files
|
23
|
-
list.reject! { |x| x.empty?
|
22
|
+
# make a non-empty list of files
|
23
|
+
list.reject! { |x| x.empty? }
|
24
|
+
|
25
|
+
# [path, sha] throwing away the sha part for now
|
26
|
+
list.map! { |x| x.split(',')[0] }
|
27
|
+
|
28
|
+
# remove files that do not exist
|
29
|
+
list.reject! { |x| !File.exist?(x) }
|
24
30
|
|
25
31
|
DependencyList.new(list)
|
26
32
|
end
|
27
33
|
|
34
|
+
def append(path)
|
35
|
+
@paths << File.absolute_path(path)
|
36
|
+
end
|
37
|
+
|
28
38
|
private
|
29
39
|
def serializable_dependency_entry(entry)
|
30
|
-
entry
|
40
|
+
"#{entry}, #{file_hash(entry)}"
|
31
41
|
end
|
32
42
|
|
33
43
|
def serializable_entries
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c-dependencies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Massicotte
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,6 +59,7 @@ extensions: []
|
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
61
|
- ".gitignore"
|
62
|
+
- ".travis.yml"
|
62
63
|
- CODE_OF_CONDUCT.md
|
63
64
|
- Gemfile
|
64
65
|
- Gemfile.lock
|