alphasights-integrity 0.1.9.8 → 0.1.10
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.
- data/.gitignore +0 -1
- data/AUTHORS +35 -0
- data/CHANGES +21 -3
- data/LICENSE +20 -0
- data/README.md +10 -52
- data/config/config.sample.yml +4 -0
- data/config/heroku/.gems +1 -1
- data/config/heroku/integrity-config.rb +1 -0
- data/integrity.gemspec +6 -11
- data/lib/integrity.rb +4 -4
- data/lib/integrity/app.rb +1 -1
- data/lib/integrity/build.rb +8 -18
- data/lib/integrity/commit.rb +13 -8
- data/lib/integrity/helpers/pretty_output.rb +8 -0
- data/lib/integrity/helpers/urls.rb +3 -3
- data/lib/integrity/installer.rb +20 -11
- data/lib/integrity/migrations.rb +43 -13
- data/lib/integrity/notifier.rb +1 -1
- data/lib/integrity/notifier/base.rb +2 -2
- data/lib/integrity/notifier/test/fixtures.rb +12 -6
- data/lib/integrity/project.rb +34 -38
- data/lib/integrity/project/push.rb +4 -5
- data/test/acceptance/api_test.rb +1 -1
- data/test/acceptance/browse_project_test.rb +12 -6
- data/test/acceptance/build_notifications_test.rb +26 -2
- data/test/acceptance/installer_test.rb +1 -1
- data/test/acceptance/manual_build_project_test.rb +2 -2
- data/test/acceptance/notifier_test_test.rb +37 -0
- data/test/acceptance/stylesheet_test.rb +2 -1
- data/test/helpers.rb +3 -2
- data/test/unit/build_test.rb +11 -46
- data/test/unit/commit_test.rb +37 -28
- data/test/unit/helpers_test.rb +16 -0
- data/test/unit/migrations_test.rb +6 -4
- data/test/unit/project_test.rb +64 -95
- data/views/_commit_info.haml +6 -10
- data/views/home.haml +3 -2
- data/views/integrity.sass +24 -4
- data/views/project.haml +5 -4
- metadata +6 -20
- data/lib/integrity/helpers/gravatar.rb +0 -16
- data/lib/integrity/project_builder.rb +0 -56
- data/lib/integrity/scm.rb +0 -19
- data/lib/integrity/scm/git.rb +0 -84
- data/lib/integrity/scm/git/uri.rb +0 -57
- data/test/unit/project_builder_test.rb +0 -118
- data/test/unit/scm_test.rb +0 -54
@@ -1,118 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../helpers"
|
2
|
-
|
3
|
-
class ProjectBuilderTest < Test::Unit::TestCase
|
4
|
-
before(:all) do
|
5
|
-
unless File.directory?(Integrity.config[:export_directory])
|
6
|
-
FileUtils.mkdir(Integrity.config[:export_directory])
|
7
|
-
end
|
8
|
-
|
9
|
-
@directory = Integrity.config[:export_directory] + "/foca-integrity-master"
|
10
|
-
FileUtils.mkdir(@directory)
|
11
|
-
end
|
12
|
-
|
13
|
-
after(:all) do
|
14
|
-
FileUtils.rm_rf(@directory)
|
15
|
-
end
|
16
|
-
|
17
|
-
before(:each) do
|
18
|
-
@project = Integrity::Project.generate(:integrity, :command => "echo 'output!'")
|
19
|
-
ignore_logs!
|
20
|
-
end
|
21
|
-
|
22
|
-
it "creates a new SCM with given project's uri, branch and export_directory" do
|
23
|
-
SCM::Git.expects(:new).with(@project.uri, @project.branch, @directory)
|
24
|
-
ProjectBuilder.new(@project)
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "When building" do
|
28
|
-
before(:each) do
|
29
|
-
@commit = @project.commits.gen(:pending)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "sets the started and completed timestamps" do
|
33
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
|
34
|
-
SCM::Git.any_instance.expects(:info).returns({})
|
35
|
-
|
36
|
-
build = ProjectBuilder.new(@project).build(@commit)
|
37
|
-
build.output.should == "output!\n"
|
38
|
-
build.started_at.should_not be_nil
|
39
|
-
build.completed_at.should_not be_nil
|
40
|
-
build.should be_successful
|
41
|
-
end
|
42
|
-
|
43
|
-
it "ensures completed_at is set, even if something horrible happens" do
|
44
|
-
lambda {
|
45
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).raises
|
46
|
-
SCM::Git.any_instance.expects(:info).returns({})
|
47
|
-
|
48
|
-
build = ProjectBuilder.new(@project).build(@commit)
|
49
|
-
build.started_at.should_not be_nil
|
50
|
-
build.completed_at.should_not be_nil
|
51
|
-
build.should be_failed
|
52
|
-
}.should raise_error
|
53
|
-
end
|
54
|
-
|
55
|
-
it "sets the build status to failure when the build command exits with a non-zero status" do
|
56
|
-
@project.update_attributes(:command => "exit 1")
|
57
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
|
58
|
-
SCM::Git.any_instance.expects(:info).returns({})
|
59
|
-
|
60
|
-
build = ProjectBuilder.new(@project).build(@commit)
|
61
|
-
build.should be_failed
|
62
|
-
end
|
63
|
-
|
64
|
-
it "sets the build status to success when the build command exits with a zero status" do
|
65
|
-
@project.update_attributes(:command => "exit 0")
|
66
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
|
67
|
-
SCM::Git.any_instance.expects(:info).returns({})
|
68
|
-
|
69
|
-
build = ProjectBuilder.new(@project).build(@commit)
|
70
|
-
build.should be_successful
|
71
|
-
end
|
72
|
-
|
73
|
-
it "runs the command in the export directory" do
|
74
|
-
@project.update_attributes(:command => "cat foo.txt")
|
75
|
-
File.open(@directory + "/foo.txt", "w") { |file| file << "bar!" }
|
76
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
|
77
|
-
SCM::Git.any_instance.expects(:info).returns({})
|
78
|
-
|
79
|
-
build = ProjectBuilder.new(@project).build(@commit)
|
80
|
-
build.output.should == "bar!"
|
81
|
-
end
|
82
|
-
|
83
|
-
it "captures both stdout and stderr" do
|
84
|
-
@project.update_attributes(:command => "echo foo through out && echo bar through err 1>&2")
|
85
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
|
86
|
-
SCM::Git.any_instance.expects(:info).returns({})
|
87
|
-
|
88
|
-
build = ProjectBuilder.new(@project).build(@commit)
|
89
|
-
build.output.should == "foo through out\nbar through err\n"
|
90
|
-
end
|
91
|
-
|
92
|
-
it "raises SCMUnknownError if it can't figure the scm from the uri" do
|
93
|
-
@project.update_attributes(:uri => "scm://example.org")
|
94
|
-
lambda { ProjectBuilder.new(@project) }.should raise_error(SCM::SCMUnknownError)
|
95
|
-
end
|
96
|
-
|
97
|
-
it "doesn't fail if the commit identifier can't be retrieved" do
|
98
|
-
SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
|
99
|
-
SCM::Git.any_instance.expects(:info).returns(false)
|
100
|
-
lambda {
|
101
|
-
ProjectBuilder.new(@project).build(@commit)
|
102
|
-
}.should_not raise_error
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "When deleting the code from disk" do
|
107
|
-
it "destroys the directory" do
|
108
|
-
lambda do
|
109
|
-
ProjectBuilder.new(@project).delete_code
|
110
|
-
end.should change(Pathname.new(@directory), :directory?).from(true).to(false)
|
111
|
-
end
|
112
|
-
|
113
|
-
it "don't complains if the directory doesn't exists" do
|
114
|
-
Pathname.new(@directory).should_not be_directory
|
115
|
-
lambda { ProjectBuilder.new(@project).delete_code }.should_not raise_error
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
data/test/unit/scm_test.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../helpers"
|
2
|
-
|
3
|
-
class SCMTest < Test::Unit::TestCase
|
4
|
-
def scm(uri)
|
5
|
-
SCM.new(Addressable::URI.parse(uri), "master", "foo")
|
6
|
-
end
|
7
|
-
|
8
|
-
it "recognizes git URIs" do
|
9
|
-
scm("git://example.org/repo").should be_an(SCM::Git)
|
10
|
-
scm("git@example.org/repo.git").should be_an(SCM::Git)
|
11
|
-
scm("git://example.org/repo.git").should be_an(SCM::Git)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "raises SCMUnknownError if it can't figure the SCM from the URI" do
|
15
|
-
lambda { scm("scm://example.org") }.should raise_error(SCM::SCMUnknownError)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "doesn't need the working tree path for all operations, so it's not required on the constructor" do
|
19
|
-
lambda {
|
20
|
-
SCM.new(Addressable::URI.parse("git://github.com/foca/integrity.git"), "master")
|
21
|
-
}.should_not raise_error
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "SCM::Git::URI" do
|
25
|
-
uris = [
|
26
|
-
"rsync://host.xz/path/to/repo.git/",
|
27
|
-
"rsync://host.xz/path/to/repo.git",
|
28
|
-
"rsync://host.xz/path/to/repo.gi",
|
29
|
-
"http://host.xz/path/to/repo.git/",
|
30
|
-
"https://host.xz/path/to/repo.git/",
|
31
|
-
"git://host.xz/path/to/repo.git/",
|
32
|
-
"git://host.xz/~user/path/to/repo.git/",
|
33
|
-
"ssh://[user@]host.xz[:port]/path/to/repo.git/",
|
34
|
-
"ssh://[user@]host.xz/path/to/repo.git/",
|
35
|
-
"ssh://[user@]host.xz/~user/path/to/repo.git/",
|
36
|
-
"ssh://[user@]host.xz/~/path/to/repo.git",
|
37
|
-
"host.xz:/path/to/repo.git/",
|
38
|
-
"host.xz:~user/path/to/repo.git/",
|
39
|
-
"host.xz:path/to/repo.git",
|
40
|
-
"user@host.xz:/path/to/repo.git/",
|
41
|
-
"user@host.xz:~user/path/to/repo.git/",
|
42
|
-
"user@host.xz:path/to/repo.git",
|
43
|
-
"user@host.xz:path/to/repo",
|
44
|
-
"user@host.xz:path/to/repo.a_git"
|
45
|
-
]
|
46
|
-
|
47
|
-
uris.each do |uri|
|
48
|
-
it "parses the uri #{uri}" do
|
49
|
-
git_url = SCM::Git::URI.new(uri)
|
50
|
-
git_url.working_tree_path.should == "path-to-repo"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|