build-makefile 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7815ffb8535a220439eebf1541855074ed1284b
4
- data.tar.gz: 1f53e68502fa586b4bc3efe950d82d234600fe29
3
+ metadata.gz: 19a2bc4270626fba7f02e936f01a659b5a860e90
4
+ data.tar.gz: be3d600846009e7baa728bc26a6c9a05043f0e74
5
5
  SHA512:
6
- metadata.gz: 19dfa40f5250b111ae4facd171dce222f6f6ee7b292810312a401e0c49cce7c2c683050825a43a921cdc56253be6370e9fd97322beeda1ca5fdf3b72398bdbc9
7
- data.tar.gz: bb174d3662f8a1aeffa3c74b472baf8b5640a77d3da0e410cff449f57f98262792703f667b528a632a6e53644f4cb778bb4e3c6a87b915835e40935046dba849
6
+ metadata.gz: f0808ec5f4a9f04d7b33cc6127625424278c3acea95fd97360b411bde8194bb3fb48bee0cecf49f5c60ecb19e616169f217408bb44d8f05c0e4727de07b285f4
7
+ data.tar.gz: e15c87420338fefd6c7ddcd0e5a5c332b385345149630cdcecd49209c68ebf26a6472b7d7a79bc079ee80d038b3cac98c9344159208d2583e14f6b17d90ba1f6
data/Rakefile CHANGED
@@ -1,9 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
- require "rake/testtask"
2
+ require "rspec/core/rake_task"
3
3
 
4
- Rake::TestTask.new do |t|
5
- t.libs << 'test'
6
- end
4
+ RSpec::Core::RakeTask.new(:spec)
7
5
 
8
- desc "Run tests"
9
- task :default => :test
6
+ task :default => :spec
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "build-files", "~> 0.1.0"
20
+ spec.add_dependency "build-files", "~> 0.2.0"
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.3"
23
- spec.add_development_dependency "minitest"
23
+ spec.add_development_dependency "rspec", "~> 3.0.0.rc1"
24
24
  spec.add_development_dependency "rake"
25
25
  end
@@ -34,15 +34,19 @@ module Build
34
34
  attr :rules
35
35
 
36
36
  def [] target
37
- target = Files::Path(target)
37
+ dependencies = @rules[target.relative_path]
38
38
 
39
- return @rules[target]
39
+ if dependencies
40
+ Files::Paths.new(
41
+ dependencies.collect{|dep| Files::Path.new(dep).to_absolute(target.root)}
42
+ )
43
+ end
40
44
  end
41
45
 
42
46
  def include? target
43
- target = Files::Path(target)
47
+ target = Files::Path.new(target)
44
48
 
45
- return @rules.include? target
49
+ @rules.include? target
46
50
  end
47
51
 
48
52
  def self.load_file(path)
@@ -60,7 +64,7 @@ module Build
60
64
  rule = [:rule]
61
65
 
62
66
  target = scanner[1].strip
63
- rule << Files::Path(target)
67
+ rule << target
64
68
 
65
69
  # Parse dependencies:
66
70
  dependencies = []
@@ -68,7 +72,9 @@ module Build
68
72
  scanner.scan(/(\s|\\\n)*/)
69
73
 
70
74
  scanner.scan(SOURCE_PATH)
71
- dependencies << Files::Path(scanner[0].gsub(/\\ /, ' '))
75
+
76
+ # Need to remove escaped whitespace from path:
77
+ dependencies << scanner[0].gsub(/\\ /, ' ')
72
78
  end
73
79
  rule << dependencies
74
80
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  class Makefile
23
- VERSION = "0.1.0"
23
+ VERSION = "0.2.0"
24
24
  end
25
25
  end
@@ -18,11 +18,9 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require 'minitest/autorun'
22
-
23
21
  require 'build/makefile'
24
22
 
25
- class TestDepfile < MiniTest::Test
23
+ module Build::Makefile::DepfileSpec
26
24
  DEPFILE_TEXT = <<-EOF
27
25
  target1: source1 source2 \
28
26
  source3
@@ -33,16 +31,18 @@ class TestDepfile < MiniTest::Test
33
31
  source4
34
32
  EOF
35
33
 
36
- def test_parser
37
- depfile = Build::Makefile.parse(DEPFILE_TEXT)
38
-
39
- assert_equal 3, depfile.rules.count
40
- assert_includes depfile, "target1"
41
- assert_includes depfile, "target2"
42
- assert_includes depfile, "target3"
43
-
44
- assert_equal %w{source1 source2 source3}, depfile["target1"]
45
- assert_equal %w{}, depfile["target2"]
46
- assert_equal %w{source4}, depfile["target3"]
34
+ describe Build::Makefile do
35
+ it "should parse sample depfile" do
36
+ depfile = Build::Makefile.parse(DEPFILE_TEXT)
37
+
38
+ expect(depfile.rules.count).to be 3
39
+ expect(depfile).to include "target1"
40
+ expect(depfile).to include "target2"
41
+ expect(depfile).to include "target3"
42
+
43
+ expect(depfile.rules["target1"]).to be == %w{source1 source2 source3}
44
+ expect(depfile.rules["target2"]).to be == %w{}
45
+ expect(depfile.rules["target3"]).to be == %w{source4}
46
+ end
47
47
  end
48
48
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-makefile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-18 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: build-files
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.0
19
+ version: 0.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.0
26
+ version: 0.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 3.0.0.rc1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 3.0.0.rc1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description:
@@ -73,15 +73,15 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".gitignore"
77
- - ".travis.yml"
76
+ - .gitignore
77
+ - .travis.yml
78
78
  - Gemfile
79
79
  - README.md
80
80
  - Rakefile
81
81
  - build-makefile.gemspec
82
82
  - lib/build/makefile.rb
83
83
  - lib/build/makefile/version.rb
84
- - test/test_depfile.rb
84
+ - spec/build/depfile_spec.rb
85
85
  homepage: ''
86
86
  licenses:
87
87
  - MIT
@@ -92,20 +92,21 @@ require_paths:
92
92
  - lib
93
93
  required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 2.2.2
105
+ rubygems_version: 2.0.3
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Build::Makefile is a simple Makefile parser and can be used to extract dependencies
109
109
  from compiler generated depfiles.
110
110
  test_files:
111
- - test/test_depfile.rb
111
+ - spec/build/depfile_spec.rb
112
+ has_rdoc: