saucy 0.2.36 → 0.2.38

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -28,13 +28,15 @@ After you bundle, run the generators:
28
28
 
29
29
  You will want to include the `ensure_active_account` `before_filter` in any controller actions that you want to protect if the user is using an past due paid account.
30
30
 
31
- You will want to custom the from email address on billing emails:
31
+ You will want to customize the from email address on billing emails:
32
32
 
33
33
  Saucy::Configuration.mailer_sender = "billingemail@example.com"
34
34
 
35
35
  In addition, there are a number of strings such as application name, support url, etc. that are provided and customized with i18n translations. You can customize these in your app, and you can see what they are by looking at config/locales/en.yml in saucy.
36
36
 
37
- There is a `saucy:update_subscriptions` rake task which should be run on a regular basis to send receipts and payment processing problem emails.
37
+ There is a `saucy:daily` rake task which should be run on a regular basis to send receipts and payment processing problem emails.
38
+
39
+ Saucy accounts become "activated" once an initial setup step is complete. This could be creating the first bug for a bug tracker, or setting up a client gem for a server API. Once the application detects that the account is activate, it should set "active" to true on the account. This will prevent followup emails being sent to users that have already set up their accounts.
38
40
 
39
41
  Development environment
40
42
  -----------------------
@@ -83,3 +85,11 @@ To extend the ProjectsController:
83
85
  end
84
86
  end
85
87
 
88
+ ## Gotchas
89
+
90
+ Make sure you don't do this in ApplicationController:
91
+
92
+ before_filter :authenticate
93
+
94
+ Saucy's internal controllers don't skip any before filters.
95
+
@@ -32,5 +32,6 @@ Feature: edit permissions for a project
32
32
  When I follow "Stocknames" within "ul.projects"
33
33
  Then the "Bill" checkbox should not be checked
34
34
  And the "Jane" checkbox should be checked
35
+ And the "Hank" checkbox should be checked
35
36
  And I should not see "Jeff"
36
37
 
@@ -1,4 +1,23 @@
1
+ require 'rake'
2
+
3
+ module RakeHelpers
4
+ def fake_rake
5
+ old_rake = Rake.application
6
+ rake = Rake::Application.new
7
+ Rake.application = rake
8
+ task :environment
9
+ yield(rake)
10
+ ensure
11
+ Rake.application = old_rake
12
+ end
13
+ end
14
+
15
+ World(RakeHelpers)
16
+
1
17
  When /^the daily Saucy jobs are processed$/ do
2
- Saucy::Cron.run_daily
18
+ fake_rake do |rake|
19
+ Saucy::Engine.new.load_tasks
20
+ rake['saucy:daily'].invoke
21
+ end
3
22
  end
4
23
 
data/lib/saucy.rb CHANGED
@@ -7,5 +7,4 @@ require 'saucy/account_authorization'
7
7
  require 'saucy/configuration'
8
8
  require 'saucy/engine'
9
9
  require 'saucy/projects_controller'
10
- require 'saucy/cron'
11
10
 
data/lib/saucy/project.rb CHANGED
@@ -73,6 +73,7 @@ module Saucy
73
73
 
74
74
  def update_memberships
75
75
  if @new_user_ids
76
+ @new_user_ids += admin_user_ids
76
77
  removed_user_ids = self.user_ids - @new_user_ids
77
78
  added_user_ids = @new_user_ids - self.user_ids
78
79
 
@@ -84,6 +85,14 @@ module Saucy
84
85
  end
85
86
  end
86
87
  end
88
+
89
+ def admin_user_ids
90
+ account.
91
+ memberships.
92
+ where(:admin => true).
93
+ select(:user_id).
94
+ map(&:user_id)
95
+ end
87
96
  end
88
97
  end
89
98
  end
@@ -1,6 +1,22 @@
1
1
  namespace :saucy do
2
- desc "Completes the current iteration for each project"
2
+ desc "Updates subscription status and delivers receipt/problem notices"
3
3
  task :update_subscriptions => :environment do
4
4
  Account.update_subscriptions!
5
5
  end
6
+
7
+ desc "Deliver notifications for users that have signed up and aren't activated"
8
+ task :ask_users_to_activate => :environment do
9
+ Account.deliver_new_unactivated_notifications
10
+ end
11
+
12
+ desc "Deliver notifications to users with expiring trial accounts"
13
+ task :deliver_expiring_trial_notifications => :environment do
14
+ Account.deliver_expiring_trial_notifications
15
+ end
16
+
17
+ desc "Run all daily tasks"
18
+ task :daily => [:update_subscriptions,
19
+ :ask_users_to_activate,
20
+ :deliver_expiring_trial_notifications]
6
21
  end
22
+
@@ -120,14 +120,17 @@ describe Project, "assigning a new user list" do
120
120
  let(:account) { subject.account }
121
121
  let!(:member) { Factory(:user) }
122
122
  let!(:non_member) { Factory(:user) }
123
+ let!(:admin) { Factory(:user) }
123
124
 
124
125
  before do
125
126
  member_membership =
126
127
  Factory(:membership, :account => account, :user => member)
127
128
  non_member_membership =
128
129
  Factory(:membership, :account => account, :user => non_member)
130
+ admin_membership =
131
+ Factory(:membership, :account => account, :user => admin, :admin => true)
129
132
  Factory(:permission, :membership => member_membership,
130
- :project => subject)
133
+ :project => subject)
131
134
 
132
135
  subject.reload.update_attributes!(:user_ids => [non_member.id, ""])
133
136
  end
@@ -139,4 +142,8 @@ describe Project, "assigning a new user list" do
139
142
  it "removes a removed user" do
140
143
  non_member.should be_member_of(subject)
141
144
  end
145
+
146
+ it "keeps an admin" do
147
+ admin.should be_member_of(subject)
148
+ end
142
149
  end
metadata CHANGED
@@ -1,23 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 95
4
+ hash: 91
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 36
10
- version: 0.2.36
9
+ - 38
10
+ version: 0.2.38
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc.
14
14
  - Joe Ferris
15
15
  - Mike Burns
16
+ - Chad Pytel
16
17
  autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
20
 
20
- date: 2011-03-03 00:00:00 -05:00
21
+ date: 2011-03-04 00:00:00 -05:00
21
22
  default_executable:
22
23
  dependencies:
23
24
  - !ruby/object:Gem::Dependency
@@ -202,7 +203,6 @@ files:
202
203
  - lib/saucy/account.rb
203
204
  - lib/saucy/account_authorization.rb
204
205
  - lib/saucy/configuration.rb
205
- - lib/saucy/cron.rb
206
206
  - lib/saucy/engine.rb
207
207
  - lib/saucy/fake_braintree.rb
208
208
  - lib/saucy/layouts.rb
data/lib/saucy/cron.rb DELETED
@@ -1,9 +0,0 @@
1
- module Saucy
2
- module Cron
3
- def self.run_daily
4
- ::Account.deliver_new_unactivated_notifications
5
- ::Account.deliver_expiring_trial_notifications
6
- end
7
- end
8
- end
9
-