towsta 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/towsta CHANGED
@@ -40,6 +40,7 @@ if action == 'new'
40
40
  Dir.mkdir "#{project}/controllers"
41
41
  Dir.mkdir "#{project}/public"
42
42
  Dir.mkdir "#{project}/views/stylesheets"
43
+ Dir.mkdir "#{project}/views/javascripts"
43
44
  css = "@import compass/reset\n"
44
45
  css += "@import compass/css3\n\n"
45
46
  css += "$wrapper: 940px\n\n"
@@ -49,22 +50,23 @@ if action == 'new'
49
50
  css += "#top, #middle, #bottom\n"
50
51
  css += " :float left\n"
51
52
  css += " :width 100%"
52
- File.open("#{project}/views/stylesheets/#{project}.sass", 'w') {|f| f.write(css)}
53
+ File.open("#{project}/views/stylesheets/app.sass", 'w') {|f| f.write(css)}
54
+ js = '$ ->'
55
+ File.open("#{project}/views/javascripts/app.coffee", 'w') {|f| f.write(js)}
53
56
  Dir.mkdir "#{project}/views/partials"
54
57
  head = "%title #{project}\n"
55
58
  head += "%meta{:'http-equiv' => 'Content-Type', :content => 'text/html', :charset => 'utf-8'}\n"
56
- head += "%link{rel: 'stylesheet', type: 'text/css', href: '/stylesheets/#{project}.css'}\n"
59
+ head += "%link{rel: 'stylesheet', type: 'text/css', href: '/stylesheets/app.css'}\n"
57
60
  head += "%link{rel: 'shortcut icon', type: 'image/x-icon', href: '/images/favicon.png'}\n"
58
61
  head += "%script{src: '/js/jquery.js'}\n"
59
- head += "%script{src: '/js/#{project}.js'}"
62
+ head += "%script{src: '/js/app.js'}"
60
63
  File.open("#{project}/views/partials/_head.haml", 'w') {|f| f.write(head)}
61
64
  Dir.mkdir "#{project}/public/js"
62
- js = "$(function() {\n\n"
63
- js += "});"
64
- File.open("#{project}/public/js/#{project}.js", 'w') {|f| f.write(js)}
65
65
  Net::HTTP.start("code.jquery.com"){|http| @jquery = http.get('/jquery.min.js').body}
66
66
  File.open("#{project}/public/js/jquery.js", 'w') {|f| f.write(@jquery)}
67
67
  Dir.mkdir "#{project}/public/images"
68
+ git = '*.swp'
69
+ File.open("#{project}/.gitignore", 'w') {|f| f.write(git)}
68
70
  puts "#{project} is ready to towst!"
69
71
  elsif action == 'server'
70
72
  port = ARGV[1].nil? ? '6937' : ARGV[1]
@@ -2,6 +2,19 @@ enable :sessions
2
2
  set :session_secret, ENV['SESSION_KEY']
3
3
  set :translations, 'locales'
4
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
+
5
18
  helpers do
6
19
 
7
20
  def partial page
@@ -34,3 +47,8 @@ get '/stylesheets/:name.css' do
34
47
  content_type 'text/css', :charset => 'utf-8'
35
48
  sass(:"stylesheets/#{params[:name]}", Compass.sass_engine_options)
36
49
  end
50
+
51
+ get '/js/:name.js' do
52
+ content_type 'text/javascript', :charset => 'utf-8'
53
+ coffee :"javascripts/#{params[:name]}"
54
+ end
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -21,6 +21,27 @@ module Towsta
21
21
  self.send eval("t.models.#{self.class.to_s.downcase}.#{attr.to_s}").to_sym
22
22
  end
23
23
 
24
+ def to_mail
25
+ string = ''
26
+ meta_attributes.each do |attribute, value|
27
+ string << "<b>#{attribute.to_s}:</b> #{value} <br/>"
28
+ end
29
+ string
30
+ end
31
+
32
+ def meta_attributes
33
+ a = attributes.clone
34
+ a.delete :author
35
+ a.delete :created_at
36
+ a.delete :updated_at
37
+ a.delete :id
38
+ a
39
+ end
40
+
41
+ def notify args
42
+ Pony.mail({:html_body => to_mail}.merge(args))
43
+ end
44
+
24
45
  args[:slices].each do |attr, kind|
25
46
  eval "def object_of_#{attr}; @#{attr}; end;"
26
47
  eval "def #{attr}= value; @#{attr} ||= Towsta::Kinds::#{kind[0].upcase + kind[1..-1]}Kind.new; @#{attr}.set value; end;"
data/lib/towsta.rb CHANGED
@@ -12,7 +12,8 @@ require 'cameraman'
12
12
  require 'sinatra'
13
13
  require 'compass'
14
14
  require 'sinatra/content_for'
15
- require 'sinatra/r18n'
15
+ require 'i18n-router'
16
+ require 'pony'
16
17
 
17
18
  require File.expand_path('../towsta/string_extension', __FILE__)
18
19
  require File.expand_path('../towsta/kinds/main', __FILE__)
data/towsta.gemspec CHANGED
@@ -23,7 +23,10 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency("cameraman")
24
24
  s.add_dependency("shotgun")
25
25
  s.add_dependency("sinatra-content-for")
26
- s.add_dependency("sinatra-r18n")
26
+ s.add_dependency("i18n-router")
27
+ s.add_dependency("pony")
28
+ s.add_dependency("coffee-script")
29
+ s.add_dependency("therubyracer")
27
30
 
28
31
  s.files = `git ls-files`.split("\n")
29
32
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 5
9
- version: 1.2.5
8
+ - 6
9
+ version: 1.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mortaro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-12-08 00:00:00 -02:00
17
+ date: 2011-12-13 00:00:00 -02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -135,7 +135,7 @@ dependencies:
135
135
  type: :runtime
136
136
  version_requirements: *id009
137
137
  - !ruby/object:Gem::Dependency
138
- name: sinatra-r18n
138
+ name: i18n-router
139
139
  prerelease: false
140
140
  requirement: &id010 !ruby/object:Gem::Requirement
141
141
  none: false
@@ -147,6 +147,45 @@ dependencies:
147
147
  version: "0"
148
148
  type: :runtime
149
149
  version_requirements: *id010
150
+ - !ruby/object:Gem::Dependency
151
+ name: pony
152
+ prerelease: false
153
+ requirement: &id011 !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ type: :runtime
162
+ version_requirements: *id011
163
+ - !ruby/object:Gem::Dependency
164
+ name: coffee-script
165
+ prerelease: false
166
+ requirement: &id012 !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ segments:
172
+ - 0
173
+ version: "0"
174
+ type: :runtime
175
+ version_requirements: *id012
176
+ - !ruby/object:Gem::Dependency
177
+ name: therubyracer
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: :runtime
188
+ version_requirements: *id013
150
189
  description: Simply integrates the towsta api
151
190
  email:
152
191
  - mortaro@towsta.com