populator 0.2.5 → 1.0.0

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.
@@ -1,8 +1,9 @@
1
1
  require 'rubygems'
2
- require 'spec'
3
- require 'active_support'
4
- require 'active_record'
5
- require File.dirname(__FILE__) + '/../lib/populator.rb'
2
+ require 'bundler/setup'
3
+
4
+ Bundler.require(:default)
5
+
6
+ require 'active_support/all'
6
7
 
7
8
  adapter = ENV['POPULATOR_ADAPTER'] || 'sqlite3'
8
9
  puts "Running on #{adapter}"
@@ -16,18 +17,18 @@ ActiveRecord::Base.establish_connection(
16
17
  unless ActiveRecord::Base.connection.respond_to? :record_query
17
18
  ActiveRecord::Base.connection.class.class_eval do
18
19
  IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^begin /i, /^commit /i]
19
-
20
+
20
21
  def record_query(sql)
21
22
  $queries_executed ||= []
22
23
  $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
23
24
  end
24
-
25
+
25
26
  def execute_with_query_record(*args, &block)
26
27
  record_query(args.first)
27
28
  execute_without_query_record(*args, &block)
28
29
  end
29
30
  alias_method_chain :execute, :query_record
30
-
31
+
31
32
  def execute_batch_with_query_record(*args, &block)
32
33
  record_query(args.first)
33
34
  execute_batch_without_query_record(*args, &block)
@@ -43,6 +44,6 @@ require File.dirname(__FILE__) + '/models/product.rb'
43
44
  CreateCategories.migrate(:up) unless Category.table_exists?
44
45
  CreateProducts.migrate(:up) unless Product.table_exists?
45
46
 
46
- Spec::Runner.configure do |config|
47
+ RSpec.configure do |config|
47
48
  config.mock_with :mocha
48
49
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: populator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Ryan Bates
@@ -9,43 +14,72 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2008-10-01 00:00:00 -07:00
17
+ date: 2011-01-25 00:00:00 -08:00
13
18
  default_executable:
14
- dependencies: []
15
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 1
31
+ - 0
32
+ version: 2.1.0
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rails
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 3
45
+ - 0
46
+ - 3
47
+ version: 3.0.3
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: mocha
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
60
+ - 9
61
+ - 10
62
+ version: 0.9.10
63
+ type: :development
64
+ version_requirements: *id003
16
65
  description: Mass populate an Active Record database.
17
- email: ryan (at) railscasts (dot) com
66
+ email: ryan@railscasts.com
18
67
  executables: []
19
68
 
20
69
  extensions: []
21
70
 
22
- extra_rdoc_files:
23
- - CHANGELOG
24
- - lib/populator/adapters/abstract.rb
25
- - lib/populator/adapters/sqlite.rb
26
- - lib/populator/factory.rb
27
- - lib/populator/model_additions.rb
28
- - lib/populator/random.rb
29
- - lib/populator/record.rb
30
- - lib/populator.rb
31
- - LICENSE
32
- - README
33
- - tasks/deployment.rake
34
- - tasks/spec.rake
35
- - TODO
71
+ extra_rdoc_files: []
72
+
36
73
  files:
37
- - CHANGELOG
38
74
  - lib/populator/adapters/abstract.rb
75
+ - lib/populator/adapters/oracle.rb
76
+ - lib/populator/adapters/postgresql.rb
39
77
  - lib/populator/adapters/sqlite.rb
40
78
  - lib/populator/factory.rb
41
79
  - lib/populator/model_additions.rb
42
80
  - lib/populator/random.rb
43
81
  - lib/populator/record.rb
44
82
  - lib/populator.rb
45
- - LICENSE
46
- - Manifest
47
- - Rakefile
48
- - README
49
83
  - spec/database.yml
50
84
  - spec/example_database.yml
51
85
  - spec/models/category.rb
@@ -54,43 +88,47 @@ files:
54
88
  - spec/populator/model_additions_spec.rb
55
89
  - spec/populator/random_spec.rb
56
90
  - spec/populator/record_spec.rb
57
- - spec/README
58
- - spec/spec.opts
91
+ - spec/README.rdoc
59
92
  - spec/spec_helper.rb
60
- - tasks/deployment.rake
61
- - tasks/spec.rake
62
- - TODO
63
- - populator.gemspec
93
+ - CHANGELOG.rdoc
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - LICENSE
97
+ - Rakefile
98
+ - README.rdoc
64
99
  has_rdoc: true
65
100
  homepage: http://github.com/ryanb/populator
101
+ licenses: []
102
+
66
103
  post_install_message:
67
- rdoc_options:
68
- - --line-numbers
69
- - --inline-source
70
- - --title
71
- - Populator
72
- - --main
73
- - README
104
+ rdoc_options: []
105
+
74
106
  require_paths:
75
107
  - lib
76
108
  required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
77
110
  requirements:
78
111
  - - ">="
79
112
  - !ruby/object:Gem::Version
113
+ segments:
114
+ - 0
80
115
  version: "0"
81
- version:
82
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
83
118
  requirements:
84
119
  - - ">="
85
120
  - !ruby/object:Gem::Version
86
- version: "1.2"
87
- version:
121
+ segments:
122
+ - 1
123
+ - 3
124
+ - 4
125
+ version: 1.3.4
88
126
  requirements: []
89
127
 
90
128
  rubyforge_project: populator
91
- rubygems_version: 1.2.0
129
+ rubygems_version: 1.3.7
92
130
  signing_key:
93
- specification_version: 2
131
+ specification_version: 3
94
132
  summary: Mass populate an Active Record database.
95
133
  test_files: []
96
134
 
data/Manifest DELETED
@@ -1,26 +0,0 @@
1
- CHANGELOG
2
- lib/populator/adapters/abstract.rb
3
- lib/populator/adapters/sqlite.rb
4
- lib/populator/factory.rb
5
- lib/populator/model_additions.rb
6
- lib/populator/random.rb
7
- lib/populator/record.rb
8
- lib/populator.rb
9
- LICENSE
10
- Manifest
11
- Rakefile
12
- README
13
- spec/database.yml
14
- spec/example_database.yml
15
- spec/models/category.rb
16
- spec/models/product.rb
17
- spec/populator/factory_spec.rb
18
- spec/populator/model_additions_spec.rb
19
- spec/populator/random_spec.rb
20
- spec/populator/record_spec.rb
21
- spec/README
22
- spec/spec.opts
23
- spec/spec_helper.rb
24
- tasks/deployment.rake
25
- tasks/spec.rake
26
- TODO
data/TODO DELETED
@@ -1,11 +0,0 @@
1
- Possible
2
- - randomly fill every column if no block is passed to populate
3
- - add random_foo method to record for randomly generating content
4
-
5
- Support Environments
6
- - sqlite 2
7
- - old rails
8
- - edge rails
9
-
10
- Tests
11
- - add db:reset, db:drop and db:create rake tasks
@@ -1,97 +0,0 @@
1
-
2
- # Gem::Specification for Populator-0.2.5
3
- # Originally generated by Echoe
4
-
5
- --- !ruby/object:Gem::Specification
6
- name: populator
7
- version: !ruby/object:Gem::Version
8
- version: 0.2.5
9
- platform: ruby
10
- authors:
11
- - Ryan Bates
12
- autorequire:
13
- bindir: bin
14
-
15
- date: 2008-10-01 00:00:00 -07:00
16
- default_executable:
17
- dependencies: []
18
-
19
- description: Mass populate an Active Record database.
20
- email: ryan (at) railscasts (dot) com
21
- executables: []
22
-
23
- extensions: []
24
-
25
- extra_rdoc_files:
26
- - CHANGELOG
27
- - lib/populator/adapters/abstract.rb
28
- - lib/populator/adapters/sqlite.rb
29
- - lib/populator/factory.rb
30
- - lib/populator/model_additions.rb
31
- - lib/populator/random.rb
32
- - lib/populator/record.rb
33
- - lib/populator.rb
34
- - LICENSE
35
- - README
36
- - tasks/deployment.rake
37
- - tasks/spec.rake
38
- - TODO
39
- files:
40
- - CHANGELOG
41
- - lib/populator/adapters/abstract.rb
42
- - lib/populator/adapters/sqlite.rb
43
- - lib/populator/factory.rb
44
- - lib/populator/model_additions.rb
45
- - lib/populator/random.rb
46
- - lib/populator/record.rb
47
- - lib/populator.rb
48
- - LICENSE
49
- - Manifest
50
- - Rakefile
51
- - README
52
- - spec/database.yml
53
- - spec/example_database.yml
54
- - spec/models/category.rb
55
- - spec/models/product.rb
56
- - spec/populator/factory_spec.rb
57
- - spec/populator/model_additions_spec.rb
58
- - spec/populator/random_spec.rb
59
- - spec/populator/record_spec.rb
60
- - spec/README
61
- - spec/spec.opts
62
- - spec/spec_helper.rb
63
- - tasks/deployment.rake
64
- - tasks/spec.rake
65
- - TODO
66
- - populator.gemspec
67
- has_rdoc: true
68
- homepage: http://github.com/ryanb/populator
69
- post_install_message:
70
- rdoc_options:
71
- - --line-numbers
72
- - --inline-source
73
- - --title
74
- - Populator
75
- - --main
76
- - README
77
- require_paths:
78
- - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
84
- version:
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: "1.2"
90
- version:
91
- requirements: []
92
-
93
- rubyforge_project: populator
94
- rubygems_version: 1.2.0
95
- specification_version: 2
96
- summary: Mass populate an Active Record database.
97
- test_files: []
@@ -1 +0,0 @@
1
- --color
@@ -1,2 +0,0 @@
1
- desc "Build the manifest and gemspec files."
2
- task :build => [:build_manifest, :build_gemspec]
@@ -1,22 +0,0 @@
1
- require 'spec/rake/spectask'
2
-
3
- ADAPTERS = YAML.load(File.read(File.dirname(__FILE__) + "/../spec/database.yml")).keys
4
-
5
- desc "Run specs under all supported databases"
6
- task :spec => ADAPTERS.map { |a| "spec:#{a}" }
7
-
8
- namespace :spec do
9
- ADAPTERS.each do |adapter|
10
- namespace :prepare do
11
- task adapter do
12
- ENV["POPULATOR_ADAPTER"] = adapter
13
- end
14
- end
15
-
16
- desc "Run specs under #{adapter}"
17
- Spec::Rake::SpecTask.new(adapter => "spec:prepare:#{adapter}") do |t|
18
- t.spec_files = Rake::FileList["spec/**/*_spec.rb"]
19
- t.spec_opts = ["-c"]
20
- end
21
- end
22
- end