tent-status 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/.gitignore +21 -0
  2. data/.kick +8 -0
  3. data/Gemfile +12 -0
  4. data/Gemfile.lock +232 -0
  5. data/LICENSE.txt +22 -0
  6. data/Procfile +1 -0
  7. data/README.md +14 -0
  8. data/Rakefile +43 -0
  9. data/assets/images/.gitkeep +0 -0
  10. data/assets/images/chosen-sprite.png +0 -0
  11. data/assets/images/glyphicons-halflings-white.png +0 -0
  12. data/assets/images/glyphicons-halflings.png +0 -0
  13. data/assets/javascripts/.gitkeep +0 -0
  14. data/assets/javascripts/application.js.coffee +122 -0
  15. data/assets/javascripts/backbone.js +1443 -0
  16. data/assets/javascripts/backbone_sync.js.coffee +60 -0
  17. data/assets/javascripts/boot.js.coffee +3 -0
  18. data/assets/javascripts/chosen.jquery.js +1129 -0
  19. data/assets/javascripts/collections/.gitkeep +0 -0
  20. data/assets/javascripts/collections/followers.js.coffee +5 -0
  21. data/assets/javascripts/collections/followings.js.coffee +5 -0
  22. data/assets/javascripts/collections/groups.js.coffee +5 -0
  23. data/assets/javascripts/collections/posts.js.coffee +5 -0
  24. data/assets/javascripts/fetch_pool.js.coffee +25 -0
  25. data/assets/javascripts/helpers/.gitkeep +0 -0
  26. data/assets/javascripts/helpers/formatting.js.coffee +17 -0
  27. data/assets/javascripts/hogan.js +706 -0
  28. data/assets/javascripts/http.js.coffee +18 -0
  29. data/assets/javascripts/jquery.js +9301 -0
  30. data/assets/javascripts/models/.gitkeep +0 -0
  31. data/assets/javascripts/models/follower.js.coffee +27 -0
  32. data/assets/javascripts/models/following.js.coffee +27 -0
  33. data/assets/javascripts/models/group.js.coffee +4 -0
  34. data/assets/javascripts/models/post.js.coffee +32 -0
  35. data/assets/javascripts/models/profile.js.coffee +30 -0
  36. data/assets/javascripts/moment.js +1106 -0
  37. data/assets/javascripts/paginator.js.coffee +67 -0
  38. data/assets/javascripts/router.js.coffee +71 -0
  39. data/assets/javascripts/routers/.gitkeep +0 -0
  40. data/assets/javascripts/routers/followers.js.coffee +14 -0
  41. data/assets/javascripts/routers/followings.js.coffee +14 -0
  42. data/assets/javascripts/routers/posts.js.coffee +98 -0
  43. data/assets/javascripts/templates/.gitkeep +0 -0
  44. data/assets/javascripts/templates/_follower.js.mustache.slim +17 -0
  45. data/assets/javascripts/templates/_following.js.mustache.slim +17 -0
  46. data/assets/javascripts/templates/_new_post_form.js.mustache.slim +10 -0
  47. data/assets/javascripts/templates/_post.js.mustache.slim +10 -0
  48. data/assets/javascripts/templates/_post_inner.js.mustache.slim +71 -0
  49. data/assets/javascripts/templates/_profile_stats.js.mustache.slim +11 -0
  50. data/assets/javascripts/templates/_reply_form.js.mustache.slim +13 -0
  51. data/assets/javascripts/templates/conversation.js.mustache.slim +13 -0
  52. data/assets/javascripts/templates/followers.js.mustache.slim +19 -0
  53. data/assets/javascripts/templates/followings.js.mustache.slim +22 -0
  54. data/assets/javascripts/templates/posts.js.mustache.slim +25 -0
  55. data/assets/javascripts/templates/profile.js.mustache.slim +39 -0
  56. data/assets/javascripts/underscore.js +1059 -0
  57. data/assets/javascripts/view.js.coffee +140 -0
  58. data/assets/javascripts/views/.gitkeep +0 -0
  59. data/assets/javascripts/views/container.js.coffee +6 -0
  60. data/assets/javascripts/views/expanding_textarea.js.coffee +14 -0
  61. data/assets/javascripts/views/fetch_posts_pool.js.coffee +61 -0
  62. data/assets/javascripts/views/follower_groups_form.js.coffee +26 -0
  63. data/assets/javascripts/views/followers.js.coffee +28 -0
  64. data/assets/javascripts/views/following_groups_form.js.coffee +25 -0
  65. data/assets/javascripts/views/followings.js.coffee +27 -0
  66. data/assets/javascripts/views/new_following_form.js.coffee +15 -0
  67. data/assets/javascripts/views/new_post_form.js.coffee +178 -0
  68. data/assets/javascripts/views/post.js.coffee +139 -0
  69. data/assets/javascripts/views/posts.js.coffee +55 -0
  70. data/assets/javascripts/views/posts/conversation.js.coffee +18 -0
  71. data/assets/javascripts/views/profile.js.coffee +29 -0
  72. data/assets/javascripts/views/profile_follow_button.js.coffee +29 -0
  73. data/assets/javascripts/views/profile_stats.js.coffee +38 -0
  74. data/assets/javascripts/views/remove_follower_btn.js.coffee +18 -0
  75. data/assets/javascripts/views/reply_post_form.js.coffee +30 -0
  76. data/assets/javascripts/views/unfollow_btn.js.coffee +18 -0
  77. data/assets/stylesheets/.gitkeep +0 -0
  78. data/assets/stylesheets/application.css.sass +117 -0
  79. data/assets/stylesheets/bootstrap-responsive.css +1040 -0
  80. data/assets/stylesheets/bootstrap.css.erb +5624 -0
  81. data/assets/stylesheets/chosen.css.erb +397 -0
  82. data/config.ru +14 -0
  83. data/config/asset_sync.rb +12 -0
  84. data/config/evergreen.rb +16 -0
  85. data/lib/tent-status.rb +6 -0
  86. data/lib/tent-status/app.rb +263 -0
  87. data/lib/tent-status/models/user.rb +39 -0
  88. data/lib/tent-status/sprockets/environment.rb +25 -0
  89. data/lib/tent-status/sprockets/helpers.rb +5 -0
  90. data/lib/tent-status/views/application.slim +69 -0
  91. data/lib/tent-status/views/auth.slim +8 -0
  92. data/tent-status.gemspec +34 -0
  93. metadata +415 -0
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ .env
16
+
17
+ # YARD artifacts
18
+ .yardoc
19
+ _yardoc
20
+ doc/
21
+ public
data/.kick ADDED
@@ -0,0 +1,8 @@
1
+ process do |files|
2
+ test_files = files.take_and_map do |file|
3
+ if file =~ %r{^(spec|assets)/javascripts/(.+?)(_spec)?\.(js|coffee|js\.coffee)$}
4
+ "spec/javascripts/#{$2}_spec.coffee"
5
+ end
6
+ end
7
+ execute "bundle exec evergreen run" unless test_files.empty?
8
+ end
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+ ruby '1.9.3'
3
+
4
+ gemspec
5
+
6
+ gem 'tent-client', :git => 'git://github.com/tent/tent-client-ruby.git', :branch => 'master'
7
+
8
+ group :development do
9
+ gem 'evergreen', :git => 'git://github.com/jvatic/evergreen.git', :branch => 'master', :submodules => true
10
+ gem 'asset_sync', :git => 'git://github.com/titanous/asset_sync.git', :branch => 'fix-mime'
11
+ gem 'mime-types'
12
+ end
@@ -0,0 +1,232 @@
1
+ GIT
2
+ remote: git://github.com/jvatic/evergreen.git
3
+ revision: 6c0a7a06ff4830eea79fb0bdd99f01c8138295f4
4
+ branch: master
5
+ submodules: true
6
+ specs:
7
+ evergreen (1.0.0)
8
+ capybara (~> 1.0)
9
+ coffee-script
10
+ json_pure
11
+ launchy
12
+ sinatra (~> 1.1)
13
+ sprockets (~> 2.0)
14
+
15
+ GIT
16
+ remote: git://github.com/tent/tent-client-ruby.git
17
+ revision: f4a62a14e429564301972f4a4852633f3fd81a75
18
+ branch: master
19
+ specs:
20
+ tent-client (0.0.1)
21
+ faraday (= 0.8.4)
22
+ faraday_middleware (= 0.8.8)
23
+ faraday_middleware-multi_json
24
+ nokogiri
25
+ oj
26
+
27
+ GIT
28
+ remote: git://github.com/titanous/asset_sync.git
29
+ revision: 64f86044921b7029cf3be673a1920aa7fdfe8604
30
+ branch: fix-mime
31
+ specs:
32
+ asset_sync (0.5.0)
33
+ activemodel
34
+ fog
35
+
36
+ PATH
37
+ remote: .
38
+ specs:
39
+ tent-status (0.0.1)
40
+ asset_sync (~> 0.5.0)
41
+ coffee-script
42
+ data_mapper (~> 1.2.0)
43
+ dm-postgres-adapter (~> 1.2.0)
44
+ hashie
45
+ hogan_assets
46
+ rack_csrf
47
+ sass
48
+ sinatra
49
+ slim
50
+ sprockets (~> 2.0)
51
+ tent-client
52
+ tilt
53
+ uglifier
54
+
55
+ GEM
56
+ remote: https://rubygems.org/
57
+ specs:
58
+ activemodel (3.2.8)
59
+ activesupport (= 3.2.8)
60
+ builder (~> 3.0.0)
61
+ activesupport (3.2.8)
62
+ i18n (~> 0.6)
63
+ multi_json (~> 1.0)
64
+ addressable (2.2.8)
65
+ bcrypt-ruby (3.0.1)
66
+ builder (3.0.3)
67
+ capybara (1.1.2)
68
+ mime-types (>= 1.16)
69
+ nokogiri (>= 1.3.3)
70
+ rack (>= 1.0.0)
71
+ rack-test (>= 0.5.4)
72
+ selenium-webdriver (~> 2.0)
73
+ xpath (~> 0.1.4)
74
+ childprocess (0.3.5)
75
+ ffi (~> 1.0, >= 1.0.6)
76
+ coffee-script (2.2.0)
77
+ coffee-script-source
78
+ execjs
79
+ coffee-script-source (1.3.3)
80
+ data_mapper (1.2.0)
81
+ dm-aggregates (~> 1.2.0)
82
+ dm-constraints (~> 1.2.0)
83
+ dm-core (~> 1.2.0)
84
+ dm-migrations (~> 1.2.0)
85
+ dm-serializer (~> 1.2.0)
86
+ dm-timestamps (~> 1.2.0)
87
+ dm-transactions (~> 1.2.0)
88
+ dm-types (~> 1.2.0)
89
+ dm-validations (~> 1.2.0)
90
+ data_objects (0.10.8)
91
+ addressable (~> 2.1)
92
+ dm-aggregates (1.2.0)
93
+ dm-core (~> 1.2.0)
94
+ dm-constraints (1.2.0)
95
+ dm-core (~> 1.2.0)
96
+ dm-core (1.2.0)
97
+ addressable (~> 2.2.6)
98
+ dm-do-adapter (1.2.0)
99
+ data_objects (~> 0.10.6)
100
+ dm-core (~> 1.2.0)
101
+ dm-migrations (1.2.0)
102
+ dm-core (~> 1.2.0)
103
+ dm-postgres-adapter (1.2.0)
104
+ dm-do-adapter (~> 1.2.0)
105
+ do_postgres (~> 0.10.6)
106
+ dm-serializer (1.2.2)
107
+ dm-core (~> 1.2.0)
108
+ fastercsv (~> 1.5)
109
+ json (~> 1.6)
110
+ json_pure (~> 1.6)
111
+ multi_json (~> 1.0)
112
+ dm-timestamps (1.2.0)
113
+ dm-core (~> 1.2.0)
114
+ dm-transactions (1.2.0)
115
+ dm-core (~> 1.2.0)
116
+ dm-types (1.2.2)
117
+ bcrypt-ruby (~> 3.0)
118
+ dm-core (~> 1.2.0)
119
+ fastercsv (~> 1.5)
120
+ json (~> 1.6)
121
+ multi_json (~> 1.0)
122
+ stringex (~> 1.4)
123
+ uuidtools (~> 2.1)
124
+ dm-validations (1.2.0)
125
+ dm-core (~> 1.2.0)
126
+ do_postgres (0.10.8)
127
+ data_objects (= 0.10.8)
128
+ eventmachine (1.0.0)
129
+ excon (0.16.2)
130
+ execjs (1.4.0)
131
+ multi_json (~> 1.0)
132
+ faraday (0.8.4)
133
+ multipart-post (~> 1.1)
134
+ faraday_middleware (0.8.8)
135
+ faraday (>= 0.7.4, < 0.9)
136
+ faraday_middleware-multi_json (0.0.3)
137
+ faraday_middleware
138
+ multi_json
139
+ fastercsv (1.5.5)
140
+ faye-websocket (0.4.6)
141
+ eventmachine (>= 0.12.0)
142
+ ffi (1.1.5)
143
+ fog (1.6.0)
144
+ builder
145
+ excon (~> 0.14)
146
+ formatador (~> 0.2.0)
147
+ mime-types
148
+ multi_json (~> 1.0)
149
+ net-scp (~> 1.0.4)
150
+ net-ssh (>= 2.1.3)
151
+ nokogiri (~> 1.5.0)
152
+ ruby-hmac
153
+ formatador (0.2.3)
154
+ hashie (1.2.0)
155
+ hike (1.2.1)
156
+ hogan_assets (1.3.3)
157
+ execjs (>= 1.2.9)
158
+ sprockets (>= 2.0.3)
159
+ tilt (>= 1.3.3)
160
+ http_parser.rb (0.5.3)
161
+ i18n (0.6.1)
162
+ json (1.7.5)
163
+ json_pure (1.7.5)
164
+ kicker (2.6.1)
165
+ listen
166
+ launchy (2.1.0)
167
+ addressable (~> 2.2.6)
168
+ libwebsocket (0.1.5)
169
+ addressable
170
+ listen (0.5.0)
171
+ mime-types (1.19)
172
+ multi_json (1.3.6)
173
+ multipart-post (1.1.5)
174
+ net-scp (1.0.4)
175
+ net-ssh (>= 1.99.1)
176
+ net-ssh (2.5.2)
177
+ nokogiri (1.5.5)
178
+ oj (1.3.4)
179
+ poltergeist (0.7.0)
180
+ capybara (~> 1.1)
181
+ childprocess (~> 0.3)
182
+ faye-websocket (~> 0.4, >= 0.4.4)
183
+ http_parser.rb (~> 0.5.3)
184
+ multi_json (~> 1.0)
185
+ rack (1.4.1)
186
+ rack-protection (1.2.0)
187
+ rack
188
+ rack-test (0.6.1)
189
+ rack (>= 1.0)
190
+ rack_csrf (2.4.0)
191
+ rack (>= 0.9)
192
+ ruby-hmac (0.4.0)
193
+ rubyzip (0.9.9)
194
+ sass (3.2.1)
195
+ selenium-webdriver (2.25.0)
196
+ childprocess (>= 0.2.5)
197
+ libwebsocket (~> 0.1.3)
198
+ multi_json (~> 1.0)
199
+ rubyzip
200
+ sinatra (1.3.3)
201
+ rack (~> 1.3, >= 1.3.6)
202
+ rack-protection (~> 1.2)
203
+ tilt (~> 1.3, >= 1.3.3)
204
+ slim (1.3.0)
205
+ temple (~> 0.4.1)
206
+ tilt (~> 1.3.3)
207
+ sprockets (2.5.0)
208
+ hike (~> 1.2)
209
+ multi_json (~> 1.0)
210
+ rack (~> 1.0)
211
+ tilt (~> 1.1, != 1.3.0)
212
+ stringex (1.4.0)
213
+ temple (0.4.1)
214
+ tilt (1.3.3)
215
+ uglifier (1.3.0)
216
+ execjs (>= 0.3.0)
217
+ multi_json (~> 1.0, >= 1.0.2)
218
+ uuidtools (2.1.3)
219
+ xpath (0.1.4)
220
+ nokogiri (~> 1.3)
221
+
222
+ PLATFORMS
223
+ ruby
224
+
225
+ DEPENDENCIES
226
+ asset_sync!
227
+ evergreen!
228
+ kicker
229
+ mime-types
230
+ poltergeist
231
+ tent-client!
232
+ tent-status!
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Apollic Software, LLC
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ web: bundle exec puma
@@ -0,0 +1,14 @@
1
+ # TentStatus
2
+
3
+ TentStatus is a Sinatra/Backbone app that sends/receives Tent status posts.
4
+
5
+ ## Contributing
6
+
7
+ The app currently isn't very useful because it needs OAuth authentication so
8
+ that it can talk to Tent servers.
9
+
10
+ Here are some tasks that need to be done:
11
+
12
+ - Implement a omniauth strategy that handles Tent OAuth.
13
+ - Write tests/refactor code.
14
+ - Make it pretty.
@@ -0,0 +1,43 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rake/sprocketstask'
4
+ require 'tent-status/sprockets/helpers'
5
+ require 'slim'
6
+ require 'hogan_assets'
7
+ require 'uglifier'
8
+
9
+ namespace :spec do
10
+ desc "Run JavaScript specs via Evergreen"
11
+ task :javascripts do
12
+ require './config/evergreen'
13
+ result = Evergreen::Runner.new.run
14
+ Kernel.exit(1) unless result
15
+ end
16
+ end
17
+
18
+ Rake::SprocketsTask.new do |t|
19
+ %x{rm -rf ./public}
20
+ t.environment = Sprockets::Environment.new
21
+ %w{ javascripts stylesheets images }.each do |path|
22
+ t.environment.append_path("assets/#{path}")
23
+ end
24
+ t.environment.js_compressor = Uglifier.new
25
+ t.environment.register_engine('.slim', ::Slim::Template)
26
+ t.output = "./public/assets"
27
+ t.assets = %w( boot.js application.css chosen-sprite.png )
28
+
29
+ t.environment.context_class.class_eval do
30
+ include SprocketsHelpers
31
+ end
32
+ end
33
+
34
+ task :gzip_assets => :assets do
35
+ Dir['public/assets/**/*.*'].reject { |f| f =~ /\.gz\z/ }.each do |f|
36
+ sh "gzip -c #{f} > #{f}.gz" unless File.exist?("#{f}.gz")
37
+ end
38
+ end
39
+
40
+ task :deploy_assets => :gzip_assets do
41
+ require './config/asset_sync'
42
+ AssetSync.sync
43
+ end
File without changes
File without changes
@@ -0,0 +1,122 @@
1
+ #= require jquery
2
+ #= require underscore
3
+ #= require http
4
+ #= require backbone
5
+ #= require ./backbone_sync
6
+ #= require hogan
7
+ #= require moment
8
+ #= require chosen.jquery
9
+ #= require_tree ./templates
10
+ #= require_self
11
+ #= require ./paginator
12
+ #= require ./fetch_pool
13
+ #= require ./view
14
+ #= require ./router
15
+ #= require_tree ./helpers
16
+ #= require_tree ./views
17
+ #= require_tree ./routers
18
+ #= require_tree ./models
19
+ #= require_tree ./collections
20
+
21
+ @TentStatus ?= {
22
+ api_root: '/api'
23
+ url_root: '/'
24
+ authenticated: false
25
+ guest_authenticated: false
26
+ }
27
+ _.extend @TentStatus, Backbone.Events, {
28
+ Views: {}
29
+ Models: {}
30
+ Collections: {}
31
+ Routers: {}
32
+ Helpers: {}
33
+ csrf_token: $('meta[name="csrf-token"]').attr('content')
34
+ PER_PAGE: 50
35
+
36
+ devWarning: (fn, msg) ->
37
+ console.warn "<#{fn.constructor.name}> #{msg}"
38
+
39
+ #############################
40
+ # Hogan Templates #
41
+ #############################
42
+ _templates: {}
43
+ fetchTemplate: (templatePath, callback) ->
44
+ template = HoganTemplates[templatePath]
45
+ return callback(template) if template
46
+
47
+ template = @_templates[templatePath]
48
+ return callback(template) if template
49
+
50
+ HTTP.get "#{@url_root}assets/templates/#{ templatePath }.html.mustache", (template) =>
51
+ @_templates[templatePath] = Hogan.compile template
52
+ callback(@_templates[templatePath])
53
+
54
+ ## Run Backbone
55
+ backboneConfig: {
56
+ pushState: true
57
+ root: TentStatus.url_root
58
+ }
59
+ run: ->
60
+ Backbone.history?.start @backboneConfig
61
+
62
+ @ready = true
63
+ @trigger 'ready'
64
+
65
+ #############################
66
+ # Route Lookup #
67
+ #############################
68
+
69
+ # returns object: { 'router:action': '/path/to/action/:foo', ... }
70
+ routeTable: ->
71
+ routeTable = {}
72
+ for name, o of @Routers
73
+ for p, a of o.routes
74
+ routeTable["#{name}:#{a}"] = p
75
+ routeTable
76
+
77
+ # key: 'router:action'
78
+ # params: object (named url params)
79
+ #
80
+ # returns object: {
81
+ # trigger: # function (navigates to route)
82
+ # url: # evaluated url
83
+ # key: # original key argument ('router:action')
84
+ # }
85
+ lookupRoute: (key, params = {}) ->
86
+ routeTable = @routeTable()
87
+ match = routeTable[key]
88
+ return unless match
89
+
90
+ router = @Routers[key.split(':')[0]]
91
+ url = match
92
+ _.each url.match(/:[^\/]+/g), (segment) =>
93
+ url = url.replace(segment, params[segment.slice(1, segment.length)])
94
+
95
+ {
96
+ trigger: =>
97
+ router.navigate(url, { trigger: true })
98
+ url: "/" + url
99
+ key: key
100
+ }
101
+
102
+ # pattern (standard backbone route pattern): e.g. 'path/to/:foo'
103
+ # path (window.location.pathname): e.g. "/path/to/baz"
104
+ #
105
+ # returns hash of params in given path, e.g. { foo: 'baz' }
106
+ paramsForPatternAndPath: (pattern, path) ->
107
+ unless path
108
+ if Backbone.history._wantsHashChange and !Backbone.history._hasPushState
109
+ path = window.location.hash
110
+ else
111
+ path = window.location.pathname
112
+ path = path.replace(new RegExp("^#{ Backbone.history.options.root }"), "")
113
+
114
+ parts = pattern.split("/")
115
+ pathParts = path.replace(/^\//, '').split("/")
116
+
117
+ params = {}
118
+ for p, index in parts
119
+ if p.slice(0, 1) == ":"
120
+ params[p.slice(1, p.length)] = pathParts[index]
121
+ params
122
+ }