ffcrm_cloudfuji 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +24 -2
- data/Rakefile +26 -4
- data/config/database.yml +8 -0
- data/config.ru +7 -0
- data/ffcrm_cloudfuji.gemspec +5 -1
- data/lib/fat_free_crm/cloudfuji/event_observers/app_observer.rb +24 -12
- data/lib/fat_free_crm/cloudfuji/version.rb +1 -1
- data/spec/event_observers/app_observer_spec.rb +39 -0
- data/spec/internal/config/database.yml +8 -0
- data/spec/internal/db/schema.rb +426 -0
- data/spec/spec_helper.rb +26 -0
- metadata +61 -7
- data/lib/fat_free_crm/cloudfuji/mail_routes.rb +0 -24
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,5 +1,27 @@
|
|
1
|
-
source
|
1
|
+
source :rubygems
|
2
2
|
|
3
|
-
gem '
|
3
|
+
gem 'bundler_local_development', :group => :development, :require => false
|
4
|
+
begin
|
5
|
+
require 'bundler_local_development'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
4
8
|
|
5
9
|
gemspec
|
10
|
+
|
11
|
+
gem 'fat_free_crm', :git => 'git://github.com/fatfreecrm/fat_free_crm.git'
|
12
|
+
gem 'cloudfuji', :git => 'git://github.com/cloudfuji/cloudfuji_client.git'
|
13
|
+
|
14
|
+
group :test, :development do
|
15
|
+
gem 'pg' # Default database for testing
|
16
|
+
end
|
17
|
+
|
18
|
+
group :test do
|
19
|
+
gem 'rspec'
|
20
|
+
gem 'combustion'
|
21
|
+
gem 'factory_girl'
|
22
|
+
unless ENV["CI"]
|
23
|
+
gem 'ruby-debug', :platform => :mri_18
|
24
|
+
gem (RUBY_VERSION == "1.9.2" ? 'ruby-debug19' : 'debugger'), :platform => :mri_19
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
data/Rakefile
CHANGED
@@ -1,5 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
Bundler.require :default, :development
|
4
8
|
|
5
|
-
|
9
|
+
task :environment do
|
10
|
+
Combustion.initialize!
|
11
|
+
end
|
12
|
+
Combustion::Application.load_tasks
|
13
|
+
|
14
|
+
class Combustion::Application
|
15
|
+
# Add migrations from all engines
|
16
|
+
Railties.engines.each do |engine|
|
17
|
+
config.paths['db/migrate'] += engine.paths['db/migrate'].existent
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Default: run spec tests.'
|
22
|
+
task :default => :spec
|
23
|
+
|
24
|
+
# Let Combustion handle database preparation
|
25
|
+
Rake::Task["spec"].prerequisites.clear
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
data/config/database.yml
ADDED
data/config.ru
ADDED
data/ffcrm_cloudfuji.gemspec
CHANGED
@@ -12,7 +12,11 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
s.version = FatFreeCRM::Cloudfuji::VERSION
|
14
14
|
|
15
|
-
s.
|
15
|
+
s.add_development_dependency 'rspec-rails', '~> 2.6'
|
16
|
+
s.add_development_dependency 'capybara'
|
17
|
+
s.add_development_dependency 'combustion'
|
18
|
+
|
19
|
+
s.add_dependency 'cloudfuji', '>= 0.0.41'
|
16
20
|
s.add_dependency 'authlogic_cloudfuji', '~> 0.9'
|
17
21
|
|
18
22
|
end
|
@@ -3,23 +3,35 @@ module FatFreeCRM
|
|
3
3
|
module EventObservers
|
4
4
|
class AppObserver < ::Cloudfuji::EventObserver
|
5
5
|
def app_claimed
|
6
|
-
|
7
|
-
|
8
|
-
puts "Setting username to: #{params.try(:[], 'ido_id')}"
|
6
|
+
# Be verbose in development environment
|
7
|
+
debug = Rails.env == 'development'
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
data = params['data']
|
9
|
+
data = params['data']
|
10
|
+
ido_id = data.try(:[], 'ido_id')
|
13
11
|
|
14
|
-
|
12
|
+
if user = User.find_by_email(data['email'])
|
13
|
+
puts "Updating #{user.inspect} with incoming data #{params.inspect}" if debug
|
14
|
+
else
|
15
|
+
user = User.new
|
16
|
+
puts "Creating User with incoming data #{params.inspect}" if debug
|
17
|
+
end
|
18
|
+
|
19
|
+
puts "Authlogic username column: #{::Authlogic::Cas.cas_username_column}=" if debug
|
20
|
+
puts "Setting username to: #{ido_id}" if debug
|
21
|
+
|
22
|
+
user.email = data['email']
|
23
|
+
# Set first and last name from email if both blank
|
24
|
+
if user.first_name.blank? && user.last_name.blank?
|
15
25
|
user.first_name = user.email.split('@').first
|
16
26
|
user.last_name = user.email.split('@').last
|
17
|
-
user.username = data['email']
|
18
|
-
user.deleted_at = nil
|
19
|
-
user.send("#{::Authlogic::Cas.cas_username_column}=".to_sym, params['data'].try(:[], 'ido_id'))
|
20
|
-
puts user.inspect
|
21
|
-
user.save!
|
22
27
|
end
|
28
|
+
user.username = ido_id
|
29
|
+
user.deleted_at = nil
|
30
|
+
user.admin = true
|
31
|
+
user.send("#{::Authlogic::Cas.cas_username_column}=".to_sym, ido_id)
|
32
|
+
|
33
|
+
puts user.inspect if debug
|
34
|
+
user.save!
|
23
35
|
end
|
24
36
|
end
|
25
37
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
include FatFreeCRM::Cloudfuji::EventObservers
|
4
|
+
|
5
|
+
describe AppObserver do
|
6
|
+
describe "App Claimed" do
|
7
|
+
before do
|
8
|
+
@observer = AppObserver.new
|
9
|
+
@observer.params = {
|
10
|
+
'data' => {
|
11
|
+
'ido_id' => '57a57c56b57d76e76f',
|
12
|
+
'email' => 'cloudfuji_user@cloudfuji.com'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should update a known user if app is claimed by a recognized email address" do
|
18
|
+
@user = FactoryGirl.create(:user, :email => 'cloudfuji_user@cloudfuji.com', :ido_id => "123456789")
|
19
|
+
original_name = [@user.first_name, @user.last_name]
|
20
|
+
|
21
|
+
@observer.app_claimed
|
22
|
+
|
23
|
+
# Should not create a new user
|
24
|
+
User.find_all_by_email('cloudfuji_user@cloudfuji.com').size.should == 1
|
25
|
+
|
26
|
+
@user.reload
|
27
|
+
[@user.first_name, @user.last_name].should == original_name
|
28
|
+
@user.ido_id.should == '57a57c56b57d76e76f'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should create a new user if app is claimed by an unrecognized email address" do
|
32
|
+
@observer.app_claimed
|
33
|
+
|
34
|
+
@user = User.find_by_email('cloudfuji_user@cloudfuji.com')
|
35
|
+
@user.first_name.should == "cloudfuji_user"
|
36
|
+
@user.last_name.should == "cloudfuji.com"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,426 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20120510025219) do
|
15
|
+
|
16
|
+
create_table "account_contacts", :force => true do |t|
|
17
|
+
t.integer "account_id"
|
18
|
+
t.integer "contact_id"
|
19
|
+
t.datetime "deleted_at"
|
20
|
+
t.datetime "created_at", :null => false
|
21
|
+
t.datetime "updated_at", :null => false
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table "account_opportunities", :force => true do |t|
|
25
|
+
t.integer "account_id"
|
26
|
+
t.integer "opportunity_id"
|
27
|
+
t.datetime "deleted_at"
|
28
|
+
t.datetime "created_at", :null => false
|
29
|
+
t.datetime "updated_at", :null => false
|
30
|
+
end
|
31
|
+
|
32
|
+
create_table "accounts", :force => true do |t|
|
33
|
+
t.integer "user_id"
|
34
|
+
t.integer "assigned_to"
|
35
|
+
t.string "name", :limit => 64, :default => "", :null => false
|
36
|
+
t.string "access", :limit => 8, :default => "Public"
|
37
|
+
t.string "website", :limit => 64
|
38
|
+
t.string "toll_free_phone", :limit => 32
|
39
|
+
t.string "phone", :limit => 32
|
40
|
+
t.string "fax", :limit => 32
|
41
|
+
t.datetime "deleted_at"
|
42
|
+
t.datetime "created_at", :null => false
|
43
|
+
t.datetime "updated_at", :null => false
|
44
|
+
t.string "email", :limit => 64
|
45
|
+
t.string "background_info"
|
46
|
+
t.integer "rating", :default => 0, :null => false
|
47
|
+
t.string "category", :limit => 32
|
48
|
+
t.text "subscribed_users"
|
49
|
+
end
|
50
|
+
|
51
|
+
add_index "accounts", ["assigned_to"], :name => "index_accounts_on_assigned_to"
|
52
|
+
add_index "accounts", ["user_id", "name", "deleted_at"], :name => "index_accounts_on_user_id_and_name_and_deleted_at", :unique => true
|
53
|
+
|
54
|
+
create_table "activities", :force => true do |t|
|
55
|
+
t.integer "user_id"
|
56
|
+
t.integer "subject_id"
|
57
|
+
t.string "subject_type"
|
58
|
+
t.string "action", :limit => 32, :default => "created"
|
59
|
+
t.string "info", :default => ""
|
60
|
+
t.boolean "private", :default => false
|
61
|
+
t.datetime "created_at", :null => false
|
62
|
+
t.datetime "updated_at", :null => false
|
63
|
+
end
|
64
|
+
|
65
|
+
add_index "activities", ["created_at"], :name => "index_activities_on_created_at"
|
66
|
+
add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
|
67
|
+
|
68
|
+
create_table "addresses", :force => true do |t|
|
69
|
+
t.string "street1"
|
70
|
+
t.string "street2"
|
71
|
+
t.string "city", :limit => 64
|
72
|
+
t.string "state", :limit => 64
|
73
|
+
t.string "zipcode", :limit => 16
|
74
|
+
t.string "country", :limit => 64
|
75
|
+
t.string "full_address"
|
76
|
+
t.string "address_type", :limit => 16
|
77
|
+
t.integer "addressable_id"
|
78
|
+
t.string "addressable_type"
|
79
|
+
t.datetime "created_at", :null => false
|
80
|
+
t.datetime "updated_at", :null => false
|
81
|
+
t.datetime "deleted_at"
|
82
|
+
end
|
83
|
+
|
84
|
+
add_index "addresses", ["addressable_id", "addressable_type"], :name => "index_addresses_on_addressable_id_and_addressable_type"
|
85
|
+
|
86
|
+
create_table "avatars", :force => true do |t|
|
87
|
+
t.integer "user_id"
|
88
|
+
t.integer "entity_id"
|
89
|
+
t.string "entity_type"
|
90
|
+
t.integer "image_file_size"
|
91
|
+
t.string "image_file_name"
|
92
|
+
t.string "image_content_type"
|
93
|
+
t.datetime "created_at", :null => false
|
94
|
+
t.datetime "updated_at", :null => false
|
95
|
+
end
|
96
|
+
|
97
|
+
create_table "campaigns", :force => true do |t|
|
98
|
+
t.integer "user_id"
|
99
|
+
t.integer "assigned_to"
|
100
|
+
t.string "name", :limit => 64, :default => "", :null => false
|
101
|
+
t.string "access", :limit => 8, :default => "Public"
|
102
|
+
t.string "status", :limit => 64
|
103
|
+
t.decimal "budget", :precision => 12, :scale => 2
|
104
|
+
t.integer "target_leads"
|
105
|
+
t.float "target_conversion"
|
106
|
+
t.decimal "target_revenue", :precision => 12, :scale => 2
|
107
|
+
t.integer "leads_count"
|
108
|
+
t.integer "opportunities_count"
|
109
|
+
t.decimal "revenue", :precision => 12, :scale => 2
|
110
|
+
t.date "starts_on"
|
111
|
+
t.date "ends_on"
|
112
|
+
t.text "objectives"
|
113
|
+
t.datetime "deleted_at"
|
114
|
+
t.datetime "created_at", :null => false
|
115
|
+
t.datetime "updated_at", :null => false
|
116
|
+
t.string "background_info"
|
117
|
+
t.text "subscribed_users"
|
118
|
+
end
|
119
|
+
|
120
|
+
add_index "campaigns", ["assigned_to"], :name => "index_campaigns_on_assigned_to"
|
121
|
+
add_index "campaigns", ["user_id", "name", "deleted_at"], :name => "index_campaigns_on_user_id_and_name_and_deleted_at", :unique => true
|
122
|
+
|
123
|
+
create_table "comments", :force => true do |t|
|
124
|
+
t.integer "user_id"
|
125
|
+
t.integer "commentable_id"
|
126
|
+
t.string "commentable_type"
|
127
|
+
t.boolean "private"
|
128
|
+
t.string "title", :default => ""
|
129
|
+
t.text "comment"
|
130
|
+
t.datetime "created_at", :null => false
|
131
|
+
t.datetime "updated_at", :null => false
|
132
|
+
t.string "state", :limit => 16, :default => "Expanded", :null => false
|
133
|
+
end
|
134
|
+
|
135
|
+
create_table "contact_opportunities", :force => true do |t|
|
136
|
+
t.integer "contact_id"
|
137
|
+
t.integer "opportunity_id"
|
138
|
+
t.string "role", :limit => 32
|
139
|
+
t.datetime "deleted_at"
|
140
|
+
t.datetime "created_at", :null => false
|
141
|
+
t.datetime "updated_at", :null => false
|
142
|
+
end
|
143
|
+
|
144
|
+
create_table "contacts", :force => true do |t|
|
145
|
+
t.integer "user_id"
|
146
|
+
t.integer "lead_id"
|
147
|
+
t.integer "assigned_to"
|
148
|
+
t.integer "reports_to"
|
149
|
+
t.string "first_name", :limit => 64, :default => "", :null => false
|
150
|
+
t.string "last_name", :limit => 64, :default => "", :null => false
|
151
|
+
t.string "access", :limit => 8, :default => "Public"
|
152
|
+
t.string "title", :limit => 64
|
153
|
+
t.string "department", :limit => 64
|
154
|
+
t.string "source", :limit => 32
|
155
|
+
t.string "email", :limit => 64
|
156
|
+
t.string "alt_email", :limit => 64
|
157
|
+
t.string "phone", :limit => 32
|
158
|
+
t.string "mobile", :limit => 32
|
159
|
+
t.string "fax", :limit => 32
|
160
|
+
t.string "blog", :limit => 128
|
161
|
+
t.string "linkedin", :limit => 128
|
162
|
+
t.string "facebook", :limit => 128
|
163
|
+
t.string "twitter", :limit => 128
|
164
|
+
t.date "born_on"
|
165
|
+
t.boolean "do_not_call", :default => false, :null => false
|
166
|
+
t.datetime "deleted_at"
|
167
|
+
t.datetime "created_at", :null => false
|
168
|
+
t.datetime "updated_at", :null => false
|
169
|
+
t.string "background_info"
|
170
|
+
t.string "skype", :limit => 128
|
171
|
+
t.text "subscribed_users"
|
172
|
+
end
|
173
|
+
|
174
|
+
add_index "contacts", ["assigned_to"], :name => "index_contacts_on_assigned_to"
|
175
|
+
add_index "contacts", ["user_id", "last_name", "deleted_at"], :name => "id_last_name_deleted", :unique => true
|
176
|
+
|
177
|
+
create_table "emails", :force => true do |t|
|
178
|
+
t.string "imap_message_id", :null => false
|
179
|
+
t.integer "user_id"
|
180
|
+
t.integer "mediator_id"
|
181
|
+
t.string "mediator_type"
|
182
|
+
t.string "sent_from", :null => false
|
183
|
+
t.string "sent_to", :null => false
|
184
|
+
t.string "cc"
|
185
|
+
t.string "bcc"
|
186
|
+
t.string "subject"
|
187
|
+
t.text "body"
|
188
|
+
t.text "header"
|
189
|
+
t.datetime "sent_at"
|
190
|
+
t.datetime "received_at"
|
191
|
+
t.datetime "deleted_at"
|
192
|
+
t.datetime "created_at", :null => false
|
193
|
+
t.datetime "updated_at", :null => false
|
194
|
+
t.string "state", :limit => 16, :default => "Expanded", :null => false
|
195
|
+
end
|
196
|
+
|
197
|
+
add_index "emails", ["mediator_id", "mediator_type"], :name => "index_emails_on_mediator_id_and_mediator_type"
|
198
|
+
|
199
|
+
create_table "field_groups", :force => true do |t|
|
200
|
+
t.string "name", :limit => 64
|
201
|
+
t.string "label", :limit => 128
|
202
|
+
t.integer "position"
|
203
|
+
t.string "hint"
|
204
|
+
t.datetime "created_at", :null => false
|
205
|
+
t.datetime "updated_at", :null => false
|
206
|
+
t.integer "tag_id"
|
207
|
+
t.string "klass_name", :limit => 32
|
208
|
+
end
|
209
|
+
|
210
|
+
create_table "fields", :force => true do |t|
|
211
|
+
t.string "type"
|
212
|
+
t.integer "field_group_id"
|
213
|
+
t.integer "position"
|
214
|
+
t.string "name", :limit => 64
|
215
|
+
t.string "label", :limit => 128
|
216
|
+
t.string "hint"
|
217
|
+
t.string "placeholder"
|
218
|
+
t.string "as", :limit => 32
|
219
|
+
t.text "collection"
|
220
|
+
t.boolean "disabled"
|
221
|
+
t.boolean "required"
|
222
|
+
t.integer "maxlength"
|
223
|
+
t.datetime "created_at", :null => false
|
224
|
+
t.datetime "updated_at", :null => false
|
225
|
+
end
|
226
|
+
|
227
|
+
add_index "fields", ["field_group_id"], :name => "index_fields_on_field_group_id"
|
228
|
+
add_index "fields", ["name"], :name => "index_fields_on_name"
|
229
|
+
|
230
|
+
create_table "leads", :force => true do |t|
|
231
|
+
t.integer "user_id"
|
232
|
+
t.integer "campaign_id"
|
233
|
+
t.integer "assigned_to"
|
234
|
+
t.string "first_name", :limit => 64, :default => "", :null => false
|
235
|
+
t.string "last_name", :limit => 64, :default => "", :null => false
|
236
|
+
t.string "access", :limit => 8, :default => "Public"
|
237
|
+
t.string "title", :limit => 64
|
238
|
+
t.string "company", :limit => 64
|
239
|
+
t.string "source", :limit => 32
|
240
|
+
t.string "status", :limit => 32
|
241
|
+
t.string "referred_by", :limit => 64
|
242
|
+
t.string "email", :limit => 64
|
243
|
+
t.string "alt_email", :limit => 64
|
244
|
+
t.string "phone", :limit => 32
|
245
|
+
t.string "mobile", :limit => 32
|
246
|
+
t.string "blog", :limit => 128
|
247
|
+
t.string "linkedin", :limit => 128
|
248
|
+
t.string "facebook", :limit => 128
|
249
|
+
t.string "twitter", :limit => 128
|
250
|
+
t.integer "rating", :default => 0, :null => false
|
251
|
+
t.boolean "do_not_call", :default => false, :null => false
|
252
|
+
t.datetime "deleted_at"
|
253
|
+
t.datetime "created_at", :null => false
|
254
|
+
t.datetime "updated_at", :null => false
|
255
|
+
t.string "background_info"
|
256
|
+
t.string "skype", :limit => 128
|
257
|
+
t.text "subscribed_users"
|
258
|
+
end
|
259
|
+
|
260
|
+
add_index "leads", ["assigned_to"], :name => "index_leads_on_assigned_to"
|
261
|
+
add_index "leads", ["user_id", "last_name", "deleted_at"], :name => "index_leads_on_user_id_and_last_name_and_deleted_at", :unique => true
|
262
|
+
|
263
|
+
create_table "lists", :force => true do |t|
|
264
|
+
t.string "name"
|
265
|
+
t.text "url"
|
266
|
+
t.datetime "created_at", :null => false
|
267
|
+
t.datetime "updated_at", :null => false
|
268
|
+
end
|
269
|
+
|
270
|
+
create_table "opportunities", :force => true do |t|
|
271
|
+
t.integer "user_id"
|
272
|
+
t.integer "campaign_id"
|
273
|
+
t.integer "assigned_to"
|
274
|
+
t.string "name", :limit => 64, :default => "", :null => false
|
275
|
+
t.string "access", :limit => 8, :default => "Public"
|
276
|
+
t.string "source", :limit => 32
|
277
|
+
t.string "stage", :limit => 32
|
278
|
+
t.integer "probability"
|
279
|
+
t.decimal "amount", :precision => 12, :scale => 2
|
280
|
+
t.decimal "discount", :precision => 12, :scale => 2
|
281
|
+
t.date "closes_on"
|
282
|
+
t.datetime "deleted_at"
|
283
|
+
t.datetime "created_at", :null => false
|
284
|
+
t.datetime "updated_at", :null => false
|
285
|
+
t.string "background_info"
|
286
|
+
t.text "subscribed_users"
|
287
|
+
end
|
288
|
+
|
289
|
+
add_index "opportunities", ["assigned_to"], :name => "index_opportunities_on_assigned_to"
|
290
|
+
add_index "opportunities", ["user_id", "name", "deleted_at"], :name => "id_name_deleted", :unique => true
|
291
|
+
|
292
|
+
create_table "permissions", :force => true do |t|
|
293
|
+
t.integer "user_id"
|
294
|
+
t.integer "asset_id"
|
295
|
+
t.string "asset_type"
|
296
|
+
t.datetime "created_at", :null => false
|
297
|
+
t.datetime "updated_at", :null => false
|
298
|
+
end
|
299
|
+
|
300
|
+
add_index "permissions", ["asset_id", "asset_type"], :name => "index_permissions_on_asset_id_and_asset_type"
|
301
|
+
add_index "permissions", ["user_id"], :name => "index_permissions_on_user_id"
|
302
|
+
|
303
|
+
create_table "preferences", :force => true do |t|
|
304
|
+
t.integer "user_id"
|
305
|
+
t.string "name", :limit => 32, :default => "", :null => false
|
306
|
+
t.text "value"
|
307
|
+
t.datetime "created_at", :null => false
|
308
|
+
t.datetime "updated_at", :null => false
|
309
|
+
end
|
310
|
+
|
311
|
+
add_index "preferences", ["user_id", "name"], :name => "index_preferences_on_user_id_and_name"
|
312
|
+
|
313
|
+
create_table "sessions", :force => true do |t|
|
314
|
+
t.string "session_id", :null => false
|
315
|
+
t.text "data"
|
316
|
+
t.datetime "created_at", :null => false
|
317
|
+
t.datetime "updated_at", :null => false
|
318
|
+
end
|
319
|
+
|
320
|
+
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
321
|
+
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
322
|
+
|
323
|
+
create_table "settings", :force => true do |t|
|
324
|
+
t.string "name", :limit => 32, :default => "", :null => false
|
325
|
+
t.text "value"
|
326
|
+
t.datetime "created_at", :null => false
|
327
|
+
t.datetime "updated_at", :null => false
|
328
|
+
end
|
329
|
+
|
330
|
+
add_index "settings", ["name"], :name => "index_settings_on_name"
|
331
|
+
|
332
|
+
create_table "taggings", :force => true do |t|
|
333
|
+
t.integer "tag_id"
|
334
|
+
t.integer "taggable_id"
|
335
|
+
t.integer "tagger_id"
|
336
|
+
t.string "tagger_type"
|
337
|
+
t.string "taggable_type"
|
338
|
+
t.string "context"
|
339
|
+
t.datetime "created_at"
|
340
|
+
end
|
341
|
+
|
342
|
+
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
343
|
+
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
344
|
+
|
345
|
+
create_table "tags", :force => true do |t|
|
346
|
+
t.string "name"
|
347
|
+
end
|
348
|
+
|
349
|
+
create_table "tasks", :force => true do |t|
|
350
|
+
t.integer "user_id"
|
351
|
+
t.integer "assigned_to"
|
352
|
+
t.integer "completed_by"
|
353
|
+
t.string "name", :default => "", :null => false
|
354
|
+
t.integer "asset_id"
|
355
|
+
t.string "asset_type"
|
356
|
+
t.string "priority", :limit => 32
|
357
|
+
t.string "category", :limit => 32
|
358
|
+
t.string "bucket", :limit => 32
|
359
|
+
t.datetime "due_at"
|
360
|
+
t.datetime "completed_at"
|
361
|
+
t.datetime "deleted_at"
|
362
|
+
t.datetime "created_at", :null => false
|
363
|
+
t.datetime "updated_at", :null => false
|
364
|
+
t.string "background_info"
|
365
|
+
t.text "subscribed_users"
|
366
|
+
end
|
367
|
+
|
368
|
+
add_index "tasks", ["assigned_to"], :name => "index_tasks_on_assigned_to"
|
369
|
+
add_index "tasks", ["user_id", "name", "deleted_at"], :name => "index_tasks_on_user_id_and_name_and_deleted_at", :unique => true
|
370
|
+
|
371
|
+
create_table "users", :force => true do |t|
|
372
|
+
t.string "username", :limit => 32, :default => "", :null => false
|
373
|
+
t.string "email", :limit => 64, :default => "", :null => false
|
374
|
+
t.string "first_name", :limit => 32
|
375
|
+
t.string "last_name", :limit => 32
|
376
|
+
t.string "title", :limit => 64
|
377
|
+
t.string "company", :limit => 64
|
378
|
+
t.string "alt_email", :limit => 64
|
379
|
+
t.string "phone", :limit => 32
|
380
|
+
t.string "mobile", :limit => 32
|
381
|
+
t.string "aim", :limit => 32
|
382
|
+
t.string "yahoo", :limit => 32
|
383
|
+
t.string "google", :limit => 32
|
384
|
+
t.string "skype", :limit => 32
|
385
|
+
t.string "password_hash", :default => "", :null => false
|
386
|
+
t.string "password_salt", :default => "", :null => false
|
387
|
+
t.string "persistence_token", :default => "", :null => false
|
388
|
+
t.string "perishable_token", :default => "", :null => false
|
389
|
+
t.datetime "last_request_at"
|
390
|
+
t.datetime "last_login_at"
|
391
|
+
t.datetime "current_login_at"
|
392
|
+
t.string "last_login_ip"
|
393
|
+
t.string "current_login_ip"
|
394
|
+
t.integer "login_count", :default => 0, :null => false
|
395
|
+
t.datetime "deleted_at"
|
396
|
+
t.datetime "created_at", :null => false
|
397
|
+
t.datetime "updated_at", :null => false
|
398
|
+
t.boolean "admin", :default => false, :null => false
|
399
|
+
t.datetime "suspended_at"
|
400
|
+
t.string "single_access_token"
|
401
|
+
t.text "ido_id"
|
402
|
+
t.string "locale"
|
403
|
+
end
|
404
|
+
|
405
|
+
add_index "users", ["email"], :name => "index_users_on_email"
|
406
|
+
add_index "users", ["last_request_at"], :name => "index_users_on_last_request_at"
|
407
|
+
add_index "users", ["perishable_token"], :name => "index_users_on_perishable_token"
|
408
|
+
add_index "users", ["persistence_token"], :name => "index_users_on_remember_token"
|
409
|
+
add_index "users", ["username", "deleted_at"], :name => "index_users_on_username_and_deleted_at", :unique => true
|
410
|
+
|
411
|
+
create_table "versions", :force => true do |t|
|
412
|
+
t.string "item_type", :null => false
|
413
|
+
t.integer "item_id", :null => false
|
414
|
+
t.string "event", :null => false
|
415
|
+
t.string "whodunnit"
|
416
|
+
t.text "object"
|
417
|
+
t.datetime "created_at"
|
418
|
+
t.text "object_changes"
|
419
|
+
t.integer "related_id"
|
420
|
+
t.string "related_type"
|
421
|
+
end
|
422
|
+
|
423
|
+
add_index "versions", ["item_type", "item_id"], :name => "index_versions_on_item_type_and_item_id"
|
424
|
+
add_index "versions", ["whodunnit"], :name => "index_versions_on_whodunnit"
|
425
|
+
|
426
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require :default, :development
|
6
|
+
|
7
|
+
require 'rspec/rails'
|
8
|
+
require 'factory_girl'
|
9
|
+
require 'ffaker'
|
10
|
+
|
11
|
+
# Load factories from fat_free_crm
|
12
|
+
ffcrm_spec = Gem::Specification.find_by_name("fat_free_crm")
|
13
|
+
Dir[ffcrm_spec.gem_dir + "/spec/factories/*.rb"].each {|factory| require factory }
|
14
|
+
|
15
|
+
Combustion.initialize!
|
16
|
+
# Reload User model after schema is loaded,
|
17
|
+
# so that Authlogic detects password fields
|
18
|
+
load 'user.rb'
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.use_transactional_fixtures = true
|
22
|
+
end
|
23
|
+
|
24
|
+
# Cloudfuji::Platform.on_cloudfuji? is false,
|
25
|
+
# so we need to enable it manually
|
26
|
+
FatFreeCRM::Cloudfuji.enable_cloudfuji!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffcrm_cloudfuji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,17 +10,49 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: rspec-rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.6'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '2.6'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: capybara
|
17
33
|
requirement: !ruby/object:Gem::Requirement
|
18
34
|
none: false
|
19
35
|
requirements:
|
20
36
|
- - ! '>='
|
21
37
|
- !ruby/object:Gem::Version
|
22
38
|
version: '0'
|
23
|
-
type: :
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: combustion
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
24
56
|
prerelease: false
|
25
57
|
version_requirements: !ruby/object:Gem::Requirement
|
26
58
|
none: false
|
@@ -28,6 +60,22 @@ dependencies:
|
|
28
60
|
- - ! '>='
|
29
61
|
- !ruby/object:Gem::Version
|
30
62
|
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: cloudfuji
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.0.41
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.0.41
|
31
79
|
- !ruby/object:Gem::Dependency
|
32
80
|
name: authlogic_cloudfuji
|
33
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,10 +99,13 @@ extensions: []
|
|
51
99
|
extra_rdoc_files: []
|
52
100
|
files:
|
53
101
|
- .gitignore
|
102
|
+
- .travis.yml
|
54
103
|
- Gemfile
|
55
104
|
- MIT-LICENSE
|
56
105
|
- README
|
57
106
|
- Rakefile
|
107
|
+
- config.ru
|
108
|
+
- config/database.yml
|
58
109
|
- config/initializers/cloudfuji.rb
|
59
110
|
- config/routes.rb
|
60
111
|
- config/settings.yml
|
@@ -68,9 +119,12 @@ files:
|
|
68
119
|
- lib/fat_free_crm/cloudfuji/event_observers/email_observer.rb
|
69
120
|
- lib/fat_free_crm/cloudfuji/event_observers/payment_observer.rb
|
70
121
|
- lib/fat_free_crm/cloudfuji/event_observers/user_observer.rb
|
71
|
-
- lib/fat_free_crm/cloudfuji/mail_routes.rb
|
72
122
|
- lib/fat_free_crm/cloudfuji/version.rb
|
73
123
|
- lib/ffcrm_cloudfuji.rb
|
124
|
+
- spec/event_observers/app_observer_spec.rb
|
125
|
+
- spec/internal/config/database.yml
|
126
|
+
- spec/internal/db/schema.rb
|
127
|
+
- spec/spec_helper.rb
|
74
128
|
- uninstall.rb
|
75
129
|
homepage: http://cloudfuji.com
|
76
130
|
licenses: []
|
@@ -86,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
140
|
version: '0'
|
87
141
|
segments:
|
88
142
|
- 0
|
89
|
-
hash:
|
143
|
+
hash: -478798927
|
90
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
145
|
none: false
|
92
146
|
requirements:
|
@@ -95,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
149
|
version: '0'
|
96
150
|
segments:
|
97
151
|
- 0
|
98
|
-
hash:
|
152
|
+
hash: -478798927
|
99
153
|
requirements: []
|
100
154
|
rubyforge_project:
|
101
155
|
rubygems_version: 1.8.24
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# Mail routes
|
2
|
-
Cloudfuji::Mailroute.map do |m|
|
3
|
-
m.route("mail.new_comment") do
|
4
|
-
m.subject('{:project_title}: {:mock_title} #{:mock_version} comment {:parent_comment_id}',
|
5
|
-
:project_title => m.words_and_spaces,
|
6
|
-
:mock_title => m.words_and_spaces,
|
7
|
-
:mock_version => m.number,
|
8
|
-
:parent_comment_id => m.number)
|
9
|
-
|
10
|
-
|
11
|
-
# Must be replying to send a new comment via email
|
12
|
-
m.add_constraint(:reply, :required)
|
13
|
-
end
|
14
|
-
|
15
|
-
m.route("mail.new_project") do
|
16
|
-
m.subject("{:project_title}: {:mock_title}",
|
17
|
-
:project_title => m.words_and_spaces,
|
18
|
-
:mock_title => m.words_and_spaces)
|
19
|
-
end
|
20
|
-
|
21
|
-
m.route("mail.simple") do
|
22
|
-
m.subject("hello")
|
23
|
-
end
|
24
|
-
end
|