artifact 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/artifact.gemspec +31 -0
- data/bin/artifact +4 -0
- data/lib/artifact.rb +337 -0
- data/lib/artifact/app.rb +55 -0
- data/lib/artifact/files.rb +60 -0
- data/lib/artifact/helpers.rb +130 -0
- data/lib/artifact/middleman.rb +213 -0
- data/lib/artifact/public/css/dropzone.css +155 -0
- data/lib/artifact/public/css/main.css +222 -0
- data/lib/artifact/public/css/pagoda.css +782 -0
- data/lib/artifact/public/js/app.js +123 -0
- data/lib/artifact/public/js/dropzone.js +1919 -0
- data/lib/artifact/static.rb +41 -0
- data/lib/artifact/version.rb +3 -0
- data/lib/artifact/views/errors/404.erb +41 -0
- data/lib/artifact/views/errors/500.erb +43 -0
- data/lib/artifact/views/files/edit.erb +11 -0
- data/lib/artifact/views/files/index.erb +20 -0
- data/lib/artifact/views/files/new.erb +14 -0
- data/lib/artifact/views/layout.erb +36 -0
- data/lib/artifact/views/posts/_list.erb +21 -0
- data/lib/artifact/views/posts/_meta.erb +15 -0
- data/lib/artifact/views/posts/_navbar.erb +49 -0
- data/lib/artifact/views/posts/_table.erb +23 -0
- data/lib/artifact/views/posts/edit.erb +27 -0
- data/lib/artifact/views/posts/index.erb +39 -0
- data/lib/artifact/views/posts/new.erb +22 -0
- data/lib/artifact/views/shared/_menu.erb +18 -0
- data/lib/artifact/views/uploads/_form.erb +27 -0
- data/lib/artifact/views/uploads/_list.erb +17 -0
- metadata +207 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rack/static'
|
2
|
+
|
3
|
+
module Artifact
|
4
|
+
|
5
|
+
class Static
|
6
|
+
|
7
|
+
SUFFIXES = ['', '.html', '/index.html']
|
8
|
+
NOT_FOUND = 'Not found mister.'
|
9
|
+
|
10
|
+
DEFAULTS = { # for static
|
11
|
+
:root => 'build',
|
12
|
+
:urls => ['/'],
|
13
|
+
}
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
not_found = options.delete(:not_found) || NOT_FOUND
|
17
|
+
text = IO.read(not_found) if File.exist?(not_found)
|
18
|
+
|
19
|
+
@suffixes = options.delete(:suffixes) || SUFFIXES
|
20
|
+
|
21
|
+
@not_found = [404, {"Content-Type" => 'text/html'}, [text]]
|
22
|
+
@static = ::Rack::Static.new( lambda { [404, {}, []] }, DEFAULTS.merge(options))
|
23
|
+
end
|
24
|
+
|
25
|
+
def call(env)
|
26
|
+
# resp = Rack::Head.call(env)
|
27
|
+
# return resp if resp[0] != 404
|
28
|
+
|
29
|
+
found = nil
|
30
|
+
@suffixes.each do |suffix|
|
31
|
+
url = env['PATH_INFO'] + suffix
|
32
|
+
resp = @static.call(env.merge({'PATH_INFO' => url}))
|
33
|
+
break if resp[0] != 404 && found = resp
|
34
|
+
end
|
35
|
+
|
36
|
+
found or @not_found
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Document not found (404)</title>
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
|
7
|
+
body{
|
8
|
+
font-family: Arial, Helvetica, sans-serif;
|
9
|
+
font-size: 62.5%;
|
10
|
+
}
|
11
|
+
|
12
|
+
#container {
|
13
|
+
width: 500px;
|
14
|
+
margin: 150px auto;
|
15
|
+
}
|
16
|
+
|
17
|
+
h1{
|
18
|
+
font-size: 2.8em;
|
19
|
+
letter-spacing: -0.08em;
|
20
|
+
}
|
21
|
+
|
22
|
+
p{
|
23
|
+
color: #555;
|
24
|
+
font-size: 1.4em;
|
25
|
+
line-height: 170%;
|
26
|
+
}
|
27
|
+
|
28
|
+
</style>
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
|
32
|
+
<div id="container">
|
33
|
+
|
34
|
+
<h1>Document not found!</h1>
|
35
|
+
|
36
|
+
<p>Seems we couldn't find out what you were looking for. You probably followed an invalid link or hit a typo in the address.</p>
|
37
|
+
|
38
|
+
</div>
|
39
|
+
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Something went wrong (500)</title>
|
5
|
+
<style type="text/css" media="screen">
|
6
|
+
|
7
|
+
body{
|
8
|
+
font-family: Arial, Helvetica, sans-serif;
|
9
|
+
font-size: 62.5%;
|
10
|
+
}
|
11
|
+
|
12
|
+
#container {
|
13
|
+
width: 500px;
|
14
|
+
margin: 150px auto;
|
15
|
+
}
|
16
|
+
|
17
|
+
h1{
|
18
|
+
font-size: 2.8em;
|
19
|
+
letter-spacing: -0.08em;
|
20
|
+
}
|
21
|
+
|
22
|
+
p{
|
23
|
+
color: #555;
|
24
|
+
font-size: 1.4em;
|
25
|
+
line-height: 170%;
|
26
|
+
}
|
27
|
+
|
28
|
+
</style>
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
|
32
|
+
<div id="container">
|
33
|
+
|
34
|
+
<h1>Boom! Something went wrong.</h1>
|
35
|
+
|
36
|
+
<p>Oops, we screwed up and you discovered our fatal flaw.
|
37
|
+
Well, we're not all perfect, but we try. You can try this
|
38
|
+
again or maybe visit our <a href="/">home page</a> to start fresh. We'll do better next time. Promise.</p>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
|
42
|
+
</body>
|
43
|
+
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h1>Editing <%= @file.path %></h1>
|
2
|
+
|
3
|
+
<form method="post" action="/files/update/<%= @file.path %>">
|
4
|
+
|
5
|
+
<textarea cols="80" rows="40" name="content"><%= @file.content %></textarea>
|
6
|
+
|
7
|
+
<p class="submit actions">
|
8
|
+
<input type="submit" name="submit" class="btn" value="Update" />
|
9
|
+
<input type="submit" name="submit" class="btn btn-primary" value="Update & Push" />
|
10
|
+
</p>
|
11
|
+
</form>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<a class="right btn btn-primary" href="<%= url('/files/new') %>">New file</a>
|
2
|
+
|
3
|
+
<h1><%= @files.count %> files</h1>
|
4
|
+
|
5
|
+
<table class="table">
|
6
|
+
<tr>
|
7
|
+
<th>Name</th>
|
8
|
+
<th>Path</th>
|
9
|
+
<th>Status</th>
|
10
|
+
<th>Last modified</th>
|
11
|
+
</tr>
|
12
|
+
<% @files.each do |file| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= link_to(file.name, url("files/edit/#{file.path}")) %></td>
|
15
|
+
<td><%= file.dirname %></td>
|
16
|
+
<td><%= file.status %></td>
|
17
|
+
<td><%= file.last_modified %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h1>New file</h1>
|
2
|
+
|
3
|
+
<form class="form" method="post" action="/files/create">
|
4
|
+
<p>
|
5
|
+
<label for="file-path">File path</label>
|
6
|
+
<input id="file-path" type="text" name="path" value="" class="required" required="true" />
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p>
|
10
|
+
<textarea cols="80" rows="40" name="content"></textarea>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= form_submit %>
|
14
|
+
</form>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<title><%= app_name %> - <%= action.capitalize %></title>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
7
|
+
<meta http-equiv="cleartype" content="on">
|
8
|
+
|
9
|
+
<meta name="HandheldFriendly" content="True">
|
10
|
+
<meta name="MobileOptimized" content="320">
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
12
|
+
<meta name="author" content="Fork Ltd.">
|
13
|
+
|
14
|
+
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
15
|
+
<link href='http://fonts.googleapis.com/css?family=Lato:300,900|Asap|Titillium+Web' rel='stylesheet' type='text/css' />
|
16
|
+
<link rel="stylesheet" href="http://tomas.github.io/base.css/build/base-min.css" type="text/css" media="screen" />
|
17
|
+
<link rel="stylesheet" href="<%= url('/css/main.css') %>" type="text/css" media="screen" charset="utf-8" />
|
18
|
+
|
19
|
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
20
|
+
<script type="text/javascript" src="<%= url('/js/app.js') %>"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="<%= action %>">
|
24
|
+
|
25
|
+
<% [:error, :notice, :success].each do |msg| %>
|
26
|
+
<% if defined?(flash) && flash[msg] %>
|
27
|
+
<%= "<div class='alert alert-#{msg}'>#{flash[msg]}</div>" %>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<div id="main" class="fluid container clearfix">
|
32
|
+
<%= yield %>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
</body>
|
36
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<ul>
|
2
|
+
<% @list.each_with_index do |post, i| %>
|
3
|
+
<li id="post-<%= i %>">
|
4
|
+
<h3>
|
5
|
+
<% if @draft %>
|
6
|
+
<%= link_to(post.title, url("drafts/#{post.path}")) %>
|
7
|
+
<% else %>
|
8
|
+
<%= link_to(post.title, url("posts/#{post.path}")) %>
|
9
|
+
<% end %>
|
10
|
+
</h3>
|
11
|
+
<span class="last-updated">
|
12
|
+
Updated <%= time_ago_in_words(post.last_modified) %>
|
13
|
+
<%= "by #{post.last_updated_by}" if post.last_updated_by %>
|
14
|
+
</span>
|
15
|
+
<span class="links">
|
16
|
+
<a target="_blank" href="<%= post_preview_path(post) %>" class="btn">Preview</a>
|
17
|
+
<%= delete_link(url("/posts/#{post.path}")) %>
|
18
|
+
</span>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<table class="right table" id="post-meta" style="display: none">
|
2
|
+
<% @post.data.each do |key, val| %>
|
3
|
+
<% next if %w(title date last_updated_by).include?(key.to_s) %>
|
4
|
+
<tr>
|
5
|
+
<td><input type="text" value="<%= key %>" disabled="disabled" /></td>
|
6
|
+
<td><input id="post-#{key}" type="text" name="meta[<%= key %>]" value="<%= val %>" /></td>
|
7
|
+
<td><button class="btn btn-danger delete-attribute">Remove</a></td>
|
8
|
+
</tr>
|
9
|
+
<% end %>
|
10
|
+
<tr>
|
11
|
+
<td><input type="text" placeholder="New key" /></td>
|
12
|
+
<td><input class="new-attribute" type="text" placeholder="Enter value" /></td>
|
13
|
+
<td> </td>
|
14
|
+
</tr>
|
15
|
+
</table>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<div class="dark fixed navbar">
|
2
|
+
<div class="container">
|
3
|
+
<ul class="menu menu-horizontal">
|
4
|
+
<li><a id="back-button" href="<%= url('/') %>">< Back</a></li>
|
5
|
+
</ul>
|
6
|
+
|
7
|
+
<ul class="right menu menu-horizontal" id="menu">
|
8
|
+
|
9
|
+
<li><button id="show-uploads" class="btn">Uploads</button></li>
|
10
|
+
|
11
|
+
<% if @post.nil? # new %>
|
12
|
+
|
13
|
+
<li><input tabindex="3" type="submit" name="save" class="btn btn-primary" value="Save draft" /></li>
|
14
|
+
|
15
|
+
<% else %>
|
16
|
+
|
17
|
+
<li><button id="show-meta" class="btn">Post meta</button></li>
|
18
|
+
|
19
|
+
<% if @draft %>
|
20
|
+
<li><input tabindex="4" type="submit" name="save" class="btn btn-success" value="Publish" /></li>
|
21
|
+
<% else %>
|
22
|
+
<li><input type="submit" name="save" class="btn btn-danger" value="Unpublish" /></li>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<li><input tabindex="3" type="submit" name="save" class="btn btn-primary" value="Save changes" /></li>
|
26
|
+
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div id="uploads-bar" style="display: none"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<script>
|
36
|
+
|
37
|
+
var toggle_uploads = function(e) {
|
38
|
+
if (e) e.preventDefault();
|
39
|
+
|
40
|
+
var bar = $('#uploads-bar');
|
41
|
+
if (bar.is(':visible')) {
|
42
|
+
return bar.hide();
|
43
|
+
}
|
44
|
+
|
45
|
+
bar.load('<%= url('/uploads') %>').show();
|
46
|
+
};
|
47
|
+
|
48
|
+
$(document).on('click', '#show-uploads', toggle_uploads)
|
49
|
+
</script>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<table class="table">
|
2
|
+
<tr>
|
3
|
+
<th>Title</th>
|
4
|
+
<th>Author</th>
|
5
|
+
<th>Category</th>
|
6
|
+
<th>Date</th>
|
7
|
+
<th>Last modified</th>
|
8
|
+
</tr>
|
9
|
+
<% @list.each do |post| %>
|
10
|
+
<tr>
|
11
|
+
<% if @draft %>
|
12
|
+
<td><%= link_to(post.title, url("drafts/edit/#{post.path}")) %></td>
|
13
|
+
<td><%= post.author %></td>
|
14
|
+
<% else %>
|
15
|
+
<td><%= link_to(post.title, url("posts/edit/#{post.path}")) %></td>
|
16
|
+
<td><%= post.author %></td>
|
17
|
+
<% end %>
|
18
|
+
<td><%= post.category %></td>
|
19
|
+
<td><%= post.date %></td>
|
20
|
+
<td><%= post.last_modified %></td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</table>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<form id="post-form"
|
2
|
+
class="edit-post form <%= 'draft' if @draft %>"
|
3
|
+
method="post"
|
4
|
+
action="<%= url("posts/#{@post.path}") %>">
|
5
|
+
|
6
|
+
<%= partial 'posts/meta' %>
|
7
|
+
|
8
|
+
<input tabindex="1"
|
9
|
+
id="post-title"
|
10
|
+
type="text"
|
11
|
+
name="meta[title]"
|
12
|
+
value="<%= @post.title %>"
|
13
|
+
placeholder="Title here" />
|
14
|
+
|
15
|
+
<textarea
|
16
|
+
tabindex="2"
|
17
|
+
id="post-content"
|
18
|
+
cols="80" rows="20"
|
19
|
+
name="content"><%= @post.content %></textarea>
|
20
|
+
|
21
|
+
<%= partial 'posts/navbar' %>
|
22
|
+
|
23
|
+
</form>
|
24
|
+
|
25
|
+
<%= partial 'uploads/form' %>
|
26
|
+
|
27
|
+
<script>$(function() { $('#post-content').focus() })</script>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<div class="dark fixed navbar">
|
2
|
+
<div class="container">
|
3
|
+
<ul class="menu menu-horizontal">
|
4
|
+
<li><a target="_blank" href="/">View site</a></li>
|
5
|
+
</ul>
|
6
|
+
|
7
|
+
<ul class="right menu menu-horizontal">
|
8
|
+
<form method="post" action="<%= url('/build') %>">
|
9
|
+
<li><button class="btn btn-danger" type="submit">Rebuild!</button></li>
|
10
|
+
</form>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="responsive padded two columns">
|
16
|
+
<div class="post-list">
|
17
|
+
<a class="right btn btn-primary" href="<%= url("/posts/new") %>">New draft</a>
|
18
|
+
|
19
|
+
<h2><%= @drafts.count %> drafts</h2>
|
20
|
+
|
21
|
+
<div id="drafts-list">
|
22
|
+
<% @list = @drafts; @draft = true %>
|
23
|
+
<%= partial 'posts/list' %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="post-list">
|
28
|
+
<form id="search-form" class="right form" action="<%= url('/search') %>">
|
29
|
+
<input id="search-input" type="search" name="q" placeholder="Type to search" />
|
30
|
+
</form>
|
31
|
+
|
32
|
+
<h2>Last <%= @posts.count %> posts</h2>
|
33
|
+
|
34
|
+
<div id="posts-list">
|
35
|
+
<% @draft = false; @list = @posts %>
|
36
|
+
<%= partial 'posts/list' %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<form id="post-form" class="new-post form" method="post" action="<%= url('/posts') %>">
|
2
|
+
|
3
|
+
<input tabindex="1"
|
4
|
+
id="post-title"
|
5
|
+
type="text"
|
6
|
+
name="meta[title]"
|
7
|
+
required="true"
|
8
|
+
value="<%= params[:title] %>"
|
9
|
+
placeholder="Title here" />
|
10
|
+
|
11
|
+
<textarea tabindex="2"
|
12
|
+
id="post-content"
|
13
|
+
cols="80"
|
14
|
+
rows="20"
|
15
|
+
name="content"
|
16
|
+
placeholder="Tell your story, here."></textarea>
|
17
|
+
|
18
|
+
<%= partial 'posts/navbar' %>
|
19
|
+
|
20
|
+
</form>
|
21
|
+
|
22
|
+
<script>$(function() { $('#post-title').focus() })</script>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if Artifact.respond_to?(:files) %>
|
2
|
+
<li>
|
3
|
+
<a href="<%= url('/') %>">Files</a>
|
4
|
+
</li>
|
5
|
+
<% end %>
|
6
|
+
<% if Artifact.respond_to?(:posts) %>
|
7
|
+
<li>
|
8
|
+
<a href="/">View site</a>
|
9
|
+
</li>
|
10
|
+
<li>
|
11
|
+
<a href="<%= url('/posts') %>">Posts</a>
|
12
|
+
</li>
|
13
|
+
<% end %>
|
14
|
+
<% if Artifact.respond_to?(:uploads) %>
|
15
|
+
<li>
|
16
|
+
<a href="<%= url('/uploads') %>">Uploads</a>
|
17
|
+
</li>
|
18
|
+
<% end %>
|