Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: joelmoss/Gitchen
base: 21f3d83683
...
head fork: joelmoss/Gitchen
compare: 62f5145000
  • 5 commits
  • 23 files changed
  • 0 commit comments
  • 1 contributor
View
2  Gemfile
@@ -11,7 +11,7 @@ gem 'tire'
gem 'sidekiq'
gem 'slim'
gem 'sinatra'
-
+gem 'exceptional'
# Gems used only for assets and not required
# in production environments by default.
View
19 Gemfile.lock
@@ -56,6 +56,8 @@ GEM
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (0.12.10)
+ exceptional (2.0.32)
+ rack
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (3.0.0)
@@ -71,8 +73,7 @@ GEM
faraday (>= 0.7.4, < 0.9)
ffaker (1.14.0)
ffi (1.0.11)
- foreman (0.40.0)
- term-ansicolor (~> 1.0.7)
+ foreman (0.41.0)
thor (>= 0.13.6)
growl (1.0.3)
guard (1.0.1)
@@ -92,7 +93,7 @@ GEM
has_scope (~> 0.5.0)
responders (~> 0.6)
journey (1.0.3)
- jquery-rails (2.0.1)
+ jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.6)
@@ -131,7 +132,7 @@ GEM
omniauth-oauth2 (1.0.0)
oauth2 (~> 0.5.0)
omniauth (~> 1.0)
- pg (0.11.0)
+ pg (0.13.2)
polyglot (0.3.3)
puma (1.1.1)
rack (~> 1.2)
@@ -175,7 +176,7 @@ GEM
rspec-expectations (~> 2.9.0)
rspec-mocks (~> 2.9.0)
rspec-core (2.9.0)
- rspec-expectations (2.9.0)
+ rspec-expectations (2.9.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.9.0)
rspec-rails (2.9.0)
@@ -188,8 +189,8 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- sidekiq (0.10.1)
- celluloid
+ sidekiq (0.11.1)
+ celluloid (~> 0.10.0)
connection_pool (~> 0.9.0)
multi_json
redis
@@ -207,7 +208,6 @@ GEM
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
temple (0.4.0)
- term-ansicolor (1.0.7)
therubyracer (0.10.0)
libv8 (~> 3.3.10)
thin (1.3.1)
@@ -233,7 +233,7 @@ GEM
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
- webmock (1.8.5)
+ webmock (1.8.6)
addressable (>= 2.2.7)
crack (>= 0.1.7)
@@ -242,6 +242,7 @@ PLATFORMS
DEPENDENCIES
coffee-rails (~> 3.2.1)
+ exceptional
factory_girl_rails
ffaker
foreman
View
2  Procfile
@@ -1,2 +1,2 @@
-web: bundle exec rails server thin -p $PORT -e $RACK_ENV
+web: bundle exec rails server thin start -p $PORT -e $RACK_ENV
worker: bundle exec sidekiq -e $RACK_ENV -c 1
View
24 README.rdoc
@@ -21,40 +21,28 @@ Github repos.
- Browse by:
- language
- user
- - forks
+ - forks (coming soon)
- - Sort by:
+ - Sort by: (coming soon)
- watchers
- forks
- issues
- size
- owner's followers
- - Additional features:
+ - Additional features: (coming soon)
- Add tags
- Add notes or modify (overwrite) description
-=== Popularity/Rating/Score
+=== Popularity/Rating/Score (TBD)
-Each repo (and possible each user) is given a score based on his repo's stats forks,
+Each repo (and possibly each user) is given a score based on his repo's stats forks,
watchers and issues.
-=== Process
-
- - Sign up
- - fetch users watched repos [GET /users/:user/watched]
-
- - Sign in
- - update users watched repos (max once every 24 hours) [GET /users/:user/watched]
-
- - On every signed in request
- - update users watched repos (max once every 24 hours) [GET /users/:user/watched]
-
-
-=== Utilities/Tools
+=== Utilities/Tools (coming soon)
- Prune watched repos
- stop watching repos not updated since x days/weeks/months
View
16 app/assets/javascripts/application.js
@@ -1,16 +0,0 @@
-// This is a manifest file that'll be compiled into application.js, which will include all the files
-// listed below.
-//
-// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
-// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
-//
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
-// GO AFTER THE REQUIRES BELOW.
-//
-//= require jquery
-//= require jquery_ujs
-//= require twitter/bootstrap
-//= require_tree .
View
59 app/assets/javascripts/application.js.coffee
@@ -0,0 +1,59 @@
+# This is a manifest file that'll be compiled into application.js, which will include all the files
+# listed below.
+#
+# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+#
+# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+# the compiled file.
+#
+# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+# GO AFTER THE REQUIRES BELOW.
+#
+#= require jquery
+#= require jquery_ujs
+#= require twitter/bootstrap
+
+
+$ ->
+ $("a[rel=popover]").popover()
+ $(".tooltip").tooltip()
+ $("a[rel=tooltip]").tooltip()
+
+
+# Fetch repos on loading page
+# -----------------------------------------------------------------------------
+
+$ ->
+ if $('#loading').size() > 0
+ fetch_repos = ->
+ $.getJSON '/repos', (data)->
+ if data.success
+ location.reload()
+ else
+ setTimeout fetch_repos, 10000
+
+ setTimeout fetch_repos, 10000
+
+
+# Handle ajax modals
+# -----------------------------------------------------------------------------
+
+$ ->
+
+ $('[data-toggle=modal-ajax]').on 'click', ->
+
+ # Create the modal div and append to the body
+ div = $('<div class="modal fade modal-ajax">loading...</div>')
+ div.appendTo('body')
+
+ # It's a modal!
+ div.modal()
+
+ # Cleanup the modal after it is hidden
+ div.on 'hidden', -> div.remove()
+
+ # Load the HTML into the modal
+ div.load $(this).attr('href')
+
+ false
View
27 app/assets/javascripts/bootstrap.js.coffee
@@ -1,27 +0,0 @@
-$ ->
- $("a[rel=popover]").popover()
- $(".tooltip").tooltip()
- $("a[rel=tooltip]").tooltip()
-
-
-# Handle ajax modals
-# -----------------------------------------------------------------------------
-
-$ ->
-
- $('[data-toggle=modal-ajax]').on 'click', ->
-
- # Create the modal div and append to the body
- div = $('<div class="modal fade modal-ajax">loading...</div>')
- div.appendTo('body')
-
- # It's a modal!
- div.modal()
-
- # Cleanup the modal after it is hidden
- div.on 'hidden', -> div.remove()
-
- # Load the HTML into the modal
- div.load $(this).attr('href')
-
- false
View
59 app/assets/javascripts/homepage.js.coffee
@@ -0,0 +1,59 @@
+# This is a manifest file that'll be compiled into application.js, which will include all the files
+# listed below.
+#
+# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+#
+# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+# the compiled file.
+#
+# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+# GO AFTER THE REQUIRES BELOW.
+#
+#= require jquery
+#= require jquery_ujs
+
+
+# Homepage animation
+# -----------------------------------------------------------------------------
+
+$ ->
+ $.fn.vAlign = ->
+ this.each ->
+ ah = $(this).height()
+ ph = $(window).height()
+ mh = (ph - ah) / 2
+ $(this).css 'top', if mh < 100 then 100 else mh
+
+$ ->
+ $(window).on 'resize', -> $('#home .content').vAlign()
+
+
+ animate_home = ->
+ $('#home .content').vAlign()
+ css_opts = {display: 'none', visibility: 'visible'}
+
+ $('#home h2:first').css(css_opts).fadeIn 2000, ->
+ $(this).fadeOut 2000, ->
+ $(this).remove()
+ $('#home h2:first').css(css_opts).fadeIn 2000, ->
+ $(this).fadeOut 2000, ->
+ $(this).remove()
+ $('#home h2:first').css(css_opts).fadeIn 2000, ->
+ $(this).fadeOut 2000, ->
+ $(this).remove()
+ $('#home h2:first').css(css_opts).fadeIn 2000, ->
+ $(this).fadeOut 2000, ->
+ $(this).remove()
+ $('#home h2:first').css(css_opts).fadeIn 2000, ->
+ $(this).fadeOut 3000, ->
+ $(this).remove()
+ $('#home h1').fadeIn 2000, ->
+ $('#home .navbar-fixed-top').fadeIn 3000
+ $('#home .btn-large').fadeIn 1000, ->
+ $('#home footer').fadeIn 1000
+
+
+ setTimeout animate_home, 1000
+
+
View
99 app/assets/stylesheets/app/styles.css.scss
@@ -0,0 +1,99 @@
+@import 'libs/spacing';
+
+
+/* Utilities
+/* ---------------------------------------------------------------------------- */
+
+.table th.right, .table td.right, .right {
+ text-align: right;
+}
+.table th.left, .table td.left, .left {
+ text-align: left;
+}
+
+#loading {
+ background: transparent image-url('loading.gif') no-repeat scroll center center;
+ height: 150px;
+}
+
+#user_display_bar {
+ img {
+ border: 4px solid #666;
+ margin-left: 8px;
+ }
+ color: #CCC;
+ font-size: 11px;
+ span {
+ color: #fff;
+ font-size: 15px;
+ font-weight: bold;
+ }
+}
+
+
+/* Layout
+/* ---------------------------------------------------------------------------- */
+
+body {
+ background: #DDD image-url('layout/dark_wood.png') repeat scroll top left;
+}
+
+footer {
+ border-top: 1px dashed #333;
+ color: #666;
+ margin: 65px 0 40px;
+ font-size: 12px;
+ padding-top: 10px;
+
+ a {
+ color: #888;
+ &:hover {
+ color: #CCC;
+ text-decoration: none;
+ }
+ }
+}
+
+.navbar {
+ .navbar-inner {
+ background: #DDD image-url('layout/nav_bg.gif') repeat-x scroll top left;
+ height: 47px;
+ padding-top: 15px;
+
+ .nav {
+ margin: {
+ top: 2px;
+ // left: 20px;
+ }
+ font: {
+ family: 'Terminal Dosis', sans-serif;
+ transform: uppercase;
+ size: 15px;
+ weight: 600;
+ }
+ line-height: 44px;
+ letter-spacing: 1px;
+ }
+
+ .brand {
+ background: transparent image-url('layout/logo.png') no-repeat scroll top left;
+ text-indent: -9999px;
+ width: 252px !important;
+ height: 99px;
+ padding: 0 !important;
+ margin: 0 auto;
+ position: relative;
+ top: -7px;
+ text-align: center;
+ float: none;
+ z-index: 2;
+ }
+ }
+
+ .navbar-bottom {
+ height: 17px;
+ opacity: 0.2;
+ background-color: #FFF;
+ z-index: 1;
+ }
+}
View
6 app/assets/stylesheets/application.css
@@ -9,5 +9,7 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
- *= require_directory .
-*/
+ *= require bootstrap
+ *= require common
+ *= require_tree ./app
+*/
View
1  ...lesheets/bootstrap_and_overrides.css.less → app/assets/stylesheets/bootstrap.css.less
@@ -18,6 +18,7 @@ body { padding-top: 100px; }
@linkColor: #468847;
+
.well {
background: #DDD image-url('layout/furley_bg.png') repeat scroll top left;
}
View
49 app/assets/stylesheets/home/styles.css.less
@@ -0,0 +1,49 @@
+/* Homepage
+/* ---------------------------------------------------------------------------- */
+
+#home {
+ .content {
+ margin: auto;
+ position: absolute;
+ text-align: center;
+ width: 100%;
+ left: 0;
+ margin-bottom: 40px;
+ }
+
+ .navbar-fixed-top {
+ display: none;
+ }
+
+ h1 {
+ display: none;
+ font-family: 'Terminal Dosis', sans-serif;
+ font-size: 60px;
+ margin: 60px 0;
+ text-transform: uppercase;
+ color: #FFF;
+ text-shadow: 1px 1px #666;
+ }
+
+ h2 {
+ font-family: 'Terminal Dosis', sans-serif;
+ color: #FFF;
+ text-shadow: 1px 1px #666;
+ display: block;
+ visibility: hidden;
+ }
+
+ .btn-large {
+ display: none;
+ text-shadow: 1px 1px #666;
+ padding: 10px 25px;
+ font-size: 26px;
+ }
+
+ footer {
+ display: none;
+ position: absolute;
+ bottom: 0;
+ margin-bottom: 20px;
+ }
+}
View
15 app/assets/stylesheets/homepage.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require bootstrap
+ *= require common
+ *= require_tree ./home
+*/
View
5 app/controllers/application_controller.rb
@@ -2,10 +2,15 @@ class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user, :signed_in?
+ before_filter :get_repo_count, if: :signed_in?
private
+ def get_repo_count
+ @repo_count = current_user.watchings.count
+ end
+
def current_user
return nil unless session[:user_id]
View
9 app/controllers/pages_controller.rb
@@ -0,0 +1,9 @@
+class PagesController < ApplicationController
+
+ layout 'home', only: :index
+
+ def index
+ redirect_to repos_url and return if signed_in?
+ end
+
+end
View
9 app/controllers/repos_controller.rb
@@ -8,7 +8,14 @@ class ReposController < ApplicationController
def index
- @repos = current_user.watchings.page(params[:page]).includes(:owner)
+ respond_to do |wants|
+ wants.html do
+ @repos = current_user.watchings.page(params[:page]).includes(:owner)
+ end
+ wants.js do
+ render json: { success: current_user.watchings.count > 0 }
+ end
+ end
end
def show
View
0  app/models/.gitkeep
No changes.
View
8 app/views/layouts/application.html.erb
@@ -34,18 +34,16 @@
<div class="nav-collapse">
<ul class="nav">
- <% if signed_in? %>
+ <% if signed_in? && @repo_count %>
<li class="<%= 'active' if controller_name == 'repos' %>"><%= link_to "REPOS", repos_path %></li>
<li class="<%= 'active' if controller_name == 'languages' %>"><%= link_to "LANGUAGES", languages_path %></li>
<li class="<%= 'active' if controller_name == 'users' %>"><%= link_to "USERS", users_path %></li>
- <% else %>
- <li><%= link_to 'SIGN IN...', sign_in_path %></li>
<% end %>
</ul>
<%= form_tag searches_path, method: 'get', class: 'navbar-search pull-right' do %>
<%= text_field_tag :q, params[:q], class: "search-query", placeholder: "Search" %>
- <%- end -%>
+ <%- end if signed_in? && @repo_count -%>
</div><!--/.nav-collapse -->
<a class="brand" href="/">Gitchen</a>
@@ -72,8 +70,6 @@
<div class="pull-right"><%= image_tag current_user.avatar_url, :size => "32x32" %></div>
<div class="pull-right">you are signed in as<br /><span><%= current_user %></span></div>
</div>
- <%- else -%>
- <span><%= link_to 'Sign in via Github', sign_in_path %></span>
<%- end -%>
</div>
</div>
View
66 app/views/layouts/home.html.erb
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Manage your watched Github Repos - What's in your Gitchen?</title>
+ <%= csrf_meta_tags %>
+
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
+ <![endif]-->
+
+ <!-- Le styles -->
+ <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis:600' rel='stylesheet' type='text/css'>
+ <%= stylesheet_link_tag "homepage", :media => "all" %>
+
+ <!-- Le fav and touch icons -->
+ <link href="images/favicon.ico" rel="shortcut icon">
+ <link href="images/apple-touch-icon.png" rel="apple-touch-icon">
+ <link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72">
+ <link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114">
+ </head>
+ <body id="home">
+
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="brand" href="/">Gitchen</a>
+ </div>
+ </div>
+ <div class="navbar-bottom"></div>
+ </div>
+
+ <div class="container">
+ <div class="content">
+ <%= yield %>
+ </div><!--/content-->
+
+ <footer>
+ <div class="row">
+ <div class="span6">
+ <a href="https://github.com/joelmoss/gitchen">Gitchen</a> is <%= link_to 'Developed with Style', 'http://developwithstyle.com' %> by <%= link_to '@joelmoss', 'http://twitter.com/joelmoss' %> &copy; <%= Date.today.year %>
+ <br>
+ <a href="https://github.com/joelmoss/gitchen">Fork me on Github...</a>
+ </div>
+ <div class="span6 right">
+ <%- if signed_in? -%>
+ Signed in via <%= link_to 'Github', current_user.html_url %> as <%= current_user %> //
+ <%= link_to 'sign out', sign_out_path, :method => :delete, :confirm => "Are you sure you want to sign out?" %>
+ <% else %>
+ <%= link_to 'Sign in via Github', sign_in_path %>
+ <%- end -%>
+ </div>
+ </div>
+ </footer>
+
+ </div> <!-- /container -->
+
+ <!-- Le javascript
+ ================================================== -->
+ <!-- Placed at the end of the document so the pages load faster -->
+ <%= javascript_include_tag "homepage" %>
+
+ </body>
+</html>
View
10 app/views/pages/index.html.erb
@@ -0,0 +1,10 @@
+<h2 class="first">Use Github?</h2>
+<h2>Watching hundreds of Github repos?</h2>
+<h2>Want to search just within those repos?</h2>
+<h2>Want to browse them by language?</h2>
+<h2>Or maybe by popularity?</h2>
+
+<h1>What's in your Gitchen?</h1>
+<%= link_to sign_in_path, class: 'btn btn-large btn-primary' do %>
+ <strong>FIND OUT NOW &raquo;</strong>
+<% end -%>
View
5 app/views/repos/index.html.erb
@@ -1,8 +1,9 @@
<% if @repos.empty? %>
+ <% title 'Fetching your watched repos...' -%>
<div class="alert alert-info">
- <h4 class="alert-heading">Fetching your watched repos...</h4>
- Please wait a few seconds, and they should start to appear below.
+ <h4 class="alert-heading">We are fetching your watched repos from Github...</h4>
+ Please wait a few seconds, and they should start to appear below. If you think you have been waiting too long (10 seconds is not too long, 10 days is!), please refresh this page. If you still don't see anything, please <a href="https://github.com/joelmoss/gitchen/issues" target="_blank">let me know</a>.
</div>
<div id="loading"></div>
View
3  app/workers/hard_worker.rb
@@ -2,6 +2,7 @@ class HardWorker
include Sidekiq::Worker
def perform(id)
- User.find(id).fetch_watched_repos
+ user = User.find(id)
+ user.fetch_watched_repos unless user.fetching_repos?
end
end
View
2  config/routes.rb
@@ -9,7 +9,7 @@
get 'repos/:owner/:id' => 'repos#show', as: :repo
resources :languages, :users, :searches, only: [ :index, :show ]
- root to: "repos#index"
+ root to: "pages#index"
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'

No commit comments for this range

Something went wrong with that request. Please try again.