towsta 2.1.2 → 3.0.0
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/lib/towsta.rb +13 -36
- data/lib/towsta/{vertical-core → core}/attributes.rb +1 -3
- data/lib/towsta/{vertical-core → core}/base.rb +1 -1
- data/lib/towsta/{vertical-core → core}/crud.rb +1 -2
- data/lib/towsta/{vertical-core → core}/mail.rb +1 -5
- data/lib/towsta/{vertical-core → core}/references.rb +2 -2
- data/lib/towsta/frameworks/rails.rb +8 -0
- data/lib/towsta/sync_with_towsta.rb +3 -0
- data/lib/towsta/version.rb +1 -1
- data/lib/towsta/vertical.rb +4 -8
- data/towsta.gemspec +2 -5
- metadata +18 -58
- data/bin/towsta +0 -4
- data/lib/towsta/envs/development.rb +0 -5
- data/lib/towsta/envs/production.rb +0 -15
- data/lib/towsta/envs/test.rb +0 -5
- data/lib/towsta/login.rb +0 -19
- data/lib/towsta/memory.rb +0 -27
- data/lib/towsta/shell.rb +0 -22
- data/lib/towsta/vertical-core/locales.rb +0 -21
data/lib/towsta.rb
CHANGED
@@ -1,41 +1,18 @@
|
|
1
1
|
#coding: utf-8
|
2
|
-
|
3
|
-
require
|
4
|
-
require 'bresson'
|
5
|
-
require 'cameraman'
|
6
|
-
require 'active_support/all'
|
7
|
-
|
8
|
-
require File.expand_path('../towsta/vertical-core/base', __FILE__)
|
9
|
-
require File.expand_path('../towsta/vertical-core/attributes', __FILE__)
|
10
|
-
require File.expand_path('../towsta/vertical-core/crud', __FILE__)
|
11
|
-
require File.expand_path('../towsta/vertical-core/locales', __FILE__)
|
12
|
-
require File.expand_path('../towsta/vertical-core/mail', __FILE__)
|
13
|
-
require File.expand_path('../towsta/vertical-core/references', __FILE__)
|
14
|
-
require File.expand_path('../towsta/kinds/main', __FILE__)
|
15
|
-
require File.expand_path('../towsta/vertical', __FILE__)
|
16
|
-
require File.expand_path('../towsta/synchronizer', __FILE__)
|
17
|
-
require File.expand_path('../towsta/login', __FILE__)
|
18
|
-
require File.expand_path('../towsta/shell', __FILE__)
|
19
|
-
require File.expand_path('../towsta/kinds/boolean', __FILE__)
|
20
|
-
require File.expand_path('../towsta/kinds/date', __FILE__)
|
21
|
-
require File.expand_path('../towsta/kinds/datetime', __FILE__)
|
22
|
-
require File.expand_path('../towsta/kinds/file', __FILE__)
|
23
|
-
require File.expand_path('../towsta/kinds/formated', __FILE__)
|
24
|
-
require File.expand_path('../towsta/kinds/gallery', __FILE__)
|
25
|
-
require File.expand_path('../towsta/kinds/image', __FILE__)
|
26
|
-
require File.expand_path('../towsta/kinds/integer', __FILE__)
|
27
|
-
require File.expand_path('../towsta/kinds/link', __FILE__)
|
28
|
-
require File.expand_path('../towsta/kinds/list', __FILE__)
|
29
|
-
require File.expand_path('../towsta/kinds/money', __FILE__)
|
30
|
-
require File.expand_path('../towsta/kinds/password', __FILE__)
|
31
|
-
require File.expand_path('../towsta/kinds/text', __FILE__)
|
32
|
-
require File.expand_path('../towsta/kinds/user', __FILE__)
|
33
|
-
require File.expand_path('../towsta/kinds/vertical', __FILE__)
|
34
|
-
require File.expand_path('../towsta/kinds/video', __FILE__)
|
35
|
-
require File.expand_path('../towsta/kinds/multiple', __FILE__)
|
2
|
+
files = %w(cgi net/http json bresson cameraman active_support/all)
|
3
|
+
files.each {|file| require file}
|
36
4
|
|
37
5
|
module Towsta
|
38
|
-
mattr_accessor :secret, :global, :author
|
6
|
+
mattr_accessor :secret, :global, :author, :models_path, :env
|
39
7
|
end
|
40
8
|
|
41
|
-
|
9
|
+
files = %w(base attributes crud mail references)
|
10
|
+
files.each {|file| require "towsta/core/#{file}"}
|
11
|
+
|
12
|
+
files = %w(version synchronizer vertical sync_with_towsta)
|
13
|
+
files.each {|file| require "towsta/#{file}"}
|
14
|
+
|
15
|
+
files = %w(main boolean date datetime file formated gallery image integer link list money multiple password text user vertical video)
|
16
|
+
files.each {|file| require "towsta/kinds/#{file}"}
|
17
|
+
|
18
|
+
require 'towsta/frameworks/rails' if defined? Rails
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Towsta
|
2
2
|
|
3
|
-
class
|
3
|
+
class Core
|
4
4
|
|
5
5
|
attr_accessor :message
|
6
6
|
|
@@ -26,7 +26,6 @@ module Towsta
|
|
26
26
|
@message = response[:message]
|
27
27
|
self.id = response[:id] if response[:status]
|
28
28
|
self.author = User.find_by_email creator
|
29
|
-
#Towsta::Memory.flush if production?
|
30
29
|
response[:status]
|
31
30
|
end
|
32
31
|
|
data/lib/towsta/version.rb
CHANGED
data/lib/towsta/vertical.rb
CHANGED
@@ -2,16 +2,12 @@ module Towsta
|
|
2
2
|
|
3
3
|
class Vertical
|
4
4
|
|
5
|
-
cattr_accessor :all
|
6
|
-
|
7
|
-
self.all ||= []
|
8
|
-
|
9
5
|
def self.create args
|
10
|
-
|
6
|
+
model_file = Towsta.models_path + args[:name].underscore + '.rb'
|
7
|
+
File.open(model_file, 'w') {|f| f.write("class #{args[:name]} < Towsta::Core\nend")} unless File.exists? model_file || Towsta.env == 'production'
|
8
|
+
klass = Object.const_get args[:name]
|
9
|
+
args[:slices].each { |attr, kind| klass.define_attribute attr, kind }
|
11
10
|
klass.all = []
|
12
|
-
Vertical.all << klass
|
13
|
-
Object.const_set args[:name], klass
|
14
|
-
puts " class #{args[:name]} was created"
|
15
11
|
end
|
16
12
|
|
17
13
|
def self.populate classname, horizontals, count, occurrences = []
|
data/towsta.gemspec
CHANGED
@@ -10,16 +10,13 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.authors = ["Mortaro"]
|
11
11
|
s.email = ["mortaro@towsta.com"]
|
12
12
|
s.homepage = "http://rubygems.org/gems/towsta"
|
13
|
-
s.summary = %q{Api Integration
|
14
|
-
s.description = %q{Simply integrates the
|
13
|
+
s.summary = %q{Towsta's Api Integration Gem}
|
14
|
+
s.description = %q{Simply integrates the Towsta api}
|
15
15
|
|
16
16
|
s.rubyforge_project = "towsta"
|
17
17
|
|
18
|
-
s.add_dependency "json"
|
19
18
|
s.add_dependency "bresson"
|
20
19
|
s.add_dependency "cameraman"
|
21
|
-
s.add_dependency "active_support"
|
22
|
-
s.add_dependency 'dalli'
|
23
20
|
|
24
21
|
s.add_development_dependency 'rspec'
|
25
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: towsta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: json
|
16
|
-
requirement: &21240300 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *21240300
|
25
14
|
- !ruby/object:Gem::Dependency
|
26
15
|
name: bresson
|
27
|
-
requirement: &
|
16
|
+
requirement: &26972220 !ruby/object:Gem::Requirement
|
28
17
|
none: false
|
29
18
|
requirements:
|
30
19
|
- - ! '>='
|
@@ -32,32 +21,10 @@ dependencies:
|
|
32
21
|
version: '0'
|
33
22
|
type: :runtime
|
34
23
|
prerelease: false
|
35
|
-
version_requirements: *
|
24
|
+
version_requirements: *26972220
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: cameraman
|
38
|
-
requirement: &
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *21279804
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: active_support
|
49
|
-
requirement: &21279444 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *21279444
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: dalli
|
60
|
-
requirement: &21278976 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &26971752 !ruby/object:Gem::Requirement
|
61
28
|
none: false
|
62
29
|
requirements:
|
63
30
|
- - ! '>='
|
@@ -65,10 +32,10 @@ dependencies:
|
|
65
32
|
version: '0'
|
66
33
|
type: :runtime
|
67
34
|
prerelease: false
|
68
|
-
version_requirements: *
|
35
|
+
version_requirements: *26971752
|
69
36
|
- !ruby/object:Gem::Dependency
|
70
37
|
name: rspec
|
71
|
-
requirement: &
|
38
|
+
requirement: &26971236 !ruby/object:Gem::Requirement
|
72
39
|
none: false
|
73
40
|
requirements:
|
74
41
|
- - ! '>='
|
@@ -76,12 +43,11 @@ dependencies:
|
|
76
43
|
version: '0'
|
77
44
|
type: :development
|
78
45
|
prerelease: false
|
79
|
-
version_requirements: *
|
80
|
-
description: Simply integrates the
|
46
|
+
version_requirements: *26971236
|
47
|
+
description: Simply integrates the Towsta api
|
81
48
|
email:
|
82
49
|
- mortaro@towsta.com
|
83
|
-
executables:
|
84
|
-
- towsta
|
50
|
+
executables: []
|
85
51
|
extensions: []
|
86
52
|
extra_rdoc_files: []
|
87
53
|
files:
|
@@ -89,11 +55,13 @@ files:
|
|
89
55
|
- Gemfile
|
90
56
|
- Gemfile.lock
|
91
57
|
- Rakefile
|
92
|
-
- bin/towsta
|
93
58
|
- lib/towsta.rb
|
94
|
-
- lib/towsta/
|
95
|
-
- lib/towsta/
|
96
|
-
- lib/towsta/
|
59
|
+
- lib/towsta/core/attributes.rb
|
60
|
+
- lib/towsta/core/base.rb
|
61
|
+
- lib/towsta/core/crud.rb
|
62
|
+
- lib/towsta/core/mail.rb
|
63
|
+
- lib/towsta/core/references.rb
|
64
|
+
- lib/towsta/frameworks/rails.rb
|
97
65
|
- lib/towsta/kinds/boolean.rb
|
98
66
|
- lib/towsta/kinds/date.rb
|
99
67
|
- lib/towsta/kinds/datetime.rb
|
@@ -112,17 +80,9 @@ files:
|
|
112
80
|
- lib/towsta/kinds/user.rb
|
113
81
|
- lib/towsta/kinds/vertical.rb
|
114
82
|
- lib/towsta/kinds/video.rb
|
115
|
-
- lib/towsta/
|
116
|
-
- lib/towsta/memory.rb
|
117
|
-
- lib/towsta/shell.rb
|
83
|
+
- lib/towsta/sync_with_towsta.rb
|
118
84
|
- lib/towsta/synchronizer.rb
|
119
85
|
- lib/towsta/version.rb
|
120
|
-
- lib/towsta/vertical-core/attributes.rb
|
121
|
-
- lib/towsta/vertical-core/base.rb
|
122
|
-
- lib/towsta/vertical-core/crud.rb
|
123
|
-
- lib/towsta/vertical-core/locales.rb
|
124
|
-
- lib/towsta/vertical-core/mail.rb
|
125
|
-
- lib/towsta/vertical-core/references.rb
|
126
86
|
- lib/towsta/vertical.rb
|
127
87
|
- spec/kinds/boolean_spec.rb
|
128
88
|
- spec/kinds/date_spec.rb
|
@@ -175,5 +135,5 @@ rubyforge_project: towsta
|
|
175
135
|
rubygems_version: 1.8.16
|
176
136
|
signing_key:
|
177
137
|
specification_version: 3
|
178
|
-
summary: Api Integration
|
138
|
+
summary: Towsta's Api Integration Gem
|
179
139
|
test_files: []
|
data/bin/towsta
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'dalli'
|
2
|
-
set :cache, Dalli::Client.new
|
3
|
-
require File.expand_path('../../memory', __FILE__)
|
4
|
-
|
5
|
-
def sync_with_towsta params={}
|
6
|
-
sync = Towsta::Synchronizer.new params: params, request: :all
|
7
|
-
(Dir["./controllers/*.rb"] + Dir["./models/*.rb"]).each {|file| load file}
|
8
|
-
sync.status
|
9
|
-
end
|
10
|
-
|
11
|
-
#Towsta::Synchronizer.new params: {}, request: :structure
|
12
|
-
|
13
|
-
#def sync_with_towsta params={}
|
14
|
-
# Towsta::Memory.recover(params).status
|
15
|
-
#end
|
data/lib/towsta/envs/test.rb
DELETED
data/lib/towsta/login.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Towsta
|
2
|
-
|
3
|
-
class Login
|
4
|
-
|
5
|
-
def self.authenticate params
|
6
|
-
response = Towsta::Synchronizer.authentication_request params
|
7
|
-
session[:current_user] = response[:id] if response[:status]
|
8
|
-
response[:status]
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.rescue
|
12
|
-
return User.find(session[:current_user]) if defined? User
|
13
|
-
session[:current_user]
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
data/lib/towsta/memory.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module Towsta
|
2
|
-
|
3
|
-
class Memory
|
4
|
-
|
5
|
-
def self.recover params
|
6
|
-
md5 = Memory.md5(params)
|
7
|
-
if settings.cache.get(md5)
|
8
|
-
puts "\nUsing cache to Towst"
|
9
|
-
Towsta::Synchronizer.new cache: settings.cache.get(md5), request: :horizontals
|
10
|
-
else
|
11
|
-
puts "\nCreating cache"
|
12
|
-
syn = Towsta::Synchronizer.new params: params, request: :horizontals
|
13
|
-
settings.cache.set(md5,syn.response)
|
14
|
-
syn
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.flush
|
19
|
-
settings.cache.flush
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.md5 params
|
23
|
-
digest = Digest::MD5.hexdigest(params.inspect.to_s + 'Towsta')
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
data/lib/towsta/shell.rb
DELETED
@@ -1,22 +0,0 @@
|
|
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,21 +0,0 @@
|
|
1
|
-
module Towsta
|
2
|
-
|
3
|
-
class VerticalCore
|
4
|
-
|
5
|
-
include R18n::Helpers rescue nil
|
6
|
-
|
7
|
-
def i18n attr
|
8
|
-
self.send :"#{attr.to_s}_#{R18n.get.locales.first.code}"
|
9
|
-
end
|
10
|
-
|
11
|
-
def method_missing meth, *args, &block
|
12
|
-
begin
|
13
|
-
return self.i18n meth.to_sym
|
14
|
-
rescue
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|