catbird 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/catbird ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # FIXME: This is sooo hacky...
4
+
5
+ Dir.chdir File.dirname(__FILE__) do
6
+
7
+ system '
8
+ # Start the server
9
+ cd src
10
+ thin start --daemonize --debug
11
+ cd ..
12
+
13
+ # Start the gui
14
+ ./catbird-gui
15
+
16
+
17
+ # When the app closes, stop the server and delete leftover logs
18
+ cd src
19
+ thin stop
20
+ rm -r log
21
+ rm -r tmp
22
+ '
23
+
24
+ end
data/catbird-gui.vala ADDED
@@ -0,0 +1,50 @@
1
+ using Gtk;
2
+ using WebKit;
3
+
4
+ public class CatbirdWindow : Window {
5
+ private WebView web_view;
6
+
7
+ public CatbirdWindow () {
8
+ this.title = "Catbird";
9
+ set_default_size (800, 600);
10
+
11
+ create_widgets ();
12
+ connect_signals ();
13
+ }
14
+
15
+ private void create_widgets () {
16
+ this.web_view = new WebView ();
17
+ var scrolled_window = new ScrolledWindow (null, null);
18
+ scrolled_window.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
19
+ scrolled_window.add (this.web_view);
20
+ add (scrolled_window);
21
+ }
22
+
23
+ private void connect_signals () {
24
+ this.destroy.connect (Gtk.main_quit);
25
+
26
+ this.web_view.load_error.connect ((view, frame, uri, error) => {
27
+ Thread.usleep (200000);
28
+
29
+ this.web_view.load_uri ("http://localhost:3000");
30
+
31
+ return true;
32
+ });
33
+ }
34
+
35
+ public void run () {
36
+ show_all ();
37
+ this.web_view.open ("http://localhost:3000");
38
+ }
39
+
40
+ public static int main (string[] args) {
41
+ Gtk.init (ref args);
42
+
43
+ var catbird = new CatbirdWindow ();
44
+ catbird.run ();
45
+
46
+ Gtk.main ();
47
+
48
+ return 0;
49
+ }
50
+ }
data/extconf.rb ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mkmf'
4
+
5
+ # Make sure we are in the right directory
6
+ Dir.chdir File.dirname(__FILE__) do
7
+
8
+ system "
9
+ echo 'Installing system packages. You will be prompted for your password...'
10
+ sudo apt-get update -y
11
+ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev -y
12
+ sudo apt-get install valac libgtk2.0-dev libwebkitgtk-dev -y
13
+
14
+ echo 'Compiling app...'
15
+ ls
16
+ valac --pkg gtk+-2.0 --pkg webkit-1.0 --thread catbird-gui.vala
17
+ "
18
+ end
19
+
20
+ create_makefile 'foobar'
data/src/app.rb ADDED
@@ -0,0 +1,54 @@
1
+ require 'sinatra'
2
+
3
+ require './models/all.rb'
4
+
5
+ enable :sessions
6
+
7
+ get '/' do
8
+ redirect '/repos'
9
+ end
10
+
11
+ get '/repos' do
12
+ @repos = Repo.all
13
+ erb :repo_list
14
+ end
15
+
16
+ get '/repos/choose/:repo_id' do
17
+ session[:repo_id] = params[:repo_id]
18
+ redirect '/history'
19
+ end
20
+
21
+ get '*' do
22
+ @repo = Repo.get session[:repo_id]
23
+ if @repo.nil?
24
+ redirect '/repos'
25
+ else
26
+ pass
27
+ end
28
+ end
29
+
30
+ get '/history' do
31
+ @current_tab = 'history'
32
+ erb :history
33
+ end
34
+
35
+ get '/changes' do
36
+ @current_tab = 'changes'
37
+ erb :changes
38
+ end
39
+
40
+ get '/branches' do
41
+ @current_tab = 'branches'
42
+ erb :branches
43
+ end
44
+
45
+ get '/settings' do
46
+ @current_tab = 'settings'
47
+ erb :settings
48
+ end
49
+
50
+ helpers do
51
+ def tabs
52
+ %w{history changes branches settings}
53
+ end
54
+ end
data/src/config.ru ADDED
@@ -0,0 +1,2 @@
1
+ require './app'
2
+ run Sinatra::Application
data/src/models/all.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'grit'
2
+ require 'data_mapper'
3
+
4
+ DataMapper::Logger.new $stdout, :debug
5
+ DataMapper.setup(:default, {
6
+ adapter: 'sqlite',
7
+ database: "data.db"
8
+ })
9
+
10
+ require './models/repo'
11
+
12
+ DataMapper.auto_upgrade!
13
+ DataMapper.finalize
@@ -0,0 +1,35 @@
1
+ class Repo
2
+ include DataMapper::Resource
3
+
4
+ property :id, Serial
5
+
6
+ property :name, String
7
+ property :description, String, default: 'No description'
8
+
9
+ property :location, String
10
+ property :fav, Boolean, default: false
11
+
12
+ def initialize
13
+ super
14
+
15
+ @git_repo = nil
16
+ end
17
+
18
+ def commits branch='master', page=1
19
+ # FIXME: explain this
20
+ git_repo.commits branch, 25, (25 * page) - 25
21
+ end
22
+
23
+ def commit_all message
24
+ Dir.chdir self.location do
25
+ git_repo.add '.'
26
+ git_repo.commit_all message
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def git_repo
33
+ @git_repo ||= Grit::Repo.new(self.location)
34
+ end
35
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ <a href="/repos/<%= @repo.id %>/commits/new">New commit</a>
2
+
3
+ <hr />
4
+
5
+ <% @repo.commits('master').each do |commit| %>
6
+ <h2><%= commit.message %>
7
+ <% end %>
@@ -0,0 +1,120 @@
1
+ <html>
2
+ <head>
3
+ <title>Catbird</title>
4
+ </head>
5
+
6
+ <body>
7
+ <style type="text/css">
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ }
12
+
13
+ body {
14
+ background-color: #dbdbdb;
15
+ width: 800px;
16
+
17
+ font: 14px helvetica,arial,freesans,clean,sans-serif;
18
+ line-height: 1.4;
19
+ }
20
+
21
+ #sidebar {
22
+ position: absolute;
23
+ width: 70px;
24
+ height: 100%;
25
+ overflow: hidden;
26
+ background: url(sidebar-background.png);
27
+ text-align: center;
28
+
29
+ -webkit-box-shadow:
30
+ 1px 0px 0px #343434,
31
+ 2px 0px 0px #121212;
32
+ }
33
+
34
+ #sidebar .active {
35
+ font-weight: bold;
36
+ color: white;
37
+ background: -webkit-gradient(linear, left top, left bottom, from(#383838), to(#2e2e2e));
38
+ margin-top: 1px;
39
+ }
40
+
41
+ #sidebar .active img {
42
+ opacity: 1;
43
+ }
44
+
45
+ #sidebar img {
46
+ opacity: 0.25;
47
+ }
48
+
49
+ .sidebar-item {
50
+ text-align: center;
51
+ padding: 10px 0;
52
+ color: #e0e0e0;
53
+ margin-left: 1px;
54
+
55
+ -webkit-box-shadow:
56
+ 0px 1px 0 #282828,
57
+ 0px 2px 0 #4d4d4d;
58
+ }
59
+
60
+ .sidebar-item img {
61
+ padding-bottom: 5px;
62
+ }
63
+
64
+ #main-content {
65
+ position: fixed;
66
+ left: 70px;
67
+ right: 0;
68
+ overflow: auto;
69
+ }
70
+
71
+ #searchbar-container {
72
+ background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#d2d2d2));
73
+
74
+ -webkit-box-shadow:
75
+ /* Top borders */
76
+ 0px -1px 0px #fff, 0px -2px 0px #808080,
77
+ /* Bottom borders */
78
+ 0px 1px 0px #dedede, 0px 2px 0px #838383, 0px 3px 0px #bebebe;
79
+
80
+ margin: 0px;
81
+ margin-left: 2px; /* Ajust for the sidebar shadows */
82
+ margin-bottom: 10px;
83
+
84
+ height: 50px;
85
+ }
86
+
87
+ .repo-cell {
88
+ background: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e7e7e7));
89
+ -webkit-border-radius: .5em;
90
+
91
+ border: 1px solid #a1a1a1;
92
+
93
+ margin-left: 15px;
94
+ margin-right: 15px;
95
+ margin-bottom: 2px;
96
+
97
+ padding: 10px 20px;
98
+ }
99
+
100
+ a {
101
+ text-decoration: none;
102
+ color: black;
103
+ }
104
+ </style>
105
+
106
+ <div id="sidebar">
107
+ <% tabs.each do |tab_name| %>
108
+ <%= erb :tab, :locals => { :name => tab_name, :current => @current_tab } %>
109
+ <% end %>
110
+ </div>
111
+
112
+ <div id="main-content">
113
+ <div id="searchbar-container">
114
+ (insert search bar here)
115
+ </div>
116
+
117
+ <%= yield %>
118
+ </div>
119
+ </body>
120
+ </html>
@@ -0,0 +1,10 @@
1
+ <% @repos.each do |repo| %>
2
+ <a href="/repos/choose/<%= repo.id %>">
3
+ <div class="repo-cell">
4
+ <div class="repo-cell-content">
5
+ <strong><%= repo.name %></strong> <br />
6
+ <span style="color: #444;"><%= repo.description %></span>
7
+ </div>
8
+ </div>
9
+ </a>
10
+ <% end %>
File without changes
data/src/views/tab.erb ADDED
@@ -0,0 +1,8 @@
1
+ <a href="/<%= name %>">
2
+ <div class="sidebar-item <%= current == name ? 'active' : '' %>">
3
+ <img src="<%= name %>-icon.png" />
4
+ <%= name.capitalize %>
5
+ </div>
6
+ </a>
7
+
8
+ <% puts "Tab: #{name} and current: #{current}" %>
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: catbird
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Reed
9
+ autorequire:
10
+ bindir: .
11
+ cert_chain: []
12
+ date: 2011-08-10 00:00:00.000000000 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: Github for Mac for Linux. (Highly unofficial)
16
+ email: dboyreed@charter.net
17
+ executables:
18
+ - catbird
19
+ extensions:
20
+ - extconf.rb
21
+ extra_rdoc_files: []
22
+ files:
23
+ - src/models/repo.rb
24
+ - src/models/all.rb
25
+ - src/public/sidebar-background.png
26
+ - src/public/settings-icon.png
27
+ - src/public/history-icon.png
28
+ - src/public/changes-icon.png
29
+ - src/public/branches-icon.png
30
+ - src/views/layout.erb
31
+ - src/views/settings.erb
32
+ - src/views/repo_list.erb
33
+ - src/views/branches.erb
34
+ - src/views/changes.erb
35
+ - src/views/history.erb
36
+ - src/views/tab.erb
37
+ - src/app.rb
38
+ - src/config.ru
39
+ - catbird
40
+ - catbird-gui.vala
41
+ - extconf.rb
42
+ - ./catbird
43
+ has_rdoc: true
44
+ homepage: https://github.com/davidboy/catbird
45
+ licenses: []
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 1.6.2
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: A simple git client for Linux
68
+ test_files: []