application_seeds 0.6.0 → 0.7.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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ v0.7.0, 2014-05-02
2
+ ------------------
3
+
4
+ * Stop storing the dataset in the database. Removed the
5
+ `ApplicationSeeds.dataset` method.
6
+
7
+
1
8
  v0.6.0, 2014-03-06
2
9
  ------------------
3
10
 
data/README.md CHANGED
@@ -443,16 +443,6 @@ Specify the name of the dataset to use. An exception will be raised if
443
443
  the dataset could not be found.
444
444
 
445
445
 
446
- ### Determining the dataset that has been loaded
447
-
448
- ```ruby
449
- ApplicationSeeds.dataset
450
- ```
451
-
452
- Returns the name of the dataset that has been loaded, or nil if not
453
- running an application_seeds dataset.
454
-
455
-
456
446
  ### Checking if a seed file exists in the dataset
457
447
 
458
448
  ```ruby
@@ -17,11 +17,6 @@ module ApplicationSeeds
17
17
  @connection = PG.connect(pg_config)
18
18
  end
19
19
 
20
- def create_metadata_table
21
- connection.exec('DROP TABLE IF EXISTS application_seeds;')
22
- connection.exec('CREATE TABLE application_seeds (dataset varchar(255));')
23
- end
24
-
25
20
  def without_foreign_keys
26
21
  drop_foreign_keys_sql = generate_drop_foreign_keys_sql
27
22
  create_foreign_keys_sql = generate_create_foreign_keys_sql
@@ -60,7 +55,3 @@ module ApplicationSeeds
60
55
  end
61
56
  end
62
57
  end
63
-
64
- if defined?(ActiveRecord)
65
- ActiveRecord::SchemaDumper.ignore_tables = ["application_seeds"]
66
- end
@@ -1,3 +1,3 @@
1
1
  module ApplicationSeeds
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -95,19 +95,6 @@ module ApplicationSeeds
95
95
  error_message << "Available datasets: #{datasets}\n\n"
96
96
  raise error_message
97
97
  end
98
-
99
- store_dataset
100
- end
101
-
102
- #
103
- # Returns the name of the dataset that has been loaded, or nil if not
104
- # running an application_seeds dataset.
105
- #
106
- def dataset
107
- res = Database.connection.exec("SELECT dataset from application_seeds LIMIT 1;")
108
- res.getvalue(0, 0)
109
- rescue PG::Error => e
110
- e.message =~ /relation "application_seeds" does not exist/ ? nil : raise
111
98
  end
112
99
 
113
100
  #
@@ -173,11 +160,6 @@ module ApplicationSeeds
173
160
  Dir[File.join(seed_data_path, "**", "*")].select { |x| File.directory?(x) && File.basename(x) == dataset }.first
174
161
  end
175
162
 
176
- def store_dataset
177
- Database.create_metadata_table
178
- Database.connection.exec("INSERT INTO application_seeds (dataset) VALUES ('#{@dataset}');")
179
- end
180
-
181
163
  def seed_data_path
182
164
  return @seed_data_path unless @seed_data_path.nil?
183
165
 
@@ -74,10 +74,6 @@ describe "ApplicationSeeds" do
74
74
 
75
75
  context "when a valid dataset is specified" do
76
76
  before do
77
- connection_dummy = double
78
- connection_dummy.should_receive(:exec).with("INSERT INTO application_seeds (dataset) VALUES ('test_data_set');")
79
- ApplicationSeeds::Database.should_receive(:create_metadata_table)
80
- ApplicationSeeds::Database.should_receive(:connection) { connection_dummy }
81
77
  ApplicationSeeds.dataset = "test_data_set"
82
78
  end
83
79
  it "sets the dataset" do
@@ -86,18 +82,6 @@ describe "ApplicationSeeds" do
86
82
  end
87
83
  end
88
84
 
89
- describe "#dataset" do
90
- before do
91
- connection_dummy = double
92
- response_dummy = double(:getvalue => "test_data_set")
93
- connection_dummy.should_receive(:exec).with("SELECT dataset from application_seeds LIMIT 1;") { response_dummy }
94
- ApplicationSeeds::Database.should_receive(:connection) { connection_dummy }
95
- end
96
- it "fetches the dataset name from the database" do
97
- expect(ApplicationSeeds.dataset).to eql("test_data_set")
98
- end
99
- end
100
-
101
85
  context "with a valid dataset" do
102
86
  before do
103
87
  ApplicationSeeds.stub(:store_dataset)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: application_seeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-06 00:00:00.000000000 Z
12
+ date: 2014-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: -1007490013987030043
126
+ hash: 5363964372824936
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  segments:
134
134
  - 0
135
- hash: -1007490013987030043
135
+ hash: 5363964372824936
136
136
  requirements: []
137
137
  rubyforge_project:
138
138
  rubygems_version: 1.8.23