build-files 1.4.3 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,90 +0,0 @@
1
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'build/files'
22
-
23
- module Build::Files::StateSpec
24
- describe Build::Files::State do
25
- let(:files) {Build::Files::Glob.new(__dir__, "*.rb")}
26
-
27
- it "should have no changes initially" do
28
- state = Build::Files::State.new(files)
29
-
30
- expect(state.update!).to be false
31
-
32
- expect(state.changed).to be == []
33
- expect(state.added).to be == []
34
- expect(state.removed).to be == []
35
- expect(state.missing).to be == []
36
- end
37
-
38
- it "should report missing files" do
39
- rebased_files = files.to_paths.rebase(File.join(__dir__, 'foo'))
40
- state = Build::Files::State.new(rebased_files)
41
-
42
- # Some changes were detected:
43
- expect(state.update!).to be true
44
-
45
- # Some files are missing:
46
- expect(state.missing).to_not be_empty
47
- end
48
-
49
- it "should not be confused by duplicates" do
50
- state = Build::Files::State.new(files + files)
51
-
52
- expect(state.update!).to be false
53
-
54
- expect(state.changed).to be == []
55
- expect(state.added).to be == []
56
- expect(state.removed).to be == []
57
- expect(state.missing).to be == []
58
- end
59
- end
60
-
61
- describe Build::Files::State do
62
- before(:each) do
63
- @temporary_files = Build::Files::Paths.directory(__dir__, ['a'])
64
- @temporary_files.touch
65
-
66
- @new_files = Build::Files::State.new(@temporary_files)
67
- @old_files = Build::Files::State.new(Build::Files::Glob.new(__dir__, "*.rb"))
68
- end
69
-
70
- after(:each) do
71
- @temporary_files.delete
72
- end
73
-
74
- let(:empty) {Build::Files::State.new(Build::Files::List::NONE)}
75
-
76
- it "should be clean with empty inputs or outputs" do
77
- expect(Build::Files::State.dirty?(empty, @new_files)).to be false
78
- expect(Build::Files::State.dirty?(@new_files, empty)).to be false
79
- end
80
-
81
- it "should be clean if files are newer" do
82
- expect(Build::Files::State.dirty?(@old_files, @new_files)).to be false
83
- end
84
-
85
- it "should be dirty if files are modified" do
86
- # In this case, the file mtime is usually different so...
87
- expect(Build::Files::State.dirty?(@new_files, @old_files)).to be true
88
- end
89
- end
90
- end
@@ -1,56 +0,0 @@
1
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'build/files'
22
- require 'build/files/path'
23
- require 'build/files/system'
24
-
25
- require 'pathname'
26
-
27
- module Build::Files::FilesystemSpec
28
- include Build::Files
29
-
30
- describe Build::Files::Path do
31
- let(:root) {Path.new(__dir__)}
32
- let(:path) {root + "filesystem_spec"}
33
-
34
- after(:each) do
35
- path.delete
36
- end
37
-
38
- it "should open file for writing" do
39
- path.write("Hello World")
40
-
41
- expect(File).to be_exist(path)
42
- expect(path.read).to be == "Hello World"
43
-
44
- expect(path).to be_exist
45
- expect(path.directory?).to be == false
46
-
47
- expect(path.modified_time.to_f).to be_within(5.0).of(Time.now.to_f)
48
- end
49
-
50
- it "should make a directory" do
51
- path.create
52
-
53
- expect(path.directory?).to be == true
54
- end
55
- end
56
- end
data/spec/spec_helper.rb DELETED
@@ -1,11 +0,0 @@
1
-
2
- require "covered/rspec"
3
-
4
- RSpec.configure do |config|
5
- # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = ".rspec_status"
7
-
8
- config.expect_with :rspec do |c|
9
- c.syntax = :expect
10
- end
11
- end