dandelion 0.3.15 → 0.4.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +11 -0
- data/LICENSE +1 -1
- data/README.md +15 -26
- data/Rakefile +4 -8
- data/bin/dandelion +4 -3
- data/dandelion.gemspec +23 -20
- data/lib/dandelion.rb +26 -10
- data/lib/dandelion/adapter.rb +45 -0
- data/lib/dandelion/{backend → adapter}/ftp.rb +22 -17
- data/lib/dandelion/adapter/noop.rb +14 -0
- data/lib/dandelion/{backend → adapter}/s3.rb +14 -15
- data/lib/dandelion/{backend → adapter}/sftp.rb +29 -16
- data/lib/dandelion/change.rb +11 -0
- data/lib/dandelion/changeset.rb +49 -0
- data/lib/dandelion/cli.rb +127 -0
- data/lib/dandelion/command.rb +26 -92
- data/lib/dandelion/command/deploy.rb +54 -41
- data/lib/dandelion/command/status.rb +14 -13
- data/lib/dandelion/config.rb +36 -0
- data/lib/dandelion/deployer.rb +53 -0
- data/lib/dandelion/diff.rb +62 -0
- data/lib/dandelion/tree.rb +22 -0
- data/lib/dandelion/utils.rb +13 -0
- data/lib/dandelion/version.rb +2 -2
- data/lib/dandelion/workspace.rb +71 -0
- data/spec/dandelion/adapter_spec.rb +42 -0
- data/spec/dandelion/change_spec.rb +17 -0
- data/spec/dandelion/changeset_spec.rb +73 -0
- data/spec/dandelion/command/deploy_spec.rb +111 -0
- data/spec/dandelion/command/status_spec.rb +4 -0
- data/spec/dandelion/command_spec.rb +70 -0
- data/spec/dandelion/config_spec.rb +15 -0
- data/spec/dandelion/deployer_spec.rb +65 -0
- data/spec/dandelion/diff_spec.rb +54 -0
- data/spec/dandelion/tree_spec.rb +15 -0
- data/spec/dandelion/workspace_spec.rb +77 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/HEAD +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/config +1 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/description +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/applypatch-msg.sample +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/commit-msg.sample +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/post-update.sample +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/pre-applypatch.sample +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/pre-commit.sample +6 -2
- data/spec/fixtures/repo.git/hooks/pre-push.sample +53 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/pre-rebase.sample +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/prepare-commit-msg.sample +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/hooks/update.sample +1 -1
- data/{test/test_git.git → spec/fixtures/repo.git}/info/exclude +0 -0
- data/spec/fixtures/repo.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 +0 -0
- data/spec/fixtures/repo.git/objects/34/e64fe350f3ea80c989cdac7a99c2adb8574fca +0 -0
- data/spec/fixtures/repo.git/objects/3d/9b743acb4a84dd99002d2c6f3fcf1a47e9f06b +0 -0
- data/spec/fixtures/repo.git/objects/4e/44973d41d33bf5342037f56497efe0a9604d25 +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/objects/57/16ca5987cbf97d6bb54920bea6adde242d87e6 +0 -0
- data/spec/fixtures/repo.git/objects/6c/a0f54491390579ce9438ec89c64c6b3499683a +0 -0
- data/spec/fixtures/repo.git/objects/8a/e33865a630c5d141c8a498f0c0166ff240b433 +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/objects/90/2dce0535b19f0c15ac8407fc4468256ad672d7 +0 -0
- data/spec/fixtures/repo.git/objects/c3/9af82404cc4267b1ba5f4b4437a511e0776abb +0 -0
- data/spec/fixtures/repo.git/objects/c8/85b3f693ed6e2926971ef75680f41b318072ae +0 -0
- data/spec/fixtures/repo.git/objects/d8/7cbcba0e2ede0752bdafc5938da35546803ba5 +0 -0
- data/spec/fixtures/repo.git/objects/e2/89ff1e2729839759dbd6fe99b6e35880910c7c +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/{test/test_git.git → spec/fixtures/repo.git}/objects/ea/41dba10b54a794284e0be009a11f0ff3716a28 +0 -0
- data/spec/fixtures/repo.git/objects/ee/314a31b622b027c10981acaed7903a3607dbd4 +0 -0
- data/spec/fixtures/repo.git/objects/f6/66b137794d56880bab05e8fd256713a8fccf92 +0 -0
- data/spec/fixtures/repo.git/refs/heads/master +1 -0
- data/spec/spec_helper.rb +28 -0
- metadata +119 -127
- data/lib/dandelion/application.rb +0 -73
- data/lib/dandelion/backend.rb +0 -54
- data/lib/dandelion/deployment.rb +0 -173
- data/lib/dandelion/git.rb +0 -123
- data/test/fixtures/diff +0 -3
- data/test/fixtures/ls_tree +0 -5
- data/test/test_diff_deployment.rb +0 -122
- data/test/test_ftp.rb +0 -49
- data/test/test_git.git/hooks/post-commit.sample +0 -8
- data/test/test_git.git/hooks/post-receive.sample +0 -15
- data/test/test_git.git/objects/0c/a605e9f0f1d42ce8193ac36db11ec3cc9efc08 +0 -0
- data/test/test_git.git/objects/11/bada4e36fd065c8d1d3ca97b8dffa496c8e021 +0 -0
- data/test/test_git.git/objects/88/d4480861346093048e08ce8dcc577d8aa69379 +0 -1
- data/test/test_git.git/objects/a6/394b3e8a82b76b0dd5b6b317f489dfe22426a6 +0 -0
- data/test/test_git.git/objects/a6/5140d5ec9f47064f614ecf8e43776baa5c0c11 +0 -0
- data/test/test_git.git/objects/f5/5f3c44c89e5d215fbaaef9d33563117fe0b61b +0 -1
- data/test/test_git.git/objects/ff/1f1d4bd0c99e1c9cca047c46b2194accf89504 +0 -4
- data/test/test_git.git/refs/heads/master +0 -1
- data/test/test_git.rb +0 -50
- data/test/test_sftp.rb +0 -54
data/test/test_ftp.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'dandelion/backend/ftp'
|
2
|
-
require 'net/ftp'
|
3
|
-
require 'test/unit'
|
4
|
-
require 'mocha'
|
5
|
-
|
6
|
-
class TestFTP < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@ftp = mock()
|
9
|
-
Net::FTP.stubs(:new).returns(@ftp)
|
10
|
-
@ftp.expects(:connect).once
|
11
|
-
@ftp.expects(:login).once
|
12
|
-
@ftp.expects(:passive=).with(true).once
|
13
|
-
@ftp.expects(:chdir).with('foo').once
|
14
|
-
@backend = Dandelion::Backend::FTP.new('path' => 'foo')
|
15
|
-
class << @backend
|
16
|
-
def temp(file, data)
|
17
|
-
yield(:temp)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_read
|
23
|
-
@ftp.expects(:retrbinary).with('RETR bar', 4096).once
|
24
|
-
@ftp.expects(:retrbinary).with('RETR bar/baz', 4096).once
|
25
|
-
@ftp.expects(:retrbinary).with('RETR bar/baz/qux', 4096).once
|
26
|
-
@backend.read('bar')
|
27
|
-
@backend.read('bar/baz')
|
28
|
-
@backend.read('bar/baz/qux')
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_write
|
32
|
-
@ftp.expects(:putbinaryfile).with(:temp, 'bar').once
|
33
|
-
@ftp.expects(:putbinaryfile).with(:temp, 'bar/baz').once
|
34
|
-
@backend.write('bar', 'baz')
|
35
|
-
@backend.write('bar/baz', 'qux')
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_delete
|
39
|
-
@ftp.expects(:delete).with('bar').once
|
40
|
-
@ftp.expects(:delete).with('bar/baz').once
|
41
|
-
@ftp.expects(:delete).with('bar/baz/qux').once
|
42
|
-
@ftp.expects(:rmdir).with('bar').twice
|
43
|
-
@ftp.expects(:rmdir).with('bar/baz').once
|
44
|
-
@backend.stubs(:empty?).returns(true)
|
45
|
-
@backend.delete('bar')
|
46
|
-
@backend.delete('bar/baz')
|
47
|
-
@backend.delete('bar/baz/qux')
|
48
|
-
end
|
49
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
#
|
3
|
-
# An example hook script for the "post-receive" event.
|
4
|
-
#
|
5
|
-
# The "post-receive" script is run after receive-pack has accepted a pack
|
6
|
-
# and the repository has been updated. It is passed arguments in through
|
7
|
-
# stdin in the form
|
8
|
-
# <oldrev> <newrev> <refname>
|
9
|
-
# For example:
|
10
|
-
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
|
11
|
-
#
|
12
|
-
# see contrib/hooks/ for a sample, or uncomment the next line and
|
13
|
-
# rename the file to "post-receive".
|
14
|
-
|
15
|
-
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
x��Aj�0E��)�i%y,{ �@���3�Qk���(�������Ã�mۖ������P�y�2%�9��dS��r�1&N�w�J %d��Ȃ�*{���@Ȫe�ѣ�{�m;|k����Z���IRm��l���ڶO�����p���x��n�����L]*�րk��DZ�?�|Nd
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
x���m�0E{�Z e� E�@/ �I�
|
@@ -1 +0,0 @@
|
|
1
|
-
0ca605e9f0f1d42ce8193ac36db11ec3cc9efc08
|
data/test/test_git.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'dandelion/git'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
class TestGit < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
@repo = Dandelion::Git::Repo.new(File.join(File.dirname(__FILE__), 'test_git.git'))
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_tree_files
|
10
|
-
tree = Dandelion::Git::Tree.new(@repo, 'HEAD', '')
|
11
|
-
files = ['foo', 'bar', 'baz/foo', 'baz/bar']
|
12
|
-
assert_equal files.sort, tree.files.sort
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_tree_subfolder
|
16
|
-
tree = Dandelion::Git::Tree.new(@repo, 'HEAD', 'baz')
|
17
|
-
files = ['foo', 'bar']
|
18
|
-
assert_equal files.sort, tree.files.sort
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_tree_show
|
22
|
-
tree = Dandelion::Git::Tree.new(@repo, 'HEAD', '')
|
23
|
-
assert_equal "bar\n", tree.show('foo')
|
24
|
-
assert_equal "bar\n", tree.show('baz/foo')
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_tree_revision
|
28
|
-
revision = 'ff1f1d4bd0c99e1c9cca047c46b2194accf89504'
|
29
|
-
tree = Dandelion::Git::Tree.new(@repo, revision, '')
|
30
|
-
assert_equal revision, tree.revision
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_diff_changed
|
34
|
-
from = 'ff1f1d4bd0c99e1c9cca047c46b2194accf89504'
|
35
|
-
to = '88d4480861346093048e08ce8dcc577d8aa69379'
|
36
|
-
files = ['foo', 'baz/foo']
|
37
|
-
diff = Dandelion::Git::Diff.new(@repo, from, to, '')
|
38
|
-
assert_equal files.sort, diff.changed.sort
|
39
|
-
assert_equal [], diff.deleted
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_diff_deleted
|
43
|
-
from = 'f55f3c44c89e5d215fbaaef9d33563117fe0b61b'
|
44
|
-
to = '0ca605e9f0f1d42ce8193ac36db11ec3cc9efc08'
|
45
|
-
files = ['test_delete']
|
46
|
-
diff = Dandelion::Git::Diff.new(@repo, from, to, '')
|
47
|
-
assert_equal files.sort, diff.deleted.sort
|
48
|
-
assert_equal [], diff.changed
|
49
|
-
end
|
50
|
-
end
|
data/test/test_sftp.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'dandelion/backend/sftp'
|
2
|
-
require 'net/sftp'
|
3
|
-
require 'test/unit'
|
4
|
-
require 'mocha'
|
5
|
-
|
6
|
-
class TestSFTP < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@sftp = mock()
|
9
|
-
Net::SFTP.stubs(:start).returns(@sftp)
|
10
|
-
@backend = Dandelion::Backend::SFTP.new('path' => 'foo')
|
11
|
-
class << @backend
|
12
|
-
def temp(file, data)
|
13
|
-
yield(:temp)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_read
|
19
|
-
file = mock()
|
20
|
-
@sftp.stubs(:file).returns(file)
|
21
|
-
file.expects(:open).with('foo/bar', 'r').once
|
22
|
-
file.expects(:open).with('foo/bar/baz', 'r').once
|
23
|
-
file.expects(:open).with('foo/bar/baz/qux', 'r').once
|
24
|
-
@backend.read('bar')
|
25
|
-
@backend.read('bar/baz')
|
26
|
-
@backend.read('bar/baz/qux')
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_write
|
30
|
-
File.stubs(:stat).returns(stub(mode: 0xDEADBEEF))
|
31
|
-
File.stubs(:exists?).with('bar').returns(true)
|
32
|
-
File.stubs(:exists?).with('bar/baz').returns(true)
|
33
|
-
|
34
|
-
@sftp.expects(:upload!).with(:temp, 'foo/bar').once
|
35
|
-
@sftp.expects(:setstat!).with('foo/bar', :permissions => 0xDEADBEEF).once
|
36
|
-
@sftp.expects(:upload!).with(:temp, 'foo/bar/baz').once
|
37
|
-
@sftp.expects(:setstat!).with('foo/bar/baz', :permissions => 0xDEADBEEF).once
|
38
|
-
|
39
|
-
@backend.write('bar', 'baz')
|
40
|
-
@backend.write('bar/baz', 'qux')
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_delete
|
44
|
-
@sftp.expects(:remove!).with('foo/bar').once
|
45
|
-
@sftp.expects(:remove!).with('foo/bar/baz').once
|
46
|
-
@sftp.expects(:remove!).with('foo/bar/baz/qux').once
|
47
|
-
@sftp.expects(:rmdir!).with('foo/bar').twice
|
48
|
-
@sftp.expects(:rmdir!).with('foo/bar/baz').once
|
49
|
-
@backend.stubs(:empty?).returns(true)
|
50
|
-
@backend.delete('bar')
|
51
|
-
@backend.delete('bar/baz')
|
52
|
-
@backend.delete('bar/baz/qux')
|
53
|
-
end
|
54
|
-
end
|