friendly_id 3.0.0.beta1 → 3.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,7 @@
1
1
  class FriendlyIdGenerator < Rails::Generator::Base
2
2
 
3
+ RAKE_TASKS = File.join(File.dirname(__FILE__), "..", "..", "lib", "tasks", "friendly_id.rake")
4
+
3
5
  def manifest
4
6
  record do |m|
5
7
  unless options[:skip_migration]
@@ -7,7 +9,7 @@ class FriendlyIdGenerator < Rails::Generator::Base
7
9
  end
8
10
  unless options[:skip_tasks]
9
11
  m.directory "lib/tasks"
10
- m.file "/../../../lib/friendly_id/acktive_record/tasks/friendly_id.rake", "lib/tasks/friendly_id.rake"
12
+ m.file RAKE_TASKS, "lib/tasks/friendly_id.rake"
11
13
  end
12
14
  end
13
15
  end
@@ -25,4 +27,4 @@ class FriendlyIdGenerator < Rails::Generator::Base
25
27
  end
26
28
  end
27
29
 
28
- end
30
+ end
@@ -1,12 +1,11 @@
1
1
  require "active_support/core_ext/class/attribute_accessors"
2
+
2
3
  require File.join(File.dirname(__FILE__), "friendly_id", "slug_string")
3
4
  require File.join(File.dirname(__FILE__), "friendly_id", "configuration")
4
5
  require File.join(File.dirname(__FILE__), "friendly_id", "status")
5
6
  require File.join(File.dirname(__FILE__), "friendly_id", "finders")
6
7
  require File.join(File.dirname(__FILE__), "friendly_id", "slugged")
7
8
 
8
-
9
-
10
9
  # FriendlyId is a comprehensive Ruby library for slugging and permalinks with
11
10
  # ActiveRecord.
12
11
  # @author Norman Clarke
@@ -63,3 +62,5 @@ class String
63
62
  return name, sequence ||= "1"
64
63
  end
65
64
  end
65
+
66
+ require File.join(File.dirname(__FILE__), "friendly_id", "railtie") if defined?(Rails) && Rails.version >= "3"
@@ -0,0 +1,23 @@
1
+ module FriendlyId
2
+ class Railtie < Rails::Railtie
3
+
4
+ initializer "friendly_id.configure_rails_initialization" do |app|
5
+ # Experimental Sequel support. See: http://github.com/norman/friendly_id_sequel
6
+ if app.config.generators.rails[:orm] == :sequel
7
+ begin
8
+ require "friendly_id/sequel"
9
+ rescue LoadError
10
+ raise "To use FriendlyId's Sequel adapter, please 'gem install friendly_id_sequel'"
11
+ end
12
+ else
13
+ # Only Sequel and ActiveRecord are currently supported; AR is the default.
14
+ # Want Datamapper support? http://github.com/norman/friendly_id/issues#issue/24
15
+ require "friendly_id/active_record"
16
+ end
17
+ end
18
+
19
+ rake_tasks do
20
+ load "tasks/friendly_id.rake"
21
+ end
22
+ end
23
+ end
@@ -3,7 +3,7 @@ module FriendlyId
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 0
6
- BUILD = "beta1"
6
+ BUILD = "beta2"
7
7
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
8
8
  end
9
9
  end
@@ -5,19 +5,12 @@ class FriendlyIdGenerator < Rails::Generators::Base
5
5
 
6
6
  include Rails::Generators::Migration
7
7
 
8
- RAKE_FILE = File.join(File.dirname(__FILE__), "..", "friendly_id", "acktive_record", "tasks", "friendly_id.rake")
9
8
  MIGRATIONS_FILE = File.join(File.dirname(__FILE__), "..", "..", "generators", "friendly_id", "templates", "create_slugs.rb")
10
9
 
11
10
  class_option :"skip-migration", :type => :boolean, :desc => "Don't generate a migration for the slugs table"
12
- class_option :"skip-tasks", :type => :boolean, :desc => "Don't add friendly_id Rake tasks to lib/tasks"
13
- class_option :"skip-initializer", :type => :boolean, :desc => "Don't add friendly_id initializer to config/initializers"
14
11
 
15
12
  def copy_files(*args)
16
13
  migration_template MIGRATIONS_FILE, "db/migrate/create_slugs.rb" unless options["skip-migration"]
17
- rakefile "friendly_id.rake", File.read(RAKE_FILE) unless options["skip-tasks"]
18
- initializer "friendly_id.rb" do
19
- 'require "friendly_id/active_record"'
20
- end unless options["skip-initializer"]
21
14
  end
22
15
 
23
16
  # Taken from ActiveRecord's migration generator
@@ -12,7 +12,7 @@ namespace :friendly_id do
12
12
  Rake::Task["friendly_id:make_slugs"].invoke
13
13
  end
14
14
 
15
- desc "Kill obsolete slugs older than DAYS=45 days."
15
+ desc "Destroy obsolete slugs older than DAYS=45 days."
16
16
  task :remove_old_slugs => :environment do
17
17
  FriendlyId::TaskRunner.new.delete_old_slugs
18
18
  end
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 3
7
7
  - 0
8
8
  - 0
9
- - beta1
10
- version: 3.0.0.beta1
9
+ - beta2
10
+ version: 3.0.0.beta2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Norman Clarke
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-03-26 00:00:00 -03:00
20
+ date: 2010-03-29 00:00:00 -03:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,7 @@ files:
67
67
  - lib/friendly_id/active_record.rb
68
68
  - lib/friendly_id/configuration.rb
69
69
  - lib/friendly_id/finders.rb
70
+ - lib/friendly_id/railtie.rb
70
71
  - lib/friendly_id/slug_string.rb
71
72
  - lib/friendly_id/slugged.rb
72
73
  - lib/friendly_id/status.rb
@@ -74,7 +75,7 @@ files:
74
75
  - lib/friendly_id/version.rb
75
76
  - lib/friendly_id.rb
76
77
  - lib/generators/friendly_id_generator.rb
77
- - lib/friendly_id/acktive_record/tasks/friendly_id.rake
78
+ - lib/tasks/friendly_id.rake
78
79
  - Changelog.md
79
80
  - Contributors.md
80
81
  - Guide.md
@@ -115,19 +116,7 @@ has_rdoc: true
115
116
  homepage: http://norman.github.com/friendly_id
116
117
  licenses: []
117
118
 
118
- post_install_message: |+
119
-
120
- ***********************************************************
121
-
122
- If you are upgrading friendly_id, please run
123
-
124
- ./script/generate friendly_id --skip-migration
125
-
126
- in your Rails application to ensure that you have the
127
- latest friendly_id Rake tasks.
128
-
129
- ***********************************************************
130
-
119
+ post_install_message:
131
120
  rdoc_options: []
132
121
 
133
122
  require_paths: