dnif 0.0.1.beta.5 → 0.0.1.beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -5,12 +5,10 @@ gem "activerecord", ">= 3.0.0", :require => "active_record"
5
5
  gem "activesupport", ">= 3.0.0", :require => "active_support"
6
6
  gem "riddle", ">= 1.1.0"
7
7
  gem "builder", ">= 2.1.2"
8
- gem "awesome_print", :require => "ap"
9
8
 
10
9
  group :development do
11
10
  gem "jeweler", ">= 1.5.0.pre2"
12
11
  gem "rspec", ">= 2.0.0.beta.20"
13
12
  gem "database_cleaner"
14
- gem "awesome_print", :require => "ap"
15
13
  gem "sqlite3-ruby", :require => "sqlite3"
16
14
  end
@@ -13,7 +13,6 @@ GEM
13
13
  activesupport (3.0.0)
14
14
  arel (1.0.1)
15
15
  activesupport (~> 3.0.0)
16
- awesome_print (0.2.1)
17
16
  builder (2.1.2)
18
17
  database_cleaner (0.5.2)
19
18
  diff-lcs (1.1.2)
@@ -42,7 +41,6 @@ PLATFORMS
42
41
  DEPENDENCIES
43
42
  activerecord (>= 3.0.0)
44
43
  activesupport (>= 3.0.0)
45
- awesome_print
46
44
  builder (>= 2.1.2)
47
45
  database_cleaner
48
46
  jeweler (>= 1.5.0.pre2)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dnif}
8
- s.version = "0.0.1.beta.5"
8
+ s.version = "0.0.1.beta.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rafael Souza"]
12
- s.date = %q{2010-09-07}
12
+ s.date = %q{2010-09-08}
13
13
  s.description = %q{dnif is a gem to index data using ActiveRecord finders, letting you index your custom methods and not only your table fields}
14
14
  s.email = %q{me@rafaelss.com}
15
15
  s.extra_rdoc_files = [
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "lib/dnif/index.rb",
30
30
  "lib/dnif/indexer.rb",
31
31
  "lib/dnif/multi_attribute.rb",
32
+ "lib/dnif/railtie.rb",
32
33
  "lib/dnif/schema.rb",
33
34
  "lib/dnif/search.rb",
34
35
  "lib/dnif/tasks.rb",
@@ -84,11 +85,9 @@ Gem::Specification.new do |s|
84
85
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
85
86
  s.add_runtime_dependency(%q<riddle>, [">= 1.1.0"])
86
87
  s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
87
- s.add_runtime_dependency(%q<awesome_print>, [">= 0"])
88
88
  s.add_development_dependency(%q<jeweler>, [">= 1.5.0.pre2"])
89
89
  s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.20"])
90
90
  s.add_development_dependency(%q<database_cleaner>, [">= 0"])
91
- s.add_development_dependency(%q<awesome_print>, [">= 0"])
92
91
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
93
92
  else
94
93
  s.add_dependency(%q<rake>, [">= 0"])
@@ -96,11 +95,9 @@ Gem::Specification.new do |s|
96
95
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
97
96
  s.add_dependency(%q<riddle>, [">= 1.1.0"])
98
97
  s.add_dependency(%q<builder>, [">= 2.1.2"])
99
- s.add_dependency(%q<awesome_print>, [">= 0"])
100
98
  s.add_dependency(%q<jeweler>, [">= 1.5.0.pre2"])
101
99
  s.add_dependency(%q<rspec>, [">= 2.0.0.beta.20"])
102
100
  s.add_dependency(%q<database_cleaner>, [">= 0"])
103
- s.add_dependency(%q<awesome_print>, [">= 0"])
104
101
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
105
102
  end
106
103
  else
@@ -109,11 +106,9 @@ Gem::Specification.new do |s|
109
106
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
110
107
  s.add_dependency(%q<riddle>, [">= 1.1.0"])
111
108
  s.add_dependency(%q<builder>, [">= 2.1.2"])
112
- s.add_dependency(%q<awesome_print>, [">= 0"])
113
109
  s.add_dependency(%q<jeweler>, [">= 1.5.0.pre2"])
114
110
  s.add_dependency(%q<rspec>, [">= 2.0.0.beta.20"])
115
111
  s.add_dependency(%q<database_cleaner>, [">= 0"])
116
- s.add_dependency(%q<awesome_print>, [">= 0"])
117
112
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
118
113
  end
119
114
  end
@@ -0,0 +1,17 @@
1
+ require "dnif"
2
+ require "rails"
3
+
4
+ module Dnif
5
+ class Railtie < Rails::Railtie
6
+
7
+ config.to_prepare do
8
+ Dnif.root_path = Rails.root
9
+ Dnif.environment = Rails.env
10
+ Dnif.models_path = File.join(Rails.root, "app", "models")
11
+ end
12
+
13
+ rake_tasks do
14
+ load "dnif/tasks.rb"
15
+ end
16
+ end
17
+ end
@@ -1,27 +1,30 @@
1
- require "riddle"
2
1
  require "fileutils"
3
2
 
4
- if defined?(Rails)
5
- Dnif.root_path = Rails.root
6
- Dnif.environment = Rails.env
7
- Dnif.models_path = File.join(Rails.root, "app", "models")
8
- end
9
-
10
3
  def controller
11
4
  require 'riddle'
12
5
 
13
- root_path = Dnif.root_path || "."
14
-
15
6
  configuration = Riddle::Configuration.new
16
- configuration.searchd.pid_file = "#{root_path}/log/searchd.#{Dnif.environment}.pid"
17
- configuration.searchd.log = "#{root_path}/log/searchd.log"
18
- configuration.searchd.query_log = "#{root_path}/log/searchd.query.log"
7
+ configuration.searchd.pid_file = "#{Dnif.root_path}/log/searchd.#{Dnif.environment}.pid"
8
+ configuration.searchd.log = "#{Dnif.root_path}/log/searchd.log"
9
+ configuration.searchd.query_log = "#{Dnif.root_path}/log/searchd.query.log"
19
10
 
20
- Riddle::Controller.new(configuration, "#{root_path}/config/sphinx/#{Dnif.environment}.conf")
11
+ Riddle::Controller.new(configuration, "#{Dnif.root_path}/config/sphinx/#{Dnif.environment}.conf")
21
12
  end
22
13
 
23
14
  namespace :dnif do
24
15
 
16
+ if !Rake::Task.task_defined?(:environment)
17
+ desc "Set default values for Dnif"
18
+ task :environment do
19
+ Dnif.root_path ||= Dir.pwd
20
+ Dnif.environment ||= "development"
21
+
22
+ if !Dnif.models_path.nil?
23
+ Dnif.load_models
24
+ end
25
+ end
26
+ end
27
+
25
28
  desc "Generates the configuration file needed for sphinx"
26
29
  task :configure => :environment do
27
30
  if Dnif.models_path.nil?
@@ -29,22 +32,19 @@ namespace :dnif do
29
32
  exit
30
33
  end
31
34
 
32
- Dnif.root_path ||= File.expand_path(File.dirname("."))
33
- Dnif.environment ||= "development"
34
-
35
35
  config_path = File.join(Dnif.root_path, "config/sphinx")
36
- if not File.exist?(config_path)
36
+ if !File.exist?(config_path)
37
37
  FileUtils.mkdir_p(config_path)
38
38
  end
39
39
 
40
40
  base_path = File.join(config_path, Dnif.environment + ".erb")
41
- if not File.exist?(base_path)
41
+ if !File.exist?(base_path)
42
42
  FileUtils.cp(File.dirname(__FILE__) + "/../../templates/config.erb", base_path) # TODO change this path. find out how this kind of stuff is handle in others gems
43
43
  end
44
44
 
45
45
  Dnif.load_models
46
46
  path = Dnif::Configuration.generate(base_path)
47
- ap "\n> config generated: #{path}"
47
+ puts "\n>> config generated: #{path}"
48
48
  end
49
49
 
50
50
  desc "Generates the XML used by sphinx to create indexes"
@@ -59,21 +59,24 @@ namespace :dnif do
59
59
  desc "Index data for sphinx"
60
60
  task :index => :environment do
61
61
  controller.index(:verbose => true)
62
- ap "\n> data indexed"
62
+ puts "\n>> data indexed" # TODO show this only whether daemon is really indexed
63
63
  end
64
64
 
65
65
  desc "Stop sphinx daemon"
66
66
  task :stop => :environment do
67
67
  controller.stop
68
- ap "\n> daemon stopped"
68
+ puts "\n>> daemon stopped" # TODO show this only whether daemon is really stopped
69
69
  end
70
70
 
71
71
  desc "Start sphinx daemon"
72
72
  task :start => :environment do
73
73
  controller.start
74
- ap "\n> daemon started"
74
+ puts "\n>> daemon started" # TODO show this only whether daemon is really started
75
75
  end
76
76
 
77
+ desc "Restart sphinx daemon"
78
+ task :restart => [ :stop, :start ]
79
+
77
80
  desc "Rebuild sphinx index"
78
- task :rebuild => [:index, :stop, :start]
81
+ task :rebuild => [ :index, :restart ]
79
82
  end
@@ -3,7 +3,7 @@ module Dnif
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
5
  PATCH = 1
6
- BUILD = "beta.5"
6
+ BUILD = "beta.6"
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
9
  end
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 1
9
9
  - beta
10
- - 5
11
- version: 0.0.1.beta.5
10
+ - 6
11
+ version: 0.0.1.beta.6
12
12
  platform: ruby
13
13
  authors:
14
14
  - Rafael Souza
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-07 00:00:00 -03:00
19
+ date: 2010-09-08 00:00:00 -03:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -92,22 +92,9 @@ dependencies:
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: awesome_print
97
- requirement: &id006 !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- segments:
103
- - 0
104
- version: "0"
105
- type: :runtime
106
- prerelease: false
107
- version_requirements: *id006
108
95
  - !ruby/object:Gem::Dependency
109
96
  name: jeweler
110
- requirement: &id007 !ruby/object:Gem::Requirement
97
+ requirement: &id006 !ruby/object:Gem::Requirement
111
98
  none: false
112
99
  requirements:
113
100
  - - ">="
@@ -120,10 +107,10 @@ dependencies:
120
107
  version: 1.5.0.pre2
121
108
  type: :development
122
109
  prerelease: false
123
- version_requirements: *id007
110
+ version_requirements: *id006
124
111
  - !ruby/object:Gem::Dependency
125
112
  name: rspec
126
- requirement: &id008 !ruby/object:Gem::Requirement
113
+ requirement: &id007 !ruby/object:Gem::Requirement
127
114
  none: false
128
115
  requirements:
129
116
  - - ">="
@@ -137,23 +124,10 @@ dependencies:
137
124
  version: 2.0.0.beta.20
138
125
  type: :development
139
126
  prerelease: false
140
- version_requirements: *id008
127
+ version_requirements: *id007
141
128
  - !ruby/object:Gem::Dependency
142
129
  name: database_cleaner
143
- requirement: &id009 !ruby/object:Gem::Requirement
144
- none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- segments:
149
- - 0
150
- version: "0"
151
- type: :development
152
- prerelease: false
153
- version_requirements: *id009
154
- - !ruby/object:Gem::Dependency
155
- name: awesome_print
156
- requirement: &id010 !ruby/object:Gem::Requirement
130
+ requirement: &id008 !ruby/object:Gem::Requirement
157
131
  none: false
158
132
  requirements:
159
133
  - - ">="
@@ -163,10 +137,10 @@ dependencies:
163
137
  version: "0"
164
138
  type: :development
165
139
  prerelease: false
166
- version_requirements: *id010
140
+ version_requirements: *id008
167
141
  - !ruby/object:Gem::Dependency
168
142
  name: sqlite3-ruby
169
- requirement: &id011 !ruby/object:Gem::Requirement
143
+ requirement: &id009 !ruby/object:Gem::Requirement
170
144
  none: false
171
145
  requirements:
172
146
  - - ">="
@@ -176,7 +150,7 @@ dependencies:
176
150
  version: "0"
177
151
  type: :development
178
152
  prerelease: false
179
- version_requirements: *id011
153
+ version_requirements: *id009
180
154
  description: dnif is a gem to index data using ActiveRecord finders, letting you index your custom methods and not only your table fields
181
155
  email: me@rafaelss.com
182
156
  executables: []
@@ -199,6 +173,7 @@ files:
199
173
  - lib/dnif/index.rb
200
174
  - lib/dnif/indexer.rb
201
175
  - lib/dnif/multi_attribute.rb
176
+ - lib/dnif/railtie.rb
202
177
  - lib/dnif/schema.rb
203
178
  - lib/dnif/search.rb
204
179
  - lib/dnif/tasks.rb
@@ -237,7 +212,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
212
  requirements:
238
213
  - - ">="
239
214
  - !ruby/object:Gem::Version
240
- hash: 3469001460397063451
215
+ hash: -3817415889434215376
241
216
  segments:
242
217
  - 0
243
218
  version: "0"