timecapsule 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/lib/timecapsule.rb +1 -21
- data/lib/timecapsule/railtie.rb +26 -0
- data/test/helper.rb +4 -2
- data/timecapsule.gemspec +4 -3
- metadata +6 -5
data/.travis.yml
CHANGED
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/timecapsule.rb
CHANGED
@@ -1,26 +1,6 @@
|
|
1
|
+
require 'timecapsule/railtie' if defined?(Rails)
|
1
2
|
class Timecapsule
|
2
3
|
|
3
|
-
def self.check_for_and_make_directory(path)
|
4
|
-
return true if File.exists?(path)
|
5
|
-
path = Pathname.new(path)
|
6
|
-
parent = path.parent
|
7
|
-
Timecapsule.check_for_and_make_directory(parent) unless path.parent.parent.root?
|
8
|
-
Dir.mkdir(path) unless File.exists?(path)
|
9
|
-
end
|
10
|
-
|
11
|
-
default_config = {:import_directory => Rails.root.join('db/seed_data/').to_s , :export_directory => Rails.root.join('db/seed_data/').to_s}
|
12
|
-
config_pathname = Rails.root.join("config/timecapsule.yml")
|
13
|
-
config_dir_pathname = Rails.root.join("config")
|
14
|
-
unless File.exists?(config_pathname)
|
15
|
-
Timecapsule.check_for_and_make_directory(config_dir_pathname)
|
16
|
-
config_file = File.open(config_pathname, 'w')
|
17
|
-
config_file.puts default_config.to_yaml
|
18
|
-
config_file.close
|
19
|
-
end
|
20
|
-
config = YAML.load_file(config_pathname)
|
21
|
-
IMPORT_DIR = config[:import_directory]
|
22
|
-
EXPORT_DIR = config[:export_directory]
|
23
|
-
|
24
4
|
require 'csv'
|
25
5
|
|
26
6
|
def self.import_model(model_import, file_name=nil)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Timecapsule
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
config.before_configuration do
|
4
|
+
def Timecapsule.check_for_and_make_directory(path)
|
5
|
+
return true if File.exists?(path)
|
6
|
+
path = Pathname.new(path)
|
7
|
+
parent = path.parent
|
8
|
+
Timecapsule.check_for_and_make_directory(parent) unless path.parent.parent.root?
|
9
|
+
Dir.mkdir(path) unless File.exists?(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
default_config = {:import_directory => Rails.root.join('db/seed_data/').to_s , :export_directory => Rails.root.join('db/seed_data/').to_s}
|
13
|
+
config_pathname = Rails.root.join("config/timecapsule.yml")
|
14
|
+
config_dir_pathname = Rails.root.join("config")
|
15
|
+
unless File.exists?(config_pathname)
|
16
|
+
Timecapsule.check_for_and_make_directory(config_dir_pathname)
|
17
|
+
config_file = File.open(config_pathname, 'w')
|
18
|
+
config_file.puts default_config.to_yaml
|
19
|
+
config_file.close
|
20
|
+
end
|
21
|
+
config = YAML.load_file(config_pathname)
|
22
|
+
Timecapsule::IMPORT_DIR = config[:import_directory]
|
23
|
+
Timecapsule::EXPORT_DIR = config[:export_directory]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
2
|
+
require 'thread'
|
3
3
|
require 'active_record'
|
4
|
-
gem 'activesupport', '>= 2.3.5'
|
5
4
|
require 'active_support'
|
5
|
+
require 'rails'
|
6
6
|
|
7
7
|
require 'bundler'
|
8
8
|
begin
|
@@ -24,6 +24,8 @@ module Rails
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
#ActiveRecord::Base.logger = ::Logger.new(StringIO.new)
|
28
|
+
|
27
29
|
ENV["RAILS_ENV"] = "test"
|
28
30
|
ENV["RAILS_ROOT"] = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
29
31
|
|
data/timecapsule.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "timecapsule"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ren\303\251e De Voursney"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-04-11"
|
13
13
|
s.description = "Great for creating seed data from data entered through your app's ui or the console"
|
14
14
|
s.email = "renee.devoursney@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"gemfiles/rails3.gemfile",
|
32
32
|
"gemfiles/rails3_1.gemfile",
|
33
33
|
"lib/timecapsule.rb",
|
34
|
+
"lib/timecapsule/railtie.rb",
|
34
35
|
"test/helper.rb",
|
35
36
|
"test/test_timecapsule.rb",
|
36
37
|
"timecapsule.gemspec"
|
@@ -38,7 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
s.homepage = "http://github.com/reneedv/timecapsule"
|
39
40
|
s.licenses = ["MIT"]
|
40
41
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = "1.8.
|
42
|
+
s.rubygems_version = "1.8.15"
|
42
43
|
s.summary = "gem for importing and exporting ActiveRecord data."
|
43
44
|
|
44
45
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecapsule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Ren\xC3\xA9e De Voursney"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-04-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- gemfiles/rails3.gemfile
|
178
178
|
- gemfiles/rails3_1.gemfile
|
179
179
|
- lib/timecapsule.rb
|
180
|
+
- lib/timecapsule/railtie.rb
|
180
181
|
- test/helper.rb
|
181
182
|
- test/test_timecapsule.rb
|
182
183
|
- timecapsule.gemspec
|
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
210
|
requirements: []
|
210
211
|
|
211
212
|
rubyforge_project:
|
212
|
-
rubygems_version: 1.8.
|
213
|
+
rubygems_version: 1.8.15
|
213
214
|
signing_key:
|
214
215
|
specification_version: 3
|
215
216
|
summary: gem for importing and exporting ActiveRecord data.
|