clipster 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -20
- data/README.rdoc +53 -52
- data/Rakefile +34 -34
- data/app/assets/javascripts/clipster/application.js +15 -15
- data/app/assets/javascripts/clipster/bootstrap.js +2026 -2026
- data/app/assets/javascripts/clipster/bootstrap.min.js +5 -5
- data/app/assets/javascripts/clipster/clip.js +2 -2
- data/app/assets/javascripts/clipster/clips.js +2 -2
- data/app/assets/stylesheets/clipster/application.css +27 -15
- data/app/assets/stylesheets/clipster/bootstrap.css +5774 -5774
- data/app/assets/stylesheets/clipster/clip.css +21 -21
- data/app/assets/stylesheets/clipster/clips.css +4 -4
- data/app/controllers/clipster/application_controller.rb +7 -7
- data/app/controllers/clipster/clips_controller.rb +80 -67
- data/app/helpers/clipster/application_helper.rb +4 -4
- data/app/helpers/clipster/clip_helper.rb +4 -4
- data/app/helpers/clipster/clips_helper.rb +4 -4
- data/app/models/clipster/clip.rb +74 -23
- data/app/views/clipster/clips/about.html.erb +15 -0
- data/app/views/clipster/clips/create.html.erb +46 -36
- data/app/views/clipster/clips/expired.html.erb +1 -0
- data/app/views/clipster/clips/list.html.erb +43 -37
- data/app/views/clipster/clips/show.html.erb +7 -5
- data/app/views/kaminari/_first_page.html.erb +3 -0
- data/app/views/kaminari/_gap.html.erb +3 -0
- data/app/views/kaminari/_last_page.html.erb +3 -0
- data/app/views/kaminari/_next_page.html.erb +3 -0
- data/app/views/kaminari/_page.html.erb +3 -0
- data/app/views/kaminari/_paginator.html.erb +17 -0
- data/app/views/kaminari/_prev_page.html.erb +3 -0
- data/app/views/layouts/clipster/application.html.erb +49 -48
- data/config/routes.rb +14 -13
- data/config/schedule.rb +10 -0
- data/db/migrate/20121004010757_create_clipster_clips.rb +16 -16
- data/db/migrate/20121007154400_add_hash_index_to_clips.rb +13 -13
- data/db/migrate/20121007155125_populate_clip_defaults.rb +21 -21
- data/db/migrate/20121007162741_rename_hash_to_url_hash.rb +9 -9
- data/db/migrate/20121007223358_remove_default_from_language.rb +9 -9
- data/db/migrate/20121007223631_set_default_title_to_untitled.rb +9 -9
- data/db/migrate/20121105212724_add_lifespan_to_clips.rb +9 -0
- data/lib/clipster/engine.rb +15 -14
- data/lib/clipster/version.rb +3 -3
- data/lib/clipster.rb +4 -4
- data/lib/tasks/clipster_tasks.rake +4 -4
- metadata +46 -3
@@ -1,48 +1,49 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<title>Clipster</title>
|
5
|
-
<%= stylesheet_link_tag "clipster/application", :media => "all" %>
|
6
|
-
|
7
|
-
<%= javascript_include_tag "clipster/application" %>
|
8
|
-
<%= csrf_meta_tags %>
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
<div class="container">
|
12
|
-
<div class="navbar navbar-inverse navbar-fixed-top">
|
13
|
-
<div class="navbar-inner">
|
14
|
-
<div class="container">
|
15
|
-
<div class="nav-collapse collapse">
|
16
|
-
<%= link_to "Clipster", root_path, :class => "brand" %>
|
17
|
-
<ul class="nav">
|
18
|
-
<li><%= link_to "New Clip",
|
19
|
-
<li><%= link_to "Recent Clips",
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
<
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
</
|
48
|
-
</
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>Clipster</title>
|
5
|
+
<%= stylesheet_link_tag "clipster/application", :media => "all" %>
|
6
|
+
|
7
|
+
<%= javascript_include_tag "clipster/application" %>
|
8
|
+
<%= csrf_meta_tags %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="container">
|
12
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
13
|
+
<div class="navbar-inner">
|
14
|
+
<div class="container">
|
15
|
+
<div class="nav-collapse collapse">
|
16
|
+
<%= link_to "Clipster", root_path, :class => "brand" %>
|
17
|
+
<ul class="nav">
|
18
|
+
<li><%= link_to "New Clip", :action=>:create %></li>
|
19
|
+
<li><%= link_to "Recent Clips", :action=>:list %></li>
|
20
|
+
<li><%= link_to "About", :action=>:about %></li>
|
21
|
+
</ul>
|
22
|
+
<!-- <form class="navbar-search pull-right"> -->
|
23
|
+
<%= form_tag(search_clips_path, :method => 'get', :class => 'navbar-search pull-right') do %>
|
24
|
+
<%= text_field_tag(:search_term, "", :class=>"search-query", :placeholder=>"Search") %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<%#
|
33
|
+
Do we want a header, if so this is how we do it. not sure if needed with fixed navbar
|
34
|
+
<header class="jumbotron">
|
35
|
+
<div class="container">
|
36
|
+
<h3>Clipster</h3>
|
37
|
+
<p class="lead">Code snippets before they were cool</p>
|
38
|
+
</div>
|
39
|
+
</header>
|
40
|
+
%>
|
41
|
+
<div class="container">
|
42
|
+
<div class="row">
|
43
|
+
<div class="span12">
|
44
|
+
<%= yield %>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</body>
|
49
|
+
</html>
|
data/config/routes.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
Clipster::Engine.routes.draw do
|
2
|
-
#/clipster route
|
3
|
-
|
4
|
-
resources :clips, :path => "/" do
|
5
|
-
collection do
|
6
|
-
get 'list', :action => :list
|
7
|
-
get 'list(/:lang)(.:format)', :action => :list
|
8
|
-
get 'search', :action => :search
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
Clipster::Engine.routes.draw do
|
2
|
+
#/clipster route
|
3
|
+
|
4
|
+
resources :clips, :path => "/" do
|
5
|
+
collection do
|
6
|
+
get 'list', :action => :list
|
7
|
+
get 'list(/:lang)(.:format)', :action => :list
|
8
|
+
get 'search', :action => :search
|
9
|
+
get 'about', :action => :about
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
root :to => :clips
|
14
|
+
end
|
data/config/schedule.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Use this file to easily define all of your cron jobs.
|
2
|
+
#
|
3
|
+
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
4
|
+
# http://en.wikipedia.org/wiki/Cron
|
5
|
+
|
6
|
+
every :day, :at => '3:00 am' do
|
7
|
+
runner "Clip.delete_expired_clips"
|
8
|
+
end
|
9
|
+
|
10
|
+
# Learn more: http://github.com/javan/whenever
|
@@ -1,16 +1,16 @@
|
|
1
|
-
class CreateClipsterClips < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
create_table :clipster_clips do |t|
|
4
|
-
t.string :hash, :null => false
|
5
|
-
t.text :clip, :null => false
|
6
|
-
t.string :language, :null => false
|
7
|
-
t.string :title, :null => false
|
8
|
-
t.boolean :private, :null => false
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def down
|
14
|
-
drop_table :clipster_clips
|
15
|
-
end
|
16
|
-
end
|
1
|
+
class CreateClipsterClips < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :clipster_clips do |t|
|
4
|
+
t.string :hash, :null => false
|
5
|
+
t.text :clip, :null => false
|
6
|
+
t.string :language, :null => false
|
7
|
+
t.string :title, :null => false
|
8
|
+
t.boolean :private, :null => false
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :clipster_clips
|
15
|
+
end
|
16
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
class AddHashIndexToClips < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_table :clipster_clips do |t|
|
4
|
-
t.index :hash, :unique => true
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def down
|
9
|
-
change_table :clipster_clips do |t|
|
10
|
-
t.remove_index :hash
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
class AddHashIndexToClips < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_table :clipster_clips do |t|
|
4
|
+
t.index :hash, :unique => true
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
change_table :clipster_clips do |t|
|
10
|
+
t.remove_index :hash
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
class PopulateClipDefaults < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_table :clipster_clips do |t|
|
4
|
-
t.change_default :hash, ''
|
5
|
-
t.change_default :clip, ''
|
6
|
-
t.change_default :title, ''
|
7
|
-
t.change_default :language, ''
|
8
|
-
t.change_default :private, false
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def down
|
13
|
-
change_table :clipster_clips do |t|
|
14
|
-
t.change_default :hash, nil
|
15
|
-
t.change_default :clip, nil
|
16
|
-
t.change_default :title, nil
|
17
|
-
t.change_default :language, nil
|
18
|
-
t.change_default :private, false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
class PopulateClipDefaults < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_table :clipster_clips do |t|
|
4
|
+
t.change_default :hash, ''
|
5
|
+
t.change_default :clip, ''
|
6
|
+
t.change_default :title, ''
|
7
|
+
t.change_default :language, ''
|
8
|
+
t.change_default :private, false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
change_table :clipster_clips do |t|
|
14
|
+
t.change_default :hash, nil
|
15
|
+
t.change_default :clip, nil
|
16
|
+
t.change_default :title, nil
|
17
|
+
t.change_default :language, nil
|
18
|
+
t.change_default :private, false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class RenameHashToUrlHash < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
rename_column :clipster_clips, :hash, :url_hash
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
rename_column :clipster_clips, :url_hash, :hash
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class RenameHashToUrlHash < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
rename_column :clipster_clips, :hash, :url_hash
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
rename_column :clipster_clips, :url_hash, :hash
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class RemoveDefaultFromLanguage < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_column_default :clipster_clips, :language, nil
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
change_column_default :clipster_clips, :language, ''
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class RemoveDefaultFromLanguage < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_column_default :clipster_clips, :language, nil
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
change_column_default :clipster_clips, :language, ''
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class SetDefaultTitleToUntitled < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_column_default :clipster_clips, :title, 'Untitled'
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
change_column_default :clipster_clips, :title, ''
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class SetDefaultTitleToUntitled < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_column_default :clipster_clips, :title, 'Untitled'
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
change_column_default :clipster_clips, :title, ''
|
8
|
+
end
|
9
|
+
end
|
data/lib/clipster/engine.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
require 'coderay'
|
2
|
-
require 'dynamic_form'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
g.
|
12
|
-
|
13
|
-
|
14
|
-
end
|
1
|
+
require 'coderay'
|
2
|
+
require 'dynamic_form'
|
3
|
+
require 'kaminari'
|
4
|
+
|
5
|
+
module Clipster
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
isolate_namespace Clipster
|
8
|
+
|
9
|
+
# so we can use rspec generators
|
10
|
+
config.generators do |g|
|
11
|
+
g.test_framework :rspec
|
12
|
+
g.integration_tool :rspec
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/clipster/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Clipster
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
1
|
+
module Clipster
|
2
|
+
VERSION = "0.3.0"
|
3
|
+
end
|
data/lib/clipster.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "clipster/engine"
|
2
|
-
|
3
|
-
module Clipster
|
4
|
-
end
|
1
|
+
require "clipster/engine"
|
2
|
+
|
3
|
+
module Clipster
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# desc "Explaining what the task does"
|
2
|
-
# task :clipster do
|
3
|
-
# # Task goes here
|
4
|
-
# end
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :clipster do
|
3
|
+
# # Task goes here
|
4
|
+
# end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -76,6 +76,38 @@ dependencies:
|
|
76
76
|
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: whenever
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :runtime
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: kaminari
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
79
111
|
- !ruby/object:Gem::Dependency
|
80
112
|
name: sqlite3
|
81
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,20 +161,31 @@ files:
|
|
129
161
|
- app/controllers/clipster/application_controller.rb
|
130
162
|
- app/controllers/clipster/clips_controller.rb
|
131
163
|
- app/helpers/clipster/application_helper.rb
|
132
|
-
- app/helpers/clipster/clip_helper.rb
|
133
164
|
- app/helpers/clipster/clips_helper.rb
|
165
|
+
- app/helpers/clipster/clip_helper.rb
|
134
166
|
- app/models/clipster/clip.rb
|
167
|
+
- app/views/clipster/clips/about.html.erb
|
135
168
|
- app/views/clipster/clips/create.html.erb
|
169
|
+
- app/views/clipster/clips/expired.html.erb
|
136
170
|
- app/views/clipster/clips/list.html.erb
|
137
171
|
- app/views/clipster/clips/show.html.erb
|
172
|
+
- app/views/kaminari/_first_page.html.erb
|
173
|
+
- app/views/kaminari/_gap.html.erb
|
174
|
+
- app/views/kaminari/_last_page.html.erb
|
175
|
+
- app/views/kaminari/_next_page.html.erb
|
176
|
+
- app/views/kaminari/_page.html.erb
|
177
|
+
- app/views/kaminari/_paginator.html.erb
|
178
|
+
- app/views/kaminari/_prev_page.html.erb
|
138
179
|
- app/views/layouts/clipster/application.html.erb
|
139
180
|
- config/routes.rb
|
181
|
+
- config/schedule.rb
|
140
182
|
- db/migrate/20121004010757_create_clipster_clips.rb
|
141
183
|
- db/migrate/20121007154400_add_hash_index_to_clips.rb
|
142
184
|
- db/migrate/20121007155125_populate_clip_defaults.rb
|
143
185
|
- db/migrate/20121007162741_rename_hash_to_url_hash.rb
|
144
186
|
- db/migrate/20121007223358_remove_default_from_language.rb
|
145
187
|
- db/migrate/20121007223631_set_default_title_to_untitled.rb
|
188
|
+
- db/migrate/20121105212724_add_lifespan_to_clips.rb
|
146
189
|
- lib/clipster/engine.rb
|
147
190
|
- lib/clipster/version.rb
|
148
191
|
- lib/clipster.rb
|