braid 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.textile +120 -0
- data/Rakefile +17 -0
- data/bin/braid +230 -0
- data/braid.gemspec +25 -0
- data/lib/braid.rb +29 -0
- data/lib/braid/command.rb +131 -0
- data/lib/braid/commands/add.rb +42 -0
- data/lib/braid/commands/diff.rb +13 -0
- data/lib/braid/commands/remove.rb +27 -0
- data/lib/braid/commands/setup.rb +34 -0
- data/lib/braid/commands/update.rb +102 -0
- data/lib/braid/config.rb +101 -0
- data/lib/braid/mirror.rb +173 -0
- data/lib/braid/operations.rb +385 -0
- data/test/braid_test.rb +7 -0
- data/test/config_test.rb +62 -0
- data/test/fixtures/shiny/README +3 -0
- data/test/fixtures/skit1.1/layouts/layout.liquid +219 -0
- data/test/fixtures/skit1.2/layouts/layout.liquid +221 -0
- data/test/fixtures/skit1/layouts/layout.liquid +219 -0
- data/test/fixtures/skit1/preview.png +0 -0
- data/test/integration/adding_test.rb +80 -0
- data/test/integration/updating_test.rb +87 -0
- data/test/integration_helper.rb +70 -0
- data/test/mirror_test.rb +110 -0
- data/test/operations_test.rb +66 -0
- data/test/test_helper.rb +15 -0
- metadata +104 -0
@@ -0,0 +1,219 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
{{ '/feed/atom.xml' | assign_to: 'global_feed' }}
|
4
|
+
{{ '/feed/all_comments.xml' | assign_to: 'global_comments_feed' }}
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<title>
|
8
|
+
{{ site.title }}
|
9
|
+
{% if site.current_section %}
|
10
|
+
- {{ site.current_section.name }}
|
11
|
+
{% endif %}
|
12
|
+
{% if article %}
|
13
|
+
- {{ article.title }}
|
14
|
+
{% endif %}
|
15
|
+
</title>
|
16
|
+
<link rel="alternate" type="application/atom+xml" title="{{ site.title }} feed" href="{{ global_feed }}"/>
|
17
|
+
<link rel="alternate" type="application/atom+xml" title="{{ site.title }} comments feed" href="{{ global_comments_feed }}"/>
|
18
|
+
{{ 'base' | stylesheet }}
|
19
|
+
{{ 'app' | javascript }}
|
20
|
+
<!--[if IE]>
|
21
|
+
{{ 'base_ie' | stylesheet }}
|
22
|
+
<![endif]-->
|
23
|
+
</head>
|
24
|
+
|
25
|
+
<body class="fixed orange">
|
26
|
+
<script type="text/javascript">loadPreferences()</script>
|
27
|
+
|
28
|
+
<div id="wrapper">
|
29
|
+
|
30
|
+
<div id="header" class="clearfix">
|
31
|
+
<div id="title" class="clearfix">
|
32
|
+
<h1><a href="/">{{ site.title }}</a></h1>
|
33
|
+
</div>
|
34
|
+
<h2>Sections</h2>
|
35
|
+
<ul id="menu">
|
36
|
+
{% for section in site.sections %}
|
37
|
+
{% if section.articles_count > 0 %}
|
38
|
+
{% if section.is_home %}
|
39
|
+
<li{% if section.current %} class="selected"{% endif %}>{{ section | link_to_section }}</li>
|
40
|
+
{% else %}
|
41
|
+
{% if section.is_paged %}
|
42
|
+
<li{% if section.current %} class="selected"{% endif %}>{{ section | link_to_section }}</li>
|
43
|
+
{% endif %}
|
44
|
+
{% endif %}
|
45
|
+
{% endif %}
|
46
|
+
{% endfor %}
|
47
|
+
</ul>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<div id="contentwrapper" class="clearfix">
|
51
|
+
|
52
|
+
<div id="content">
|
53
|
+
|
54
|
+
<div id="innerwrapper">
|
55
|
+
|
56
|
+
<div class="article">
|
57
|
+
<div class="body">
|
58
|
+
<h2>Skittlish Tips'n'Tricks</h2>
|
59
|
+
<ul>
|
60
|
+
<li>Change the classes for the body tag to set your default site style. also change these in the app.js file (line 66).</li>
|
61
|
+
<li>Remove the scripts and the #options div if you don't want the option switcher.</li>
|
62
|
+
<li>The top menu shows the home section and the sections that are not blogs.</li>
|
63
|
+
<li>Email me at <a href="mailto:evil@che.lu">evil@che.lu</a> if you have any questions.</li>
|
64
|
+
<li>Happy hacking!</li>
|
65
|
+
</ul>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
{{ content_for_layout }}
|
70
|
+
|
71
|
+
</div>
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div id="sidebar">
|
76
|
+
|
77
|
+
<div class="boxy short">
|
78
|
+
<h3>boxy short</h3>
|
79
|
+
|
80
|
+
<p>You can have, boxes with a short, tall or no background shade, just change the class of the containing div.</p>
|
81
|
+
|
82
|
+
<p>Have boxes with smaller text with the class "minor". See the "Recent" boxy below.</p>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="search" class="boxy short">
|
87
|
+
<h3>Search</h3>
|
88
|
+
<form method="get" action="/search">
|
89
|
+
<fieldset>
|
90
|
+
<input class="text" type="text" id="q" value="" name="q"/>
|
91
|
+
</fieldset>
|
92
|
+
</form>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div class="boxy tall minor">
|
96
|
+
<h3>Recent</h3>
|
97
|
+
|
98
|
+
<dl>
|
99
|
+
<dt>Articles <a class="feed" href="{{ global_feed }}"><span>feed</span></a></dt>
|
100
|
+
<dd>
|
101
|
+
<ul>
|
102
|
+
{% for article in site.latest_articles %}
|
103
|
+
<li>{{ article | link_to_article }} <em>({{ article.published_at | format_date: 'stub', true }})</em></li>
|
104
|
+
{% endfor %}
|
105
|
+
</ul>
|
106
|
+
</dd>
|
107
|
+
|
108
|
+
<dt>Comments <a class="feed" href="{{ global_comments_feed }}"><span>feed</span></a></dt>
|
109
|
+
<dd>
|
110
|
+
<ul>
|
111
|
+
{% for comment in site.latest_comments %}
|
112
|
+
<li>{{ comment.author_link }} on <a href="{{ comment.url }}#comment-{{ comment.id }}">{{ comment.title }}</a></li>
|
113
|
+
{% endfor %}
|
114
|
+
</ul>
|
115
|
+
</dd>
|
116
|
+
</dl>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div class="boxy short">
|
120
|
+
<h3>Archives</h3>
|
121
|
+
<p>This would be much nicer with jamis' month_drop thingy.</p>
|
122
|
+
{{ '' | section | months | assign_to: 'home_section' }}
|
123
|
+
<ul>
|
124
|
+
{% for month in home_section.months %}
|
125
|
+
{{ home_section | monthly_articles: month | size | assign_to: 'articles_count' }}
|
126
|
+
{% if articles_count > 0 %}
|
127
|
+
<li>{{ home_section | link_to_month: month }} ({{ articles_count }})</li>
|
128
|
+
{% endif %}
|
129
|
+
{% endfor %}
|
130
|
+
</ul>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
{% if site.blog_sections.size > 1 %}
|
134
|
+
<div class="boxy short">
|
135
|
+
<h3>Categories</h3>
|
136
|
+
<p>Lists only blog type categories with at least one article.</p>
|
137
|
+
<p>This list uses an ul. You could use a dl with only dd's in it for the same effect. Wouldn't be semantic tho.</p>
|
138
|
+
<ul class="sections">
|
139
|
+
{% for section in site.blog_sections %}
|
140
|
+
{% if section.articles_count > 0 %}
|
141
|
+
{% unless section.is_home %}
|
142
|
+
<li>{{ section | link_to_section }} ({{ section.articles_count }})</li>
|
143
|
+
{% endunless %}
|
144
|
+
{% endif %}
|
145
|
+
{% endfor %}
|
146
|
+
</ul>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
{% endif %}
|
150
|
+
{% unless site.tags == empty %}
|
151
|
+
<div class="boxy short">
|
152
|
+
<p>This would be nicer if we could get the number of articles for each tag.</p>
|
153
|
+
<h3>tags: </h3>
|
154
|
+
<ul>
|
155
|
+
{% for tag in site.tags %}
|
156
|
+
<li>{{ tag | link_to_tag }}</li>
|
157
|
+
{% endfor %}
|
158
|
+
</ul>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
{% endunless %}
|
162
|
+
<div class="boxy tall">
|
163
|
+
<h3>boxy tall</h3>
|
164
|
+
<p>When using a tall box, make sure it's got plenty of content or that it's immediately followed by a short boxy. It might look a bit chopped off otherwise.</p>
|
165
|
+
<dl>
|
166
|
+
<dt>thing 1</dt>
|
167
|
+
<dd><a href="#">value 1</a></dd>
|
168
|
+
<dd><a href="#">value 2</a></dd>
|
169
|
+
<dd><a href="#">value 3</a></dd>
|
170
|
+
<dd><a href="#">value 4</a></dd>
|
171
|
+
<dd><a href="#">value 5</a></dd>
|
172
|
+
<dd><a href="#">value 6</a></dd>
|
173
|
+
<dd><a href="#">value 6</a></dd>
|
174
|
+
|
175
|
+
<dt>thing 1</dt>
|
176
|
+
<dd><a href="#">value 1</a></dd>
|
177
|
+
<dd><a href="#">value 2</a></dd>
|
178
|
+
<dd><a href="#">value 3</a></dd>
|
179
|
+
<dd>value 4</dd>
|
180
|
+
<dd>value 5</dd>
|
181
|
+
<dd><a href="#">value 6</a></dd>
|
182
|
+
<dd><a href="#">value 6</a></dd>
|
183
|
+
|
184
|
+
</dl>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
<div id="options">
|
192
|
+
<h2>Options:</h2>
|
193
|
+
<h3>Size</h3>
|
194
|
+
<ul id="option_size">
|
195
|
+
<li id="option_size_fixed" class="fixed" ><a><span>fixed </span></a></li>
|
196
|
+
<li id="option_size_fluid" class="fluid" ><a><span>fluid </span></a></li>
|
197
|
+
</ul>
|
198
|
+
<h3>Colors</h3>
|
199
|
+
<ul id="option_color">
|
200
|
+
<li id="option_color_orange" class="orange"><a><span>orange</span></a></li>
|
201
|
+
<li id="option_color_blue" class="blue" ><a><span>blue </span></a></li>
|
202
|
+
<li id="option_color_green" class="green" ><a><span>green </span></a></li>
|
203
|
+
<li id="option_color_pink" class="pink" ><a><span>pink </span></a></li>
|
204
|
+
<li id="option_color_cyan" class="cyan" ><a><span>cyan </span></a></li>
|
205
|
+
<li id="option_color_red" class="red" ><a><span>red </span></a></li>
|
206
|
+
<li id="option_color_violet" class="violet"><a><span>violet</span></a></li>
|
207
|
+
</ul>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div id="footer">
|
211
|
+
<p>Copyright © 2006, Your Name. Valid <a href="http://validator.w3.org/check/referer">XHTML</a> and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.</p>
|
212
|
+
<p>Using <a href="http://evil.che.lu/projects/skittlish">skittlish</a> on <a href="http://publishwithimpunity.com/">mephisto</a>.</p>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
</body>
|
218
|
+
|
219
|
+
</html>
|
Binary file
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../integration_helper'
|
2
|
+
|
3
|
+
describe "Adding a mirror in a clean repository" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
FileUtils.rm_rf(TMP_PATH)
|
7
|
+
FileUtils.mkdir_p(TMP_PATH)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "from a git repository" do
|
11
|
+
before do
|
12
|
+
@shiny = create_git_repo_from_fixture("shiny")
|
13
|
+
@skit1 = create_git_repo_from_fixture("skit1")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should add the files and commit" do
|
17
|
+
in_dir(@shiny) do
|
18
|
+
`#{BRAID_BIN} add --type git #{@skit1}`
|
19
|
+
end
|
20
|
+
|
21
|
+
file_name = "skit1/layouts/layout.liquid"
|
22
|
+
output = `diff -U 3 #{File.join(FIXTURE_PATH, file_name)} #{File.join(TMP_PATH, "shiny", file_name)}`
|
23
|
+
$?.should.be.success
|
24
|
+
|
25
|
+
output = `git log --pretty=oneline`.split("\n")
|
26
|
+
output.length.should == 2
|
27
|
+
output[0].should =~ /Braid: Added mirror 'skit1' at '[0-9a-f]{7}'/
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create .braids and add the mirror to it" do
|
31
|
+
in_dir(@shiny) do
|
32
|
+
`#{BRAID_BIN} add --type git #{@skit1}`
|
33
|
+
end
|
34
|
+
|
35
|
+
braids = YAML::load_file("#{@shiny}/.braids")
|
36
|
+
braids["skit1"]["squashed"].should == true
|
37
|
+
braids["skit1"]["url"].should == @skit1
|
38
|
+
braids["skit1"]["type"].should == "git"
|
39
|
+
braids["skit1"]["revision"].should.not.be nil
|
40
|
+
braids["skit1"]["branch"].should == "master"
|
41
|
+
braids["skit1"]["remote"].should == "braid/skit1"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "from an svn repository" do
|
46
|
+
before do
|
47
|
+
@shiny = create_git_repo_from_fixture("shiny")
|
48
|
+
@skit1 = create_svn_repo_from_fixture("skit1")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should add the files and commit" do
|
52
|
+
in_dir(@shiny) do
|
53
|
+
`#{BRAID_BIN} add --type svn #{@skit1}`
|
54
|
+
end
|
55
|
+
|
56
|
+
file_name = "skit1/layouts/layout.liquid"
|
57
|
+
output = `diff -U 3 #{File.join(FIXTURE_PATH, file_name)} #{File.join(TMP_PATH, "shiny", file_name)}`
|
58
|
+
$?.should.be.success
|
59
|
+
|
60
|
+
output = `git log --pretty=oneline`.split("\n")
|
61
|
+
output.length.should == 2
|
62
|
+
output[0].should =~ /Braid: Added mirror 'skit1' at r1/
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should create .braids and add the mirror to it" do
|
66
|
+
in_dir(@shiny) do
|
67
|
+
`#{BRAID_BIN} add --type svn #{@skit1}`
|
68
|
+
end
|
69
|
+
|
70
|
+
braids = YAML::load_file("#{@shiny}/.braids")
|
71
|
+
braids["skit1"]["squashed"].should == true
|
72
|
+
braids["skit1"]["url"].should == @skit1
|
73
|
+
braids["skit1"]["type"].should == "svn"
|
74
|
+
braids["skit1"]["revision"].should == 1
|
75
|
+
braids["skit1"]["remote"].should == "braid/skit1"
|
76
|
+
braids["skit1"]["branch"].should.be == nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../integration_helper'
|
2
|
+
|
3
|
+
describe "Updating a mirror without conflicts" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
FileUtils.rm_rf(TMP_PATH)
|
7
|
+
FileUtils.mkdir_p(TMP_PATH)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "from a git repository" do
|
11
|
+
before do
|
12
|
+
@shiny = create_git_repo_from_fixture("shiny")
|
13
|
+
@skit1 = create_git_repo_from_fixture("skit1")
|
14
|
+
|
15
|
+
in_dir(@shiny) do
|
16
|
+
`#{BRAID_BIN} add --type git #{@skit1}`
|
17
|
+
end
|
18
|
+
|
19
|
+
update_dir_from_fixture("skit1", "skit1.1")
|
20
|
+
in_dir(@skit1) do
|
21
|
+
`git add *`
|
22
|
+
`git commit -m "change default color"`
|
23
|
+
end
|
24
|
+
|
25
|
+
update_dir_from_fixture("skit1", "skit1.2")
|
26
|
+
in_dir(@skit1) do
|
27
|
+
`git add *`
|
28
|
+
`git commit -m "add a happy note"`
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should add the files and commit" do
|
34
|
+
in_dir(@shiny) do
|
35
|
+
`#{BRAID_BIN} update skit1`
|
36
|
+
end
|
37
|
+
|
38
|
+
file_name = "layouts/layout.liquid"
|
39
|
+
output = `diff -U 3 #{File.join(FIXTURE_PATH, "skit1.2", file_name)} #{File.join(TMP_PATH, "shiny", "skit1", file_name)}`
|
40
|
+
$?.should.be.success
|
41
|
+
|
42
|
+
output = `git log --pretty=oneline`.split("\n")
|
43
|
+
output.length.should == 3
|
44
|
+
output[0].should =~ /Braid: Updated mirror 'skit1' to '[0-9a-f]{7}'/
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "from a svn repository" do
|
50
|
+
before do
|
51
|
+
@shiny = create_git_repo_from_fixture("shiny")
|
52
|
+
@skit1 = create_svn_repo_from_fixture("skit1")
|
53
|
+
@skit1_wc = File.join(TMP_PATH, "skit1_wc")
|
54
|
+
|
55
|
+
in_dir(@shiny) do
|
56
|
+
`#{BRAID_BIN} add --type svn #{@skit1}`
|
57
|
+
end
|
58
|
+
|
59
|
+
update_dir_from_fixture("skit1_wc", "skit1.1")
|
60
|
+
in_dir(@skit1_wc) do
|
61
|
+
`svn commit -m "change default color"`
|
62
|
+
end
|
63
|
+
|
64
|
+
update_dir_from_fixture("skit1_wc", "skit1.2")
|
65
|
+
in_dir(@skit1_wc) do
|
66
|
+
`svn commit -m "add a happy note"`
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should add the files and commit" do
|
72
|
+
in_dir(@shiny) do
|
73
|
+
`#{BRAID_BIN} update skit1`
|
74
|
+
end
|
75
|
+
|
76
|
+
file_name = "layouts/layout.liquid"
|
77
|
+
output = `diff -U 3 #{File.join(FIXTURE_PATH, "skit1.2", file_name)} #{File.join(TMP_PATH, "shiny", "skit1", file_name)}`
|
78
|
+
$?.should.be.success
|
79
|
+
|
80
|
+
output = `git log --pretty=oneline`.split("\n")
|
81
|
+
output.length.should == 3
|
82
|
+
output[0].should =~ /Braid: Updated mirror 'skit1' to r3/
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/spec'
|
3
|
+
require 'mocha'
|
4
|
+
|
5
|
+
require 'tempfile'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'pathname'
|
8
|
+
|
9
|
+
TMP_PATH = File.join(Dir.tmpdir, "braid_integration")
|
10
|
+
BRAID_PATH = Pathname.new(File.dirname(__FILE__)).parent.realpath
|
11
|
+
FIXTURE_PATH = File.join(BRAID_PATH, "test", "fixtures")
|
12
|
+
FileUtils.rm_rf(TMP_PATH)
|
13
|
+
FileUtils.mkdir_p(TMP_PATH)
|
14
|
+
BRAID_BIN = File.join(BRAID_PATH, "bin", "braid")
|
15
|
+
|
16
|
+
#def exec(cmd)
|
17
|
+
# `cd #{TMP} && #{cmd}`
|
18
|
+
#end
|
19
|
+
|
20
|
+
def in_dir(dir = TMP_PATH)
|
21
|
+
Dir.chdir(dir)
|
22
|
+
yield
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_cmds(ary)
|
26
|
+
ary.each do |cmd|
|
27
|
+
cmd = cmd.strip!
|
28
|
+
out = `#{cmd}`
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_dir_from_fixture(dir, fixture = dir)
|
33
|
+
to_dir = File.join(TMP_PATH, dir)
|
34
|
+
FileUtils.mkdir_p(to_dir)
|
35
|
+
FileUtils.cp_r(File.join(FIXTURE_PATH, fixture) + "/.", to_dir)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_git_repo_from_fixture(fixture_name)
|
39
|
+
git_repo = File.join(TMP_PATH, fixture_name)
|
40
|
+
update_dir_from_fixture(fixture_name)
|
41
|
+
|
42
|
+
in_dir(git_repo) do
|
43
|
+
run_cmds(<<-EOD)
|
44
|
+
git init
|
45
|
+
git add *
|
46
|
+
git commit -m "initial commit of #{fixture_name}"
|
47
|
+
EOD
|
48
|
+
end
|
49
|
+
|
50
|
+
git_repo
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_svn_repo_from_fixture(fixture_name)
|
54
|
+
svn_wc = File.join(TMP_PATH, fixture_name + "_wc")
|
55
|
+
svn_repo = File.join(TMP_PATH, fixture_name)
|
56
|
+
run_cmds(<<-EOD)
|
57
|
+
svnadmin create #{svn_repo}
|
58
|
+
svn co file://#{svn_repo} #{svn_wc}
|
59
|
+
EOD
|
60
|
+
update_dir_from_fixture(fixture_name + "_wc", fixture_name)
|
61
|
+
in_dir(svn_wc) do
|
62
|
+
run_cmds(<<-EOD)
|
63
|
+
svn add *
|
64
|
+
svn commit -m "initial commit of #{fixture_name}"
|
65
|
+
EOD
|
66
|
+
end
|
67
|
+
"file://#{svn_repo}"
|
68
|
+
end
|
69
|
+
|
70
|
+
|