towsta 2.0.10 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,20 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- towsta (2.0.2)
4
+ towsta (2.0.10)
5
5
  active_support
6
6
  bresson
7
7
  cameraman
8
- coffee-script
9
- compass
10
8
  dalli
11
- haml
12
- i18n-router
13
9
  json
14
- pony
15
- sinatra
16
- sinatra-content-for
17
- therubyracer
18
10
 
19
11
  GEM
20
12
  remote: http://rubygems.org/
@@ -22,53 +14,13 @@ GEM
22
14
  active_support (3.0.0)
23
15
  activesupport (= 3.0.0)
24
16
  activesupport (3.0.0)
25
- addressable (2.2.6)
26
17
  bresson (0.0.5)
27
18
  flickraw
28
19
  cameraman (0.0.2)
29
- chunky_png (1.2.5)
30
- coffee-script (2.2.0)
31
- coffee-script-source
32
- execjs
33
- coffee-script-source (1.2.0)
34
- compass (0.11.7)
35
- chunky_png (~> 1.2)
36
- fssm (>= 0.2.7)
37
- sass (~> 3.1)
38
- dalli (1.1.4)
20
+ dalli (1.1.5)
39
21
  diff-lcs (1.1.3)
40
- execjs (1.3.0)
41
- multi_json (~> 1.0)
42
22
  flickraw (0.9.5)
43
- fssm (0.2.8.1)
44
- haml (3.1.4)
45
- heroku (2.20.0)
46
- launchy (>= 0.3.2)
47
- rest-client (~> 1.6.1)
48
- rubyzip
49
- term-ansicolor (~> 1.0.5)
50
- i18n (0.6.0)
51
- i18n-router (0.0.3)
52
- sinatra-r18n
53
23
  json (1.6.5)
54
- launchy (2.0.5)
55
- addressable (~> 2.2.6)
56
- libv8 (3.3.10.4)
57
- mail (2.4.1)
58
- i18n (>= 0.4.0)
59
- mime-types (~> 1.16)
60
- treetop (~> 1.4.8)
61
- mime-types (1.17.2)
62
- multi_json (1.0.4)
63
- polyglot (0.3.3)
64
- pony (1.4)
65
- mail (> 2.0)
66
- r18n-core (0.4.14)
67
- rack (1.4.1)
68
- rack-protection (1.2.0)
69
- rack
70
- rest-client (1.6.7)
71
- mime-types (>= 1.16)
72
24
  rspec (2.8.0)
73
25
  rspec-core (~> 2.8.0)
74
26
  rspec-expectations (~> 2.8.0)
@@ -77,32 +29,11 @@ GEM
77
29
  rspec-expectations (2.8.0)
78
30
  diff-lcs (~> 1.1.2)
79
31
  rspec-mocks (2.8.0)
80
- rubyzip (0.9.6.1)
81
- sass (3.1.15)
82
- shotgun (0.9)
83
- rack (>= 1.0)
84
- sinatra (1.3.2)
85
- rack (~> 1.3, >= 1.3.6)
86
- rack-protection (~> 1.2)
87
- tilt (~> 1.3, >= 1.3.3)
88
- sinatra-content-for (0.2)
89
- sinatra
90
- sinatra-r18n (0.4.14)
91
- r18n-core (= 0.4.14)
92
- sinatra (>= 1.3)
93
- term-ansicolor (1.0.7)
94
- therubyracer (0.9.9)
95
- libv8 (~> 3.3.10)
96
- tilt (1.3.3)
97
- treetop (1.4.10)
98
- polyglot
99
- polyglot (>= 0.3.1)
100
32
 
101
33
  PLATFORMS
102
34
  ruby
35
+ x86-mingw32
103
36
 
104
37
  DEPENDENCIES
105
- heroku
106
38
  rspec
107
- shotgun
108
39
  towsta!
data/bin/towsta CHANGED
@@ -1,102 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require 'net/http'
3
- action = ARGV.first
4
- if action == 'new'
5
- project = ARGV[1]
6
- Dir.mkdir project
7
- configru = "require './app'\n"
8
- configru += "run Sinatra::Application"
9
- File.open("#{project}/config.ru", 'w') {|f| f.write(configru) }
10
- gemfile = "source :rubygems \n"
11
- gemfile += "gem 'towsta'"
12
- File.open("#{project}/Gemfile", 'w') {|f| f.write(gemfile) }
13
- apprb = "#coding: utf-8 \n"
14
- apprb += "require 'sinatra'\n"
15
- apprb += "require 'towsta'\n\n"
16
- apprb += "get '/' do\n"
17
- apprb += " sync_with_towsta\n"
18
- apprb += " haml :index\n"
19
- apprb += "end\n"
20
- File.open("#{project}/app.rb", 'w') {|f| f.write(apprb) }
21
- towstarb = "Towsta.secret = '#{ARGV[2]}'\n"
22
- towstarb += "#Towsta.author = 'default_author_email'\n"
23
- towstarb += "#Towsta.global = {}"
24
- File.open("#{project}/towsta.rb", 'w') {|f| f.write(towstarb) }
25
- Dir.mkdir "#{project}/views"
26
- layout = "!!!\n"
27
- layout += "%html\n"
28
- layout += " %head\n"
29
- layout += " = partial :head\n"
30
- layout += " %body\n"
31
- layout += " #top\n"
32
- layout += " .wrapper\n"
33
- layout += " #middle\n"
34
- layout += " .wrapper\n"
35
- layout += " = yield\n"
36
- layout += " #bottom\n"
37
- layout += " .wrapper\n"
38
- File.open("#{project}/views/layout.haml", 'w') {|f| f.write(layout)}
39
- index = '%h1 Hello Towsta'
40
- File.open("#{project}/views/index.haml", 'w') {|f| f.write(index)}
41
- Dir.mkdir "#{project}/models"
42
- Dir.mkdir "#{project}/controllers"
43
- Dir.mkdir "#{project}/public"
44
- Dir.mkdir "#{project}/views/stylesheets"
45
- Dir.mkdir "#{project}/views/javascripts"
46
- css = "@import compass/reset\n"
47
- css += "@import compass/css3\n\n"
48
- css += "$wrapper: 940px\n\n"
49
- css += ".wrapper\n"
50
- css += " :width $wrapper\n"
51
- css += " :margin 0 auto\n"
52
- css += "#top, #middle, #bottom\n"
53
- css += " :float left\n"
54
- css += " :width 100%"
55
- File.open("#{project}/views/stylesheets/app.sass", 'w') {|f| f.write(css)}
56
- js = '$ ->'
57
- File.open("#{project}/views/javascripts/app.coffee", 'w') {|f| f.write(js)}
58
- Dir.mkdir "#{project}/views/partials"
59
- head = "%title #{project}\n"
60
- head += "%meta{:'http-equiv' => 'Content-Type', :content => 'text/html', :charset => 'utf-8'}\n"
61
- head += "%link{rel: 'stylesheet', type: 'text/css', href: '/stylesheets/app.css'}\n"
62
- head += "%link{rel: 'shortcut icon', type: 'image/x-icon', href: '/images/favicon.png'}\n"
63
- head += "%script{src: '/js/jquery.js'}\n"
64
- head += "%script{src: '/js/app.js'}"
65
- File.open("#{project}/views/partials/_head.haml", 'w') {|f| f.write(head)}
66
- Dir.mkdir "#{project}/public/js"
67
- Net::HTTP.start("code.jquery.com"){|http| @jquery = http.get('/jquery.min.js').body}
68
- File.open("#{project}/public/js/jquery.js", 'w') {|f| f.write(@jquery)}
69
- Dir.mkdir "#{project}/public/images"
70
- Dir.mkdir "#{project}/locales"
71
- git = '*.swp'
72
- File.open("#{project}/.gitignore", 'w') {|f| f.write(git)}
73
- puts "#{project} is ready to towst!"
74
- elsif action == 'server'
75
- port = ARGV[1].nil? ? '6937' : ARGV[1]
76
- system "shotgun -I config.ru -p #{port}"
77
- elsif action == 'console'
78
- system 'irb -r ./app.rb'
79
- elsif action == 'configure'
80
- project = %x[pwd].split('/').last.strip
81
- system "git init"
82
- system "heroku create" unless system "heroku create #{project}"
83
- system "heroku addons:add sendgrid:starter"
84
- system "heroku addons:add memcache"
85
- system "heroku addons:add custom_domains:basic"
86
- system "heroku addons:add zerigo_dns:basic"
87
- system "bundle install"
88
- elsif action == 'deploy'
89
- system 'towsta configure' unless system('heroku stack')
90
- system 'git add .'
91
- message = ARGV[1].nil? ? 'Deployed via Towsta gem' : ARGV[1]
92
- system "git commit -a -m '#{message}'"
93
- system 'git push -q' unless system 'git push heroku master -q'
94
- puts 'Deploy is complete!'
95
- elsif action == 'help'
96
- puts 'towsta new {projectname} {optional: secret} to generate a new project'
97
- puts 'towsta server {optional: port} to run the application server'
98
- puts 'towsta console to run the application console'
99
- puts 'towsta deploy {optional: message} to deploy your application'
100
- else
101
- puts 'Comand not found, try running "towsta help"'
102
- end
2
+ require 'towsta'
3
+
4
+ Towsta::Shell.send ARGV.first, ARGV.last
@@ -1,5 +1,3 @@
1
- require "./towsta.rb"
2
-
3
1
  def sync_with_towsta params={}
4
2
  sync = Towsta::Synchronizer.new params: params, request: :all
5
3
  (Dir["./controllers/*.rb"] + Dir["./models/*.rb"]).each {|file| load file}
@@ -1,13 +1,9 @@
1
- require "./towsta.rb"
2
-
3
1
  require 'dalli'
4
2
  set :cache, Dalli::Client.new
5
3
  require File.expand_path('../../memory', __FILE__)
6
4
 
7
5
  Towsta::Synchronizer.new params: {}, request: :structure
8
6
 
9
- (Dir["./controllers/*.rb"] + Dir["./models/*.rb"]).each {|file| require file}
10
-
11
7
  def sync_with_towsta params={}
12
8
  Towsta::Memory.recover(params).status
13
9
  end
@@ -0,0 +1,22 @@
1
+ module Towsta
2
+ class Shell
3
+ def self.sinatra_init *args
4
+ towsta_rb 'configs'
5
+ add_gem
6
+ system 'bundle install'
7
+ end
8
+
9
+ def self.towsta_rb folder
10
+ code = "require 'towsta'\n\n"
11
+ code += "Towsta.secret = ''\n"
12
+ code += "#Towsta.author = 'your@email.com'\n"
13
+ code += "#Towsta.global = {}"
14
+ File.open("#{folder}/towsta.rb", 'w') {|f| f.write(code)}
15
+ end
16
+
17
+ def self.add_gem
18
+ gemfile = File.read("Gemfile") << "\ngem 'towsta'"
19
+ File.open("Gemfile", 'w') {|f| f.write(gemfile)}
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "2.0.10"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -2,7 +2,7 @@ module Towsta
2
2
 
3
3
  class VerticalCore
4
4
 
5
- include R18n::Helpers
5
+ include R18n::Helpers rescue nil
6
6
 
7
7
  def i18n attr
8
8
  self.send :"#{attr.to_s}_#{R18n.get.locales.first.code}"
data/lib/towsta.rb CHANGED
@@ -1,18 +1,8 @@
1
1
  #coding: utf-8
2
- require 'digest/md5'
3
2
  require 'net/http'
4
- require 'cgi'
5
3
  require 'json'
6
- require 'time'
7
- require 'date'
8
- require 'time'
9
4
  require 'bresson'
10
5
  require 'cameraman'
11
- require 'sinatra'
12
- require 'compass'
13
- require 'sinatra/content_for'
14
- require 'i18n-router'
15
- require 'pony'
16
6
  require 'active_support/all'
17
7
 
18
8
  require File.expand_path('../towsta/vertical-core/base', __FILE__)
@@ -24,8 +14,8 @@ require File.expand_path('../towsta/vertical-core/references', __FILE__)
24
14
  require File.expand_path('../towsta/kinds/main', __FILE__)
25
15
  require File.expand_path('../towsta/vertical', __FILE__)
26
16
  require File.expand_path('../towsta/synchronizer', __FILE__)
27
- require File.expand_path('../towsta/sinatra_extension', __FILE__)
28
17
  require File.expand_path('../towsta/login', __FILE__)
18
+ require File.expand_path('../towsta/shell', __FILE__)
29
19
  require File.expand_path('../towsta/kinds/boolean', __FILE__)
30
20
  require File.expand_path('../towsta/kinds/date', __FILE__)
31
21
  require File.expand_path('../towsta/kinds/datetime', __FILE__)
data/towsta.gemspec CHANGED
@@ -17,20 +17,11 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_dependency "json"
19
19
  s.add_dependency "bresson"
20
- s.add_dependency "compass"
21
- s.add_dependency "haml"
22
- s.add_dependency "sinatra"
23
20
  s.add_dependency "cameraman"
24
- s.add_dependency "sinatra-content-for"
25
- s.add_dependency "i18n-router"
26
- s.add_dependency "pony"
27
- s.add_dependency "coffee-script"
28
21
  s.add_dependency "active_support"
29
22
  s.add_dependency 'dalli'
30
23
 
31
24
  s.add_development_dependency 'rspec'
32
- s.add_development_dependency 'shotgun'
33
- s.add_development_dependency 'heroku'
34
25
 
35
26
  s.files = `git ls-files`.split("\n")
36
27
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,227 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: towsta
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 0
8
- - 10
9
- version: 2.0.10
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Mortaro
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-03-06 00:00:00 -03:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: json
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
31
- type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: bresson
35
- prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
44
- type: :runtime
45
- version_requirements: *id002
46
- - !ruby/object:Gem::Dependency
47
- name: compass
48
- prerelease: false
49
- requirement: &id003 !ruby/object:Gem::Requirement
16
+ requirement: &26022804 !ruby/object:Gem::Requirement
50
17
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
57
22
  type: :runtime
58
- version_requirements: *id003
59
- - !ruby/object:Gem::Dependency
60
- name: haml
61
23
  prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
24
+ version_requirements: *26022804
25
+ - !ruby/object:Gem::Dependency
26
+ name: bresson
27
+ requirement: &26022348 !ruby/object:Gem::Requirement
63
28
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
70
33
  type: :runtime
71
- version_requirements: *id004
72
- - !ruby/object:Gem::Dependency
73
- name: sinatra
74
34
  prerelease: false
75
- requirement: &id005 !ruby/object:Gem::Requirement
76
- none: false
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
83
- type: :runtime
84
- version_requirements: *id005
85
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *26022348
36
+ - !ruby/object:Gem::Dependency
86
37
  name: cameraman
87
- prerelease: false
88
- requirement: &id006 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 0
95
- version: "0"
96
- type: :runtime
97
- version_requirements: *id006
98
- - !ruby/object:Gem::Dependency
99
- name: sinatra-content-for
100
- prerelease: false
101
- requirement: &id007 !ruby/object:Gem::Requirement
102
- none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- segments:
107
- - 0
108
- version: "0"
109
- type: :runtime
110
- version_requirements: *id007
111
- - !ruby/object:Gem::Dependency
112
- name: i18n-router
113
- prerelease: false
114
- requirement: &id008 !ruby/object:Gem::Requirement
115
- none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- segments:
120
- - 0
121
- version: "0"
122
- type: :runtime
123
- version_requirements: *id008
124
- - !ruby/object:Gem::Dependency
125
- name: pony
126
- prerelease: false
127
- requirement: &id009 !ruby/object:Gem::Requirement
38
+ requirement: &26021424 !ruby/object:Gem::Requirement
128
39
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- segments:
133
- - 0
134
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
135
44
  type: :runtime
136
- version_requirements: *id009
137
- - !ruby/object:Gem::Dependency
138
- name: coffee-script
139
45
  prerelease: false
140
- requirement: &id010 !ruby/object:Gem::Requirement
141
- none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- segments:
146
- - 0
147
- version: "0"
148
- type: :runtime
149
- version_requirements: *id010
150
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *26021424
47
+ - !ruby/object:Gem::Dependency
151
48
  name: active_support
152
- prerelease: false
153
- requirement: &id011 !ruby/object:Gem::Requirement
49
+ requirement: &26020152 !ruby/object:Gem::Requirement
154
50
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- segments:
159
- - 0
160
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
161
55
  type: :runtime
162
- version_requirements: *id011
163
- - !ruby/object:Gem::Dependency
164
- name: dalli
165
56
  prerelease: false
166
- requirement: &id012 !ruby/object:Gem::Requirement
57
+ version_requirements: *26020152
58
+ - !ruby/object:Gem::Dependency
59
+ name: dalli
60
+ requirement: &26019720 !ruby/object:Gem::Requirement
167
61
  none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- segments:
172
- - 0
173
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
174
66
  type: :runtime
175
- version_requirements: *id012
176
- - !ruby/object:Gem::Dependency
177
- name: rspec
178
- prerelease: false
179
- requirement: &id013 !ruby/object:Gem::Requirement
180
- none: false
181
- requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- segments:
185
- - 0
186
- version: "0"
187
- type: :development
188
- version_requirements: *id013
189
- - !ruby/object:Gem::Dependency
190
- name: shotgun
191
67
  prerelease: false
192
- requirement: &id014 !ruby/object:Gem::Requirement
68
+ version_requirements: *26019720
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &26019180 !ruby/object:Gem::Requirement
193
72
  none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- segments:
198
- - 0
199
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
200
77
  type: :development
201
- version_requirements: *id014
202
- - !ruby/object:Gem::Dependency
203
- name: heroku
204
78
  prerelease: false
205
- requirement: &id015 !ruby/object:Gem::Requirement
206
- none: false
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- segments:
211
- - 0
212
- version: "0"
213
- type: :development
214
- version_requirements: *id015
79
+ version_requirements: *26019180
215
80
  description: Simply integrates the towsta api
216
- email:
81
+ email:
217
82
  - mortaro@towsta.com
218
- executables:
83
+ executables:
219
84
  - towsta
220
85
  extensions: []
221
-
222
86
  extra_rdoc_files: []
223
-
224
- files:
87
+ files:
225
88
  - .gitignore
226
89
  - Gemfile
227
90
  - Gemfile.lock
@@ -251,7 +114,7 @@ files:
251
114
  - lib/towsta/kinds/video.rb
252
115
  - lib/towsta/login.rb
253
116
  - lib/towsta/memory.rb
254
- - lib/towsta/sinatra_extension.rb
117
+ - lib/towsta/shell.rb
255
118
  - lib/towsta/synchronizer.rb
256
119
  - lib/towsta/version.rb
257
120
  - lib/towsta/vertical-core/attributes.rb
@@ -289,37 +152,28 @@ files:
289
152
  - spec/vertical/vertical_spec.rb
290
153
  - spec/webmock.json
291
154
  - towsta.gemspec
292
- has_rdoc: true
293
155
  homepage: http://rubygems.org/gems/towsta
294
156
  licenses: []
295
-
296
157
  post_install_message:
297
158
  rdoc_options: []
298
-
299
- require_paths:
159
+ require_paths:
300
160
  - lib
301
- required_ruby_version: !ruby/object:Gem::Requirement
161
+ required_ruby_version: !ruby/object:Gem::Requirement
302
162
  none: false
303
- requirements:
304
- - - ">="
305
- - !ruby/object:Gem::Version
306
- segments:
307
- - 0
308
- version: "0"
309
- required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
310
168
  none: false
311
- requirements:
312
- - - ">="
313
- - !ruby/object:Gem::Version
314
- segments:
315
- - 0
316
- version: "0"
169
+ requirements:
170
+ - - ! '>='
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
317
173
  requirements: []
318
-
319
174
  rubyforge_project: towsta
320
- rubygems_version: 1.3.7
175
+ rubygems_version: 1.8.16
321
176
  signing_key:
322
177
  specification_version: 3
323
178
  summary: Api Integration gem with towsta
324
179
  test_files: []
325
-
@@ -1,54 +0,0 @@
1
- enable :sessions
2
- set :session_secret, ENV['SESSION_KEY']
3
- set :translations, 'locales'
4
-
5
- Pony.options = {
6
- :via => :smtp,
7
- :via_options => {
8
- :address => 'smtp.sendgrid.net',
9
- :port => '587',
10
- :domain => 'heroku.com',
11
- :user_name => ENV['SENDGRID_USERNAME'],
12
- :password => ENV['SENDGRID_PASSWORD'],
13
- :authentication => :plain,
14
- :enable_starttls_auto => true
15
- }
16
- }
17
-
18
- helpers do
19
-
20
- def partial page
21
- haml "partials/_#{page}".to_sym
22
- end
23
-
24
- def authenticate args
25
- response = Towsta::Synchronizer.authentication_request args
26
- session[:current_user] = response[:id] if response[:status]
27
- response[:status]
28
- end
29
-
30
- def current_user
31
- return User.find(session[:current_user]) if defined? User
32
- session[:current_user]
33
- end
34
-
35
- def forget
36
- session[:current_user] = nil
37
- end
38
-
39
- end
40
-
41
- post '/flush' do
42
- Towsta::Memory.flush
43
- 'CLEAR'
44
- end
45
-
46
- get '/stylesheets/:name.css' do
47
- content_type 'text/css', :charset => 'utf-8'
48
- sass(:"stylesheets/#{params[:name]}", Compass.sass_engine_options)
49
- end
50
-
51
- get '/js/:name.js' do
52
- content_type 'text/javascript', :charset => 'utf-8'
53
- coffee :"javascripts/#{params[:name]}"
54
- end