sufia 4.2.0 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +21 -0
  3. data/README.md +7 -19
  4. data/SUFIA_VERSION +1 -1
  5. data/app/assets/images/orcid.png +0 -0
  6. data/app/assets/javascripts/sufia.js +6 -1
  7. data/app/assets/javascripts/sufia/permissions.js +2 -26
  8. data/app/assets/stylesheets/sufia.css.scss +6 -0
  9. data/app/assets/stylesheets/sufia/_buttons.scss +6 -1
  10. data/app/assets/stylesheets/sufia/_dashboard.scss +10 -0
  11. data/app/assets/stylesheets/sufia/_file-listing.scss +8 -0
  12. data/app/assets/stylesheets/sufia/_settings.scss +1 -0
  13. data/app/helpers/batch_edits_helper.rb +1 -1
  14. data/app/helpers/sufia/sufia_helper_behavior.rb +11 -0
  15. data/app/models/featured_work_list.rb +4 -1
  16. data/app/views/batch/edit.html.erb +2 -2
  17. data/app/views/batch_edits/_check_all.html.erb +8 -6
  18. data/app/views/collections/_edit_descriptions.html.erb +1 -1
  19. data/app/views/dashboard/_index_partials/_stats.html.erb +10 -1
  20. data/app/views/generic_files/_descriptions.html.erb +1 -1
  21. data/app/views/generic_files/_permission.html.erb +2 -2
  22. data/app/views/generic_files/_permission_form.html.erb +4 -6
  23. data/app/views/generic_files/_versioning.html.erb +2 -2
  24. data/app/views/records/show_fields/_contributor.html.erb +1 -1
  25. data/app/views/records/show_fields/_creator.html.erb +1 -1
  26. data/app/views/users/_profile.html.erb +1 -2
  27. data/app/views/users/_user_info.html.erb +20 -3
  28. data/app/views/users/edit.html.erb +11 -2
  29. data/app/views/users/show.html.erb +1 -1
  30. data/config/locales/sufia.en.yml +5 -0
  31. data/lib/generators/sufia/install_generator.rb +4 -0
  32. data/lib/generators/sufia/templates/catalog_controller.rb +4 -0
  33. data/lib/sufia/version.rb +1 -1
  34. data/spec/controllers/users_controller_spec.rb +18 -10
  35. data/spec/features/browse_files_spec.rb +17 -3
  36. data/spec/features/users_spec.rb +1 -1
  37. data/spec/helpers/batch_edits_helper_spec.rb +7 -1
  38. data/spec/lib/sufia/user_stat_importer_spec.rb +206 -0
  39. data/spec/models/featured_work_list_spec.rb +12 -0
  40. data/spec/models/file_view_stat_spec.rb +6 -2
  41. data/spec/models/user_spec.rb +25 -2
  42. data/spec/models/user_usage_stats_spec.rb +39 -0
  43. data/spec/views/dashboard/index_spec.rb +4 -0
  44. data/spec/views/generic_file/_permission_form.html.erb_spec.rb +19 -0
  45. data/spec/views/generic_file/show.html.erb_spec.rb +2 -2
  46. data/sufia-models/app/models/concerns/sufia/file_stat_utils.rb +3 -3
  47. data/sufia-models/app/models/concerns/sufia/user.rb +27 -10
  48. data/sufia-models/app/models/concerns/sufia/user_usage_stats.rb +15 -0
  49. data/sufia-models/app/models/file_download_stat.rb +2 -2
  50. data/sufia-models/app/models/file_usage.rb +7 -3
  51. data/sufia-models/app/models/file_view_stat.rb +2 -2
  52. data/sufia-models/app/models/sufia/orcid_validator.rb +8 -0
  53. data/sufia-models/app/models/user_stat.rb +2 -0
  54. data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +30 -0
  55. data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +2 -31
  56. data/sufia-models/lib/generators/sufia/models/install_generator.rb +11 -31
  57. data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +19 -0
  58. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +2 -31
  59. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +3 -5
  60. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +5 -0
  61. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_user_stats.rb +19 -0
  62. data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +2 -33
  63. data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +31 -0
  64. data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +85 -0
  65. data/sufia-models/lib/sufia/models/version.rb +1 -1
  66. data/sufia-models/lib/tasks/stats_tasks.rake +12 -0
  67. data/sufia.gemspec +0 -1
  68. metadata +21 -19
  69. data/app/views/users/_social_media_info.html.erb +0 -20
@@ -2,8 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe FileViewStat, :type => :model do
4
4
  let (:file_id) {"99"}
5
+ let (:user_id) {123}
5
6
  let (:date) {DateTime.new}
6
- let (:file_stat) {FileViewStat.create(views:"25", date: date, file_id: file_id)}
7
+ let (:file_stat) {FileViewStat.create(views:"25", date: date, file_id: file_id, user_id: user_id)}
7
8
 
8
9
  it "has attributes" do
9
10
  expect(file_stat).to respond_to(:views)
@@ -12,6 +13,7 @@ RSpec.describe FileViewStat, :type => :model do
12
13
  expect(file_stat.file_id).to eq("99")
13
14
  expect(file_stat.date).to eq(date)
14
15
  expect(file_stat.views).to eq(25)
16
+ expect(file_stat.user_id).to eq(user_id)
15
17
  end
16
18
 
17
19
  describe "#get_float_statistics" do
@@ -46,7 +48,7 @@ RSpec.describe FileViewStat, :type => :model do
46
48
  describe "cache empty" do
47
49
  let (:stats) {
48
50
  expect(FileViewStat).to receive(:ga_statistics).and_return(sample_pageview_statistics)
49
- FileViewStat.statistics(file_id,Date.today-4.day)
51
+ FileViewStat.statistics(file_id, Date.today-4.day, user_id)
50
52
  }
51
53
 
52
54
  it "includes cached ga data" do
@@ -55,6 +57,7 @@ RSpec.describe FileViewStat, :type => :model do
55
57
 
56
58
  it "caches data" do
57
59
  expect(FileViewStat.to_flots stats).to include(*view_output)
60
+ expect(stats.first.user_id).to eq user_id
58
61
 
59
62
  # at this point all data should be cached
60
63
  allow(FileViewStat).to receive(:ga_statistics).with(Date.today, file_id).and_raise("We should not call Google Analytics All data should be cached!")
@@ -79,6 +82,7 @@ RSpec.describe FileViewStat, :type => :model do
79
82
  end
80
83
 
81
84
  end
85
+
82
86
  end
83
87
  end
84
88
 
@@ -6,8 +6,8 @@ describe User, :type => :model do
6
6
  @another_user = FactoryGirl.find_or_create(:archivist)
7
7
  end
8
8
  after(:all) do
9
- @user.delete
10
- @another_user.delete
9
+ @user.destroy
10
+ @another_user.destroy
11
11
  end
12
12
  it "should have an email" do
13
13
  expect(@user.user_key).to eq("jilluser@example.com")
@@ -25,6 +25,29 @@ describe User, :type => :model do
25
25
  expect(@user).to respond_to(:facebook_handle)
26
26
  expect(@user).to respond_to(:googleplus_handle)
27
27
  expect(@user).to respond_to(:linkedin_handle)
28
+ expect(@user).to respond_to(:orcid)
29
+ end
30
+ describe 'ORCID validation and normalization' do
31
+ it 'saves when a valid bare ORCID is supplied' do
32
+ @user.orcid = '0000-0000-1111-2222'
33
+ expect(@user).to be_valid
34
+ expect(@user.save).to be true
35
+ end
36
+ it 'saves when a valid ORCID URI is supplied' do
37
+ @user.orcid = 'http://orcid.org/0000-0000-1111-2222'
38
+ expect(@user).to be_valid
39
+ expect(@user.save).to be true
40
+ end
41
+ it 'normalizes bare ORCIDs to URIs' do
42
+ @user.orcid = '0000-0000-1111-2222'
43
+ @user.save
44
+ expect(@user.orcid).to eq 'http://orcid.org/0000-0000-1111-2222'
45
+ end
46
+ it 'marks bad ORCIDs as invalid' do
47
+ @user.orcid = '000-000-111-222'
48
+ expect(@user).not_to be_valid
49
+ expect(@user.save).to be false
50
+ end
28
51
  end
29
52
  it "should redefine to_param to make redis keys more recognizable (and useable within Rails URLs)" do
30
53
  expect(@user.to_param).to eq("jilluser@example-dot-com")
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sufia::UserUsageStats do
4
+ subject { FactoryGirl.create(:user) }
5
+
6
+ describe 'with cached stats' do
7
+ let!(:stat_1_day_ago) { UserStat.create!(user_id: subject.id, date: 1.days.ago, file_views: 3, file_downloads: 2) }
8
+ let!(:stat_2_days_ago) { UserStat.create!(user_id: subject.id, date: 2.days.ago, file_views: 2, file_downloads: 1) }
9
+
10
+ let!(:someone_elses_user_id) { subject.id + 1 }
11
+ let!(:not_my_stat) { UserStat.create!(user_id: someone_elses_user_id, date: 2.days.ago, file_views: 10, file_downloads: 11) }
12
+
13
+ describe '#total_file_views' do
14
+ it 'returns the total file views for that user' do
15
+ expect(subject.total_file_views).to eq 5
16
+ end
17
+ end
18
+
19
+ describe '#total_file_downloads' do
20
+ it 'returns the total file downloads for that user' do
21
+ expect(subject.total_file_downloads).to eq 3
22
+ end
23
+ end
24
+ end
25
+
26
+ describe 'with empty cache' do
27
+ describe '#total_file_views' do
28
+ it 'returns the total file views for that user' do
29
+ expect(subject.total_file_views).to eq 0
30
+ end
31
+ end
32
+
33
+ describe '#total_file_downloads' do
34
+ it 'returns the total file downloads for that user' do
35
+ expect(subject.total_file_downloads).to eq 0
36
+ end
37
+ end
38
+ end
39
+ end
@@ -12,6 +12,8 @@ describe "dashboard/index.html.erb", :type => :view do
12
12
  allow(@user).to receive(:all_following).and_return(["magneto"])
13
13
  allow(@user).to receive(:followers).and_return(["wolverine","storm"])
14
14
  allow(@user).to receive(:can_receive_deposits_from).and_return([])
15
+ allow(@user).to receive(:total_file_views).and_return(1)
16
+ allow(@user).to receive(:total_file_downloads).and_return(3)
15
17
  allow(controller).to receive(:current_user).and_return(@user)
16
18
  allow(view).to receive(:number_of_files).and_return("15")
17
19
  allow(view).to receive(:number_of_collections).and_return("3")
@@ -62,6 +64,8 @@ describe "dashboard/index.html.erb", :type => :view do
62
64
  expect(@sidebar).to include '<span class="badge">2</span>'
63
65
  expect(@sidebar).to include '<span class="badge">15</span>'
64
66
  expect(@sidebar).to include '<span class="badge">3</span>'
67
+ expect(@sidebar).to include '<span class="badge-optional">1</span> View'
68
+ expect(@sidebar).to include '<span class="badge-optional">3</span> Downloads'
65
69
  end
66
70
 
67
71
  it "should show the statistics before the profile" do
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'generic_files/_permission_form.html.erb', :type => :view do
4
+ let(:gf) {
5
+ stub_model(GenericFile, noid: '123',
6
+ depositor: 'bob',
7
+ resource_type: ['Dataset'])
8
+ }
9
+
10
+ before do
11
+ allow(controller).to receive(:current_user).and_return(stub_model(User))
12
+ end
13
+
14
+ it "should draw the permissions form without error" do
15
+ render partial: 'generic_files/permission_form.html.erb', locals: {gf: gf}
16
+ expect(rendered).to have_css("input#new_user_name_skel")
17
+ end
18
+
19
+ end
@@ -73,7 +73,7 @@ describe 'generic_files/show.html.erb', :type => :view do
73
73
  contributors = @item.properties['contributor']
74
74
  expect(contributors.count).to eq(2)
75
75
  contributor = contributors.first
76
- expect(contributor.type).to eq('http://schema.org/Agent')
76
+ expect(contributor.type).to eq('http://schema.org/Person')
77
77
  expect(contributor.properties['name'].first).to eq('Tweedledee')
78
78
  end
79
79
 
@@ -81,7 +81,7 @@ describe 'generic_files/show.html.erb', :type => :view do
81
81
  creators = @item.properties['creator']
82
82
  expect(creators.count).to eq(2)
83
83
  creator = creators.first
84
- expect(creator.type).to eq('http://schema.org/Agent')
84
+ expect(creator.type).to eq('http://schema.org/Person')
85
85
  expect(creator.properties['name'].first).to eq('Doe, John')
86
86
  end
87
87
 
@@ -17,13 +17,13 @@ module Sufia
17
17
  {ga_start_date: ga_start_date, cached_stats: stats.to_a }
18
18
  end
19
19
 
20
- def combined_stats file_id, start_date, object_method, ga_key
20
+ def combined_stats file_id, start_date, object_method, ga_key, user_id=nil
21
21
  stat_cache_info = cached_stats( file_id, start_date, object_method)
22
22
  stats = stat_cache_info[:cached_stats]
23
23
  if stat_cache_info[:ga_start_date] < Date.today
24
24
  ga_stats = ga_statistics(stat_cache_info[:ga_start_date], file_id)
25
25
  ga_stats.each do |stat|
26
- lstat = self.new file_id:file_id, date: stat[:date], object_method => stat[ga_key]
26
+ lstat = self.new file_id: file_id, date: stat[:date], object_method => stat[ga_key], user_id: user_id
27
27
  lstat.save unless Date.parse(stat[:date]) == Date.today
28
28
  stats << lstat
29
29
  end
@@ -32,4 +32,4 @@ module Sufia
32
32
  end
33
33
 
34
34
  end
35
- end
35
+ end
@@ -18,33 +18,50 @@ module Sufia::User
18
18
  # Users should be followable
19
19
  acts_as_followable
20
20
 
21
- # Setup accessible (or protected) attributes for your model
21
+ # Set up proxy-related relationships
22
22
  has_many :proxy_deposit_requests, foreign_key: 'receiving_user_id'
23
-
24
23
  has_many :deposit_rights_given, foreign_key: 'grantor_id', class_name: 'ProxyDepositRights', dependent: :destroy
25
24
  has_many :can_receive_deposits_from, through: :deposit_rights_given, source: :grantee
26
-
27
25
  has_many :deposit_rights_received, foreign_key: 'grantee_id', class_name: 'ProxyDepositRights', dependent: :destroy
28
26
  has_many :can_make_deposits_for, through: :deposit_rights_received, source: :grantor
29
27
 
28
+ # Validate and normalize ORCIDs
29
+ validates_with OrcidValidator
30
+ after_validation :normalize_orcid
31
+
32
+ # Set up user profile avatars
30
33
  mount_uploader :avatar, AvatarUploader, mount_on: :avatar_file_name
31
34
  validates_with AvatarValidator
35
+
32
36
  has_many :trophies
33
37
  attr_accessor :update_directory
34
38
  end
35
39
 
40
+ # Coerce the ORCID into URL format
41
+ def normalize_orcid
42
+ # Skip normalization if:
43
+ # 1. validation has already flagged the ORCID as invalid
44
+ # 2. the orcid field is blank
45
+ # 3. the orcid is already in its normalized form
46
+ return if self.errors[:orcid].first.present? || self.orcid.blank? || self.orcid.starts_with?('http://orcid.org/')
47
+ bare_orcid = /\d{4}-\d{4}-\d{4}-\d{4}/.match(self.orcid).string
48
+ self.orcid = "http://orcid.org/#{bare_orcid}"
49
+ end
50
+
36
51
  # Format the json for select2 which requires just an id and a field called text.
37
52
  # If we need an alternate format we should probably look at a json template gem
38
53
  def as_json(opts = nil)
39
- {id: user_key, text: display_name ? "#{display_name} (#{user_key})" : user_key}
54
+ { id: user_key, text: display_name ? "#{display_name} (#{user_key})" : user_key }
40
55
  end
41
56
 
42
57
  def email_address
43
- return self.email
58
+ self.email
44
59
  end
45
60
 
46
61
  def name
47
- return self.display_name.titleize || self.user_key rescue self.user_key
62
+ self.display_name.titleize || raise
63
+ rescue
64
+ self.user_key
48
65
  end
49
66
 
50
67
  # Redefine this for more intuitive keys in Redis
@@ -61,7 +78,7 @@ module Sufia::User
61
78
 
62
79
  # method needed for messaging
63
80
  def mailboxer_email(obj=nil)
64
- return nil
81
+ nil
65
82
  end
66
83
 
67
84
  # The basic groups method, override or will fallback to Sufia::Ldap::User
@@ -85,7 +102,9 @@ module Sufia::User
85
102
  [:email, :login, :display_name, :address, :admin_area,
86
103
  :department, :title, :office, :chat_id, :website, :affiliation,
87
104
  :telephone, :avatar, :group_list, :groups_last_update, :facebook_handle,
88
- :twitter_handle, :googleplus_handle, :linkedin_handle, :remove_avatar]
105
+ :twitter_handle, :googleplus_handle, :linkedin_handle, :remove_avatar,
106
+ :orcid
107
+ ]
89
108
  end
90
109
 
91
110
  def current
@@ -119,7 +138,5 @@ module Sufia::User
119
138
  def from_url_component(component)
120
139
  User.find_by_user_key(component.gsub(/-dot-/, '.'))
121
140
  end
122
-
123
141
  end
124
-
125
142
  end
@@ -0,0 +1,15 @@
1
+ module Sufia::UserUsageStats
2
+
3
+ def stats
4
+ @stats ||= UserStat.where(user_id: id).order(date: :asc)
5
+ end
6
+
7
+ def total_file_views
8
+ stats.reduce(0) { |total, stat| total + stat.file_views }
9
+ end
10
+
11
+ def total_file_downloads
12
+ stats.reduce(0) { |total, stat| total + stat.file_downloads }
13
+ end
14
+
15
+ end
@@ -5,8 +5,8 @@ class FileDownloadStat < ActiveRecord::Base
5
5
  [ self.class.convert_date(date), downloads ]
6
6
  end
7
7
 
8
- def self.statistics file_id, start_date
9
- combined_stats file_id, start_date, :downloads, :totalEvents
8
+ def self.statistics file_id, start_date, user_id=nil
9
+ combined_stats file_id, start_date, :downloads, :totalEvents, user_id
10
10
  end
11
11
 
12
12
  # Sufia::Download is sent to Sufia::Analytics.profile as #sufia__download
@@ -3,13 +3,17 @@ class FileUsage
3
3
  attr_accessor :id, :created, :path, :downloads, :pageviews
4
4
 
5
5
  def initialize id
6
+ file = ::GenericFile.find(id)
7
+ user = User.where(email: file.depositor).first
8
+ user_id = user ? user.id : nil
9
+
6
10
  self.id = id
7
11
  self.path = Sufia::Engine.routes.url_helpers.generic_file_path(Sufia::Noid.noidify(id))
8
12
  earliest = Sufia.config.analytic_start_date
9
- self.created = DateTime.parse(::GenericFile.find(id).create_date)
13
+ self.created = DateTime.parse(file.create_date)
10
14
  self.created = earliest > created ? earliest : created unless earliest.blank?
11
- self.downloads = FileDownloadStat.to_flots FileDownloadStat.statistics(id, created)
12
- self.pageviews = FileViewStat.to_flots FileViewStat.statistics(id, created)
15
+ self.downloads = FileDownloadStat.to_flots FileDownloadStat.statistics(id, created, user_id)
16
+ self.pageviews = FileViewStat.to_flots FileViewStat.statistics(id, created, user_id)
13
17
  end
14
18
 
15
19
  def total_downloads
@@ -5,8 +5,8 @@ class FileViewStat < ActiveRecord::Base
5
5
  [ self.class.convert_date(date), views ]
6
6
  end
7
7
 
8
- def self.statistics file_id, start_date
9
- combined_stats file_id, start_date, :views, :pageviews
8
+ def self.statistics file_id, start_date, user_id=nil
9
+ combined_stats file_id, start_date, :views, :pageviews, user_id
10
10
  end
11
11
 
12
12
  # Sufia::Download is sent to Sufia::Analytics.profile as #sufia__download
@@ -0,0 +1,8 @@
1
+ module Sufia
2
+ class OrcidValidator < ActiveModel::Validator
3
+ def validate(record)
4
+ return if record.orcid.blank?
5
+ record.errors.add(:orcid, 'must be a string of 19 characters, e.g., "0000-0000-0000-0000"') unless /\d{4}-\d{4}-\d{4}-\d{4}/.match(record.orcid)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,2 @@
1
+ class UserStat < ActiveRecord::Base
2
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'rails/generators'
3
+ require 'rails/generators/migration'
4
+
5
+ class Sufia::Models::AbstractMigrationGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ # Implement the required interface for Rails::Generators::Migration.
9
+ # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
10
+ def self.next_migration_number(path)
11
+ if @prev_migration_nr
12
+ @prev_migration_nr += 1
13
+ else
14
+ if last_migration = Dir[File.join(path, '*.rb')].sort.last
15
+ @prev_migration_nr = last_migration.sub(File.join(path, '/'), '').to_i + 1
16
+ else
17
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
18
+ end
19
+ end
20
+ @prev_migration_nr.to_s
21
+ end
22
+
23
+ protected
24
+
25
+ def better_migration_template(file)
26
+ migration_template "migrations/#{file}", "db/migrate/#{file}"
27
+ rescue Rails::Generators::Error => e
28
+ say_status("warning", e.message, :yellow)
29
+ end
30
+ end
@@ -1,30 +1,12 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'rails/generators'
3
- require 'rails/generators/migration'
4
-
5
- class Sufia::Models::CachedStatsGenerator < Rails::Generators::Base
6
- include Rails::Generators::Migration
1
+ require_relative 'abstract_migration_generator'
7
2
 
3
+ class Sufia::Models::CachedStatsGenerator < Sufia::Models::AbstractMigrationGenerator
8
4
  source_root File.expand_path('../templates', __FILE__)
9
5
 
10
6
  desc """
11
7
  This generator adds the ability to cache usage stats to your application:
12
8
  1. Creates several database migrations if they do not exist in /db/migrate
13
9
  """
14
- # Implement the required interface for Rails::Generators::Migration.
15
- # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
16
- def self.next_migration_number(path)
17
- if @prev_migration_nr
18
- @prev_migration_nr += 1
19
- else
20
- if last_migration = Dir[File.join(path, '*.rb')].sort.last
21
- @prev_migration_nr = last_migration.sub(File.join(path, '/'), '').to_i + 1
22
- else
23
- @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
24
- end
25
- end
26
- @prev_migration_nr.to_s
27
- end
28
10
 
29
11
  def banner
30
12
  say_status("warning", "ADDING STATS CACHING-RELATED SUFIA MODELS", :yellow)
@@ -32,7 +14,6 @@ This generator adds the ability to cache usage stats to your application:
32
14
 
33
15
  # Setup the database migrations
34
16
  def copy_migrations
35
- # Can't get this any more DRY, because we need this order.
36
17
  [
37
18
  'create_file_view_stats.rb',
38
19
  'create_file_download_stats.rb'
@@ -40,14 +21,4 @@ This generator adds the ability to cache usage stats to your application:
40
21
  better_migration_template file
41
22
  end
42
23
  end
43
-
44
- private
45
-
46
- def better_migration_template(file)
47
- begin
48
- migration_template "migrations/#{file}", "db/migrate/#{file}"
49
- rescue Rails::Generators::Error => e
50
- say_status("warning", e.message, :yellow)
51
- end
52
- end
53
24
  end