Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gigadoc 2
diaspora
Commits
c8f48206
Commit
c8f48206
authored
Jul 22, 2015
by
Steffen van Bergerem
Committed by
Jonne Haß
Jul 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove rake_helpers
parent
1dd76d7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
66 deletions
+0
-66
lib/rake_helpers.rb
lib/rake_helpers.rb
+0
-40
spec/lib/rake_helper_spec.rb
spec/lib/rake_helper_spec.rb
+0
-26
No files found.
lib/rake_helpers.rb
deleted
100644 → 0
View file @
1dd76d7c
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module
RakeHelpers
def
process_emails
(
csv
,
num_to_process
,
offset
,
test
=
true
)
require
'csv'
backers
=
CSV
.
read
(
csv
)
puts
"DRY RUN"
if
test
churn_through
=
0
num_to_process
.
times
do
|
n
|
if
backers
[
n
+
offset
]
==
nil
break
end
churn_through
=
n
backer_name
=
backers
[
n
+
offset
][
1
].
to_s
.
strip
backer_email
=
backers
[
n
+
offset
][
0
].
to_s
.
strip
.
downcase
possible_user
=
User
.
find_by_email
(
backer_email
)
possible_invite
=
Invitation
.
find_by_identifier
(
backer_email
)
possible_user
||=
possible_invite
.
recipient
if
possible_invite
.
present?
admin_account
=
User
.
find_by_username
(
AppConfig
.
admins
.
account
.
get
)
raise
"no admin account in diaspora.yml"
unless
admin_account
.
present?
admin_account
.
invitation_code
.
count
+=
num_to_process
admin_account
.
invitation_code
.
save
unless
possible_user
puts
"
#{
n
}
: sending email to:
#{
backer_name
}
#{
backer_email
}
"
unless
Rails
.
env
==
'test'
unless
test
i
=
EmailInviter
.
new
(
backer_email
)
i
.
send!
end
else
puts
"user with the email exists:
#{
backer_email
}
,
#{
backer_name
}
"
unless
Rails
.
env
==
'test'
end
end
churn_through
end
end
spec/lib/rake_helper_spec.rb
deleted
100644 → 0
View file @
1dd76d7c
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require
'spec_helper'
require
'rake_helpers'
include
RakeHelpers
describe
RakeHelpers
do
before
do
@csv
=
Rails
.
root
.
join
(
'spec'
,
'fixtures'
,
'test.csv'
)
end
describe
'#process_emails'
do
before
do
Devise
.
mailer
.
deliveries
=
[]
AppConfig
.
admins
.
account
=
FactoryGirl
.
create
(
:user
).
username
end
it
'should send emails to each email'
do
expect
(
EmailInviter
).
to
receive
(
:new
).
exactly
(
3
).
times
.
and_return
(
double
.
as_null_object
)
process_emails
(
@csv
,
100
,
1
,
false
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment