timecapsule 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 345ad8b9a6119fd033e4b5f7f83a1d2d9f2f6a05
4
- data.tar.gz: bc6aa35180b70a3d9e1cef4e12ac0d294e922cc1
3
+ metadata.gz: a422a4dafbf54588636959537c6e9d4f21593625
4
+ data.tar.gz: 1663ba031f76d3266b5873651ee8f412f02f4d90
5
5
  SHA512:
6
- metadata.gz: 1f256d69f27ea8ab12ee0631eea04aba07267adf0e6f34eeea5ec35ffac60fba03d31d71a7ddd7c2e96b4982afa771edb3e1eb9bd1f28329607bd8ac25d37c1d
7
- data.tar.gz: b295fef51624d2843756e0580c98865f00159175068bc458d90e7badf3e567b4e435ebeb7f3c68ed75826f153a3205a6e20c759b58855b282843fe08ff350f76
6
+ metadata.gz: 03f83158cae7928bc6c489aef238b971becc3c189c9dfc0f8ab7cbf45463a405d605ab2aed904c8dd144a8482173db94ada93fc04053a9d5536c6a0b6df7c83f
7
+ data.tar.gz: c34df4ba2a2f8f1e90143173ee9564e9017d7351ab6a1824ccf3e6845ba4d214cb563ce9dd5b800cd4c11bd554c750fd432500eac044b40bd9fb8fd98dc300fa
data/Rakefile CHANGED
@@ -1,52 +1,32 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require 'bundler'
4
+ require 'rake'
5
+ require 'rake/testtask'
6
+ require 'rdoc/task'
3
7
  require 'rubygems'
4
8
  require 'thread'
5
9
 
6
- require 'bundler'
7
10
  begin
8
11
  Bundler.setup(:default, :development)
9
12
  rescue Bundler::BundlerError => e
10
13
  $stderr.puts e.message
11
- $stderr.puts "Run `bundle install` to install missing gems"
14
+ $stderr.puts 'Run `bundle install` to install missing gems'
12
15
  exit e.status_code
13
16
  end
14
- require 'rake'
15
17
 
16
- require 'jeweler'
17
- Jeweler::Tasks.new do |gem|
18
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
19
- gem.name = "timecapsule"
20
- gem.homepage = "http://github.com/reneedv/timecapsule"
21
- gem.license = "MIT"
22
- gem.summary = "gem for importing and exporting ActiveRecord data."
23
- gem.description = "Great for creating seed data from data entered through your app's ui or the console"
24
- gem.email = "renee.devoursney@gmail.com"
25
- gem.authors = ["Renée De Voursney"]
26
- # dependencies defined in Gemfile
27
- end
28
- Jeweler::RubygemsDotOrgTasks.new
18
+ task default: :test
19
+
20
+ Bundler::GemHelper.install_tasks
29
21
 
30
- require 'rake/testtask'
31
22
  Rake::TestTask.new(:test) do |test|
32
23
  test.libs << 'lib' << 'test'
33
24
  test.pattern = 'test/**/test_*.rb'
34
25
  test.verbose = true
35
26
  end
36
27
 
37
- # require 'rcov/rcovtask'
38
- # Rcov::RcovTask.new do |test|
39
- # test.libs << 'test'
40
- # test.pattern = 'test/**/test_*.rb'
41
- # test.verbose = true
42
- # test.rcov_opts << '--exclude "gems/*"'
43
- # end
44
-
45
- task :default => :test
46
-
47
- require 'rdoc/task'
48
28
  Rake::RDocTask.new do |rdoc|
49
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
29
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
50
30
 
51
31
  rdoc.rdoc_dir = 'rdoc'
52
32
  rdoc.title = "timecapsule #{version}"
data/lib/timecapsule.rb CHANGED
@@ -1,67 +1,88 @@
1
1
  require 'timecapsule/railtie' if defined?(Rails)
2
2
  class Timecapsule
3
-
4
3
  require 'csv'
5
-
6
- def self.import_model(model_import, file_name=nil)
7
- file_name ||= Rails.root.join("#{IMPORT_DIR}$#{model_import.to_s.pluralize.underscore}.csv")
4
+
5
+ def self.import_model(model_import, file_name = nil)
6
+ file_name ||= Rails.root.join("#{IMPORT_DIR}#{model_import.to_s.pluralize.underscore}.csv")
8
7
  puts "Importing: #{model_import} from #{file_name}"
9
8
  csv = CSV.read(file_name)
10
9
  attributes = csv.shift
11
10
  csv.each do |row|
12
11
  hash = {}
13
- attributes.collect{|k| k.to_sym}.each_with_index do |key,i|
12
+ attributes.collect(&:to_sym).each_with_index do |key, i|
14
13
  hash[key] = row[i]
15
14
  end
16
15
  object = model_import.new(hash)
17
- object.save(:validate => false)
16
+ object.save(validate: false)
18
17
  end
19
18
  end
20
-
19
+
21
20
  def self.import
22
21
  @csv_files = Dir.glob("#{IMPORT_DIR}*.csv").sort
23
22
  @csv_files.each do |file|
24
- if file.include?('$')
25
- model_name = file.split('$').last.split('.').first.classify.constantize
26
- else
27
- model_name = file.split('/').last.split('.').first.classify.constantize
28
- end
29
- if model_name.count == 0
30
- Timecapsule.import_model(model_name, file)
31
- end
23
+ model_name = build_model_name(file)
24
+ import_model(model_name, file) if model_name.count == 0
32
25
  end
33
26
  end
34
-
35
- def self.export_model(model_export, order=nil, attributes=nil, import_model_name=nil)
27
+
28
+ def self.export_model(model_export, order = nil, attributes = nil, import_model_name = nil)
36
29
  import_model_name ||= model_export
37
30
 
38
- Timecapsule.check_for_and_make_directory(EXPORT_DIR)
39
- puts "Exporting: #{model_export} to #{EXPORT_DIR}#{order.to_s}$#{import_model_name.to_s.pluralize.underscore}.csv"
40
- @file = File.open("#{EXPORT_DIR}#{order.to_s}$#{import_model_name.to_s.pluralize.underscore}.csv", "w")
41
-
42
- column_names = attributes.sort.map{|a| a[1]} if attributes
31
+ check_for_and_make_directory(EXPORT_DIR)
32
+
33
+ file_name = build_file_name(import_model_name, order)
34
+
35
+ puts "Exporting: #{model_export} to #{file_name}"
36
+
37
+ @file = File.open(file_name, 'w')
38
+
39
+ column_names = attributes.sort.map { |a| a[1] } if attributes
43
40
  column_names ||= model_export.column_names.sort
44
41
 
45
- @file.puts column_names.join(",")
42
+ @file.puts column_names.join(',')
43
+
46
44
  model_export.all.each do |item|
47
45
  attrib = {}
48
46
  if attributes
49
- attributes.each do |k,v|
47
+ attributes.each do |k, _v|
50
48
  attrib[k] = item[k]
51
49
  end
52
50
  else
53
51
  attrib = item.attributes
54
52
  end
55
53
 
56
- @file.puts attrib.sort.collect{|k,v| "#{Timecapsule.output(v)}"}.join(",")
57
- end
54
+ @file.puts attrib.sort.collect { |_k, v| "#{delete_commas(v)}" }.join(',')
55
+ end
56
+
58
57
  @file.close
59
58
  end
60
-
61
- def self.output(value)
62
- if value.is_a?(String)
63
- return value.gsub(",",'')
59
+
60
+ private
61
+ def self.check_for_and_make_directory(path)
62
+ return true if File.exist?(path)
63
+
64
+ path = Pathname.new(path)
65
+ parent = path.parent
66
+
67
+ check_for_and_make_directory(parent) unless path.parent.parent.root?
68
+
69
+ Dir.mkdir(path) unless File.exist?(path)
64
70
  end
65
- value
66
- end
67
- end
71
+
72
+ def self.delete_commas(value)
73
+ return value.delete(',') if value.is_a?(String)
74
+ value
75
+ end
76
+
77
+ def self.build_model_name(file)
78
+ file.split('/').last.split('.').first.split('-').first.classify.constantize
79
+ end
80
+
81
+ def self.build_file_name(import_model_name, order)
82
+ if order.nil?
83
+ "#{EXPORT_DIR}#{import_model_name.to_s.pluralize.underscore}.csv"
84
+ else
85
+ "#{EXPORT_DIR}#{import_model_name.to_s.pluralize.underscore}-#{order}.csv"
86
+ end
87
+ end
88
+ end
@@ -1,26 +1,21 @@
1
1
  class Timecapsule
2
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
3
+ config.before_configuration do
11
4
 
12
- default_config = {:import_directory => 'db/seed_data/' , :export_directory => 'db/seed_data/'}
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 = Rails.root.join(config[:import_directory]).to_s
23
- Timecapsule::EXPORT_DIR = Rails.root.join(config[:export_directory]).to_s
5
+ default_config = { import_directory: 'db/seed_data/', export_directory: 'db/seed_data/' }
6
+ config_pathname = Rails.root.join('config/timecapsule.yml')
7
+ config_dir_pathname = Rails.root.join('config')
8
+
9
+ unless File.exist?(config_pathname)
10
+ Timecapsule.check_for_and_make_directory(config_dir_pathname)
11
+ config_file = File.open(config_pathname, 'w')
12
+ config_file.puts default_config.to_yaml
13
+ config_file.close
24
14
  end
15
+
16
+ config = YAML.load_file(config_pathname)
17
+ Timecapsule::IMPORT_DIR = Rails.root.join(config[:import_directory]).to_s
18
+ Timecapsule::EXPORT_DIR = Rails.root.join(config[:export_directory]).to_s
19
+ end
25
20
  end
26
- end
21
+ end
@@ -0,0 +1,3 @@
1
+ class Timecapsule
2
+ VERSION = '1.1.2'
3
+ end
data/test/helper.rb CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  Bundler.setup(:default, :development)
10
10
  rescue Bundler::BundlerError => e
11
11
  $stderr.puts e.message
12
- $stderr.puts "Run `bundle install` to install missing gems"
12
+ $stderr.puts 'Run `bundle install` to install missing gems'
13
13
  exit e.status_code
14
14
  end
15
15
  require 'test/unit'
@@ -24,41 +24,41 @@ module Rails
24
24
  end
25
25
  end
26
26
 
27
- #ActiveRecord::Base.logger = ::Logger.new(StringIO.new)
27
+ # ActiveRecord::Base.logger = ::Logger.new(StringIO.new)
28
28
 
29
- ENV["RAILS_ENV"] = "test"
30
- ENV["RAILS_ROOT"] = File.expand_path(File.join(File.dirname(__FILE__), '..'))
29
+ ENV['RAILS_ENV'] = 'test'
30
+ ENV['RAILS_ROOT'] = File.expand_path(File.join(File.dirname(__FILE__), '..'))
31
31
 
32
32
  require 'timecapsule'
33
33
 
34
34
  class Timecapsule
35
- default_config = {:import_directory => 'db/seed_data/' ,
36
- :export_directory => 'db/seed_data/'}
35
+ default_config = { import_directory: 'db/seed_data/',
36
+ export_directory: 'db/seed_data/' }
37
37
  IMPORT_DIR ||= default_config[:import_directory]
38
38
  EXPORT_DIR ||= default_config[:export_directory]
39
- def Timecapsule.check_for_and_make_directory(path)
40
- return true if File.exists?(path)
39
+ def self.check_for_and_make_directory(path)
40
+ return true if File.exist?(path)
41
41
  path = Pathname.new(path)
42
42
  parent = path.parent
43
43
  Timecapsule.check_for_and_make_directory(parent) unless path.parent.parent.root?
44
- Dir.mkdir(path) unless File.exists?(path)
44
+ Dir.mkdir(path) unless File.exist?(path)
45
45
  end
46
46
  end
47
47
 
48
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
48
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
49
49
 
50
- ActiveRecord::Schema.define(:version => 1) do
50
+ ActiveRecord::Schema.define(version: 1) do
51
51
  create_table :users do |t|
52
- t.string :first_name
53
- t.string :last_name
52
+ t.string :first_name
53
+ t.string :last_name
54
54
  t.string :username
55
55
  t.string :password
56
56
  end
57
-
57
+
58
58
  create_table :posts do |t|
59
59
  t.string :title
60
60
  t.string :body
61
- t.integer :user_id
61
+ t.integer :user_id
62
62
  end
63
63
 
64
64
  create_table :names do |t|
@@ -73,11 +73,10 @@ module ActiveRecord
73
73
  new_max = maximum(primary_key) || 0
74
74
  update_seq_sql = "update sqlite_sequence set seq = #{new_max} where name = '#{table_name}';"
75
75
  ActiveRecord::Base.connection.execute(update_seq_sql)
76
- end
76
+ end
77
77
  end
78
78
  end
79
79
 
80
-
81
80
  class User < ActiveRecord::Base
82
81
  has_many :posts
83
82
  end
@@ -91,9 +90,3 @@ end
91
90
 
92
91
  class Test::Unit::TestCase
93
92
  end
94
-
95
-
96
-
97
-
98
-
99
-
@@ -1,14 +1,13 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestTimecapsule < Test::Unit::TestCase
4
-
5
4
  def cleanup!
6
5
  cleanup_db!
7
6
  system "rm -rf #{Pathname.new(Timecapsule::EXPORT_DIR).parent}"
8
7
  system "rm -rf #{Timecapsule::EXPORT_DIR}"
9
- system "rm -rf #{Rails.root.join("config")}"
8
+ system "rm -rf #{Rails.root.join('config')}"
10
9
  end
11
-
10
+
12
11
  def cleanup_db!
13
12
  User.destroy_all
14
13
  Post.destroy_all
@@ -17,15 +16,15 @@ class TestTimecapsule < Test::Unit::TestCase
17
16
  Post.reset_pk_sequence
18
17
  Name.reset_pk_sequence
19
18
  end
20
-
21
- should "export a model" do
22
- Timecapsule.export_model(User)
23
- assert_equal true, File.exists?("#{Timecapsule::EXPORT_DIR}$#{User.to_s.pluralize.underscore}.csv")
24
- cleanup!
19
+
20
+ should 'export a model' do
21
+ Timecapsule.export_model(User)
22
+ assert_equal true, File.exist?("#{Timecapsule::EXPORT_DIR}#{User.to_s.pluralize.underscore}.csv")
23
+ cleanup!
25
24
  end
26
-
27
- should "import a model" do
28
- User.create!(:first_name => 'test', :last_name => 'tester')
25
+
26
+ should 'import a model' do
27
+ User.create!(first_name: 'test', last_name: 'tester')
29
28
  assert_equal 1, User.count
30
29
  Timecapsule.export_model(User)
31
30
  cleanup_db!
@@ -35,10 +34,10 @@ class TestTimecapsule < Test::Unit::TestCase
35
34
  assert_equal 'test', User.first.first_name
36
35
  cleanup!
37
36
  end
38
-
39
- should "import all the models" do
40
- u = User.create!(:first_name => 'test', :last_name => 'tester')
41
- Post.create!(:title => 'Test Post', :body => 'I like to test my gems!', :user => u)
37
+
38
+ should 'import all the models' do
39
+ u = User.create!(first_name: 'test', last_name: 'tester')
40
+ Post.create!(title: 'Test Post', body: 'I like to test my gems!', user: u)
42
41
  assert_equal User.first, Post.first.user
43
42
  assert_equal 1, User.count
44
43
  assert_equal 1, Post.count
@@ -56,15 +55,14 @@ class TestTimecapsule < Test::Unit::TestCase
56
55
  cleanup!
57
56
  end
58
57
 
59
- should "export part of a model" do
60
- u = User.create!(:first_name => 'test', :last_name => 'tester')
61
- Timecapsule.export_model(User,nil,{first_name: :name, last_name: :other_name},'name')
58
+ should 'export part of a model' do
59
+ u = User.create!(first_name: 'test', last_name: 'tester')
60
+ Timecapsule.export_model(User, nil, { first_name: :name, last_name: :other_name }, 'name')
62
61
  cleanup_db!
63
- assert_equal true, File.exists?("#{Timecapsule::EXPORT_DIR}$#{'name'.to_s.pluralize.underscore}.csv")
62
+ assert_equal true, File.exist?("#{Timecapsule::EXPORT_DIR}#{'name'.to_s.pluralize.underscore}.csv")
64
63
  Timecapsule.import
65
64
  assert_equal 1, Name.count
66
65
  assert_equal 'test', Name.first.name
67
66
  cleanup!
68
67
  end
69
-
70
68
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timecapsule
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - Renée De Voursney
7
+ - Renée Hendricksen
8
+ - Kerri Miller
9
+ - Risa Batta
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2014-01-16 00:00:00.000000000 Z
13
+ date: 2015-11-03 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: activerecord
@@ -52,105 +54,20 @@ dependencies:
52
54
  - - '>='
53
55
  - !ruby/object:Gem::Version
54
56
  version: 2.3.5
55
- - !ruby/object:Gem::Dependency
56
- name: sqlite3
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: shoulda
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: jeweler
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ~>
102
- - !ruby/object:Gem::Version
103
- version: 1.6.4
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ~>
109
- - !ruby/object:Gem::Version
110
- version: 1.6.4
111
- - !ruby/object:Gem::Dependency
112
- name: rdoc
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '>='
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- description: Great for creating seed data from data entered through your app's ui
57
+ description: Great for creating seed data from data entered through your app's UI
126
58
  or the console
127
- email: renee.devoursney@gmail.com
59
+ email: robots@nird.us
128
60
  executables: []
129
61
  extensions: []
130
- extra_rdoc_files:
131
- - LICENSE.txt
132
- - README.rdoc
62
+ extra_rdoc_files: []
133
63
  files:
134
- - .document
135
- - .rvmrc
136
- - .travis.yml
137
- - Gemfile
138
- - Gemfile.lock
139
- - LICENSE.txt
140
- - README.rdoc
141
64
  - Rakefile
142
- - VERSION
143
- - gemfiles/rails2.gemfile
144
- - gemfiles/rails2_3_8.gemfile
145
- - gemfiles/rails3.gemfile
146
- - gemfiles/rails3_1.gemfile
147
- - gemfiles/rails4.gemfile
148
65
  - lib/timecapsule.rb
149
66
  - lib/timecapsule/railtie.rb
67
+ - lib/timecapsule/version.rb
150
68
  - test/helper.rb
151
69
  - test/test_timecapsule.rb
152
- - timecapsule.gemspec
153
- homepage: http://github.com/reneedv/timecapsule
70
+ homepage: https://github.com/nirds/timecapsule
154
71
  licenses:
155
72
  - MIT
156
73
  metadata: {}
@@ -170,8 +87,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
87
  version: '0'
171
88
  requirements: []
172
89
  rubyforge_project:
173
- rubygems_version: 2.1.11
90
+ rubygems_version: 2.4.6
174
91
  signing_key:
175
92
  specification_version: 4
176
93
  summary: gem for importing and exporting ActiveRecord data.
177
- test_files: []
94
+ test_files:
95
+ - test/helper.rb
96
+ - test/test_timecapsule.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.rvmrc DELETED
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
- environment_id="2.0.0@timecapsule"
8
-
9
- #
10
- # Uncomment following line if you want options to be set only for given project.
11
- #
12
- # PROJECT_JRUBY_OPTS=( --1.9 )
13
-
14
- #
15
- # First we attempt to load the desired environment directly from the environment
16
- # file. This is very fast and efficient compared to running through the entire
17
- # CLI and selector. If you want feedback on which environment was used then
18
- # insert the word 'use' after --create as this triggers verbose mode.
19
- #
20
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
21
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
22
- then
23
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
24
-
25
- if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
26
- then
27
- . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
28
- fi
29
- else
30
- # If the environment file has not yet been created, use the RVM CLI to select.
31
- if ! rvm --create "$environment_id"
32
- then
33
- echo "Failed to create RVM environment '${environment_id}'."
34
- return 1
35
- fi
36
- fi
37
-
38
- #
39
- # If you use an RVM gemset file to install a list of gems (*.gems), you can have
40
- # it be automatically loaded. Uncomment the following and adjust the filename if
41
- # necessary.
42
- #
43
- # filename=".gems"
44
- # if [[ -s "$filename" ]]
45
- # then
46
- # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
47
- # fi
48
-
49
- # If you use bundler, this might be useful to you:
50
- if command -v bundle && [[ -s Gemfile ]]
51
- then
52
- bundle install
53
- fi
54
-
55
- if [[ $- == *i* ]] # check for interactive shells
56
- then
57
- echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
58
- else
59
- echo "Using: $GEM_HOME" # don't use colors in interactive shells
60
- fi
61
-
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.8.7
4
- - ree
5
- - 2.0.0
6
- gemfile:
7
- - gemfiles/rails2.gemfile
8
- - gemfiles/rails2_3_8.gemfile
9
- - gemfiles/rails3.gemfile
10
- - gemfiles/rails3_1.gemfile
11
- - gemfiles/rails4.gemfile
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- gem "activerecord", ">= 2.3.5"
5
- gem 'activesupport', '>= 2.3.5'
6
- gem "rails", ">=2.3.5"
7
-
8
- # Add dependencies to develop your gem here.
9
- # Include everything needed to run rake, tests, features, etc.
10
- group :development do
11
- gem "sqlite3"
12
- gem "shoulda", ">= 0"
13
- gem "bundler"
14
- gem "jeweler", "~> 1.6.4"
15
- #gem "rcov", ">= 0"
16
- gem "rdoc"
17
- end
data/Gemfile.lock DELETED
@@ -1,101 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- actionmailer (3.1.3)
5
- actionpack (= 3.1.3)
6
- mail (~> 2.3.0)
7
- actionpack (3.1.3)
8
- activemodel (= 3.1.3)
9
- activesupport (= 3.1.3)
10
- builder (~> 3.0.0)
11
- erubis (~> 2.7.0)
12
- i18n (~> 0.6)
13
- rack (~> 1.3.5)
14
- rack-cache (~> 1.1)
15
- rack-mount (~> 0.8.2)
16
- rack-test (~> 0.6.1)
17
- sprockets (~> 2.0.3)
18
- activemodel (3.1.3)
19
- activesupport (= 3.1.3)
20
- builder (~> 3.0.0)
21
- i18n (~> 0.6)
22
- activerecord (3.1.3)
23
- activemodel (= 3.1.3)
24
- activesupport (= 3.1.3)
25
- arel (~> 2.2.1)
26
- tzinfo (~> 0.3.29)
27
- activeresource (3.1.3)
28
- activemodel (= 3.1.3)
29
- activesupport (= 3.1.3)
30
- activesupport (3.1.3)
31
- multi_json (~> 1.0)
32
- arel (2.2.1)
33
- builder (3.0.0)
34
- erubis (2.7.0)
35
- git (1.2.5)
36
- hike (1.2.1)
37
- i18n (0.6.0)
38
- jeweler (1.6.4)
39
- bundler (~> 1.0)
40
- git (>= 1.2.5)
41
- rake
42
- json (1.6.1)
43
- mail (2.3.0)
44
- i18n (>= 0.4.0)
45
- mime-types (~> 1.16)
46
- treetop (~> 1.4.8)
47
- mime-types (1.17.2)
48
- multi_json (1.0.4)
49
- polyglot (0.3.3)
50
- rack (1.3.6)
51
- rack-cache (1.1)
52
- rack (>= 0.4)
53
- rack-mount (0.8.3)
54
- rack (>= 1.0.0)
55
- rack-ssl (1.3.2)
56
- rack
57
- rack-test (0.6.1)
58
- rack (>= 1.0)
59
- rails (3.1.3)
60
- actionmailer (= 3.1.3)
61
- actionpack (= 3.1.3)
62
- activerecord (= 3.1.3)
63
- activeresource (= 3.1.3)
64
- activesupport (= 3.1.3)
65
- bundler (~> 1.0)
66
- railties (= 3.1.3)
67
- railties (3.1.3)
68
- actionpack (= 3.1.3)
69
- activesupport (= 3.1.3)
70
- rack-ssl (~> 1.3.2)
71
- rake (>= 0.8.7)
72
- rdoc (~> 3.4)
73
- thor (~> 0.14.6)
74
- rake (0.9.2.2)
75
- rdoc (3.11)
76
- json (~> 1.4)
77
- shoulda (2.11.3)
78
- sprockets (2.0.3)
79
- hike (~> 1.2)
80
- rack (~> 1.0)
81
- tilt (~> 1.1, != 1.3.0)
82
- sqlite3 (1.3.5)
83
- thor (0.14.6)
84
- tilt (1.3.3)
85
- treetop (1.4.10)
86
- polyglot
87
- polyglot (>= 0.3.1)
88
- tzinfo (0.3.31)
89
-
90
- PLATFORMS
91
- ruby
92
-
93
- DEPENDENCIES
94
- activerecord (>= 2.3.5)
95
- activesupport (>= 2.3.5)
96
- bundler
97
- jeweler (~> 1.6.4)
98
- rails (>= 2.3.5)
99
- rdoc
100
- shoulda
101
- sqlite3
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011 Renée De Voursney
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,30 +0,0 @@
1
- = timecapsule
2
- Gem for importing and exporting ActiveRecord data.
3
- Great for creating seed data from data entered through your app's ui or the console.
4
-
5
- == Install:
6
- $ gem install timecapsule
7
- * for Rails <3.0 use:
8
- $ gem install --version '= 1.0.0' timecapsule
9
-
10
- == Usage:
11
- * Export a model from your app to a csv file. Here is an example for a User model:
12
- $ Timecapsule.export_model(User)
13
- * Import a model from the csv file:
14
- $ Timecapsule.import_model(User)
15
- * To specify a different import or export directory, besides the default db/seed,
16
- open the automatically generated config/timecapsule.yml file and change the export directory.
17
- * To import all the csv files in your import directory call the import method:
18
- $ Timecapsule.import
19
- * If the order of import matters for your models, you can specify the order at export time:
20
- $ Timecapsule.export_model(User, 1)
21
- Timecapsule.export_model(Post, 2)
22
- * Remember that if you want to maintain relationships between import/export
23
- you must reset the primary key sequence (id) for each of the tables for your models.
24
- Or drop and re-create your database.
25
-
26
- Copyright (c) 2011-present MIT
27
-
28
- Author : Renée De Voursney
29
- Email : renee.devoursney@gmail.com
30
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.1.0
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "activerecord", "= 2.3.5"
3
- gem 'activesupport', '= 2.3.5'
4
- gem "rails", "= 2.3.5"
5
-
6
- group :development do
7
- gem "sqlite3"
8
- gem "shoulda", ">= 0"
9
- gem "bundler", "~> 1.0.0"
10
- gem "jeweler", "~> 1.6.4"
11
- gem "rcov", ">= 0"
12
- gem "rdoc"
13
- end
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "activerecord", "= 2.3.8"
3
- gem 'activesupport', '= 2.3.8'
4
- gem "rails", "= 2.3.8"
5
-
6
- group :development do
7
- gem "sqlite3"
8
- gem "shoulda", ">= 0"
9
- gem "bundler", "~> 1.0.0"
10
- gem "jeweler", "~> 1.6.4"
11
- gem "rcov", ">= 0"
12
- gem "rdoc"
13
- end
@@ -1,12 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "activerecord", "= 3.0.0"
3
- gem 'activesupport', '= 3.0.0'
4
- gem "rails", "= 3.0.0"
5
-
6
- group :development do
7
- gem "sqlite3"
8
- gem "shoulda", ">= 0"
9
- gem "bundler"
10
- gem "jeweler", "~> 1.6.4"
11
- gem "rdoc"
12
- end
@@ -1,12 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "activerecord", "= 3.1.0"
3
- gem 'activesupport', '= 3.1.0'
4
- gem "rails", "= 3.1.0"
5
-
6
- group :development do
7
- gem "sqlite3"
8
- gem "shoulda", ">= 0"
9
- gem "bundler"
10
- gem "jeweler", "~> 1.6.4"
11
- gem "rdoc"
12
- end
@@ -1,12 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "activerecord", "= 4.0.0"
3
- gem 'activesupport', '= 4.0.0'
4
- gem "rails", "= 4.0.0"
5
-
6
- group :development do
7
- gem "sqlite3"
8
- gem "shoulda", ">= 0"
9
- gem "bundler"
10
- gem "jeweler", "~> 1.6.4"
11
- gem "rdoc"
12
- end
data/timecapsule.gemspec DELETED
@@ -1,80 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: timecapsule 1.1.0 ruby lib
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "timecapsule"
9
- s.version = "1.1.0"
10
-
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.authors = ["Ren\u{e9}e De Voursney"]
13
- s.date = "2014-01-16"
14
- s.description = "Great for creating seed data from data entered through your app's ui or the console"
15
- s.email = "renee.devoursney@gmail.com"
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".rvmrc",
23
- ".travis.yml",
24
- "Gemfile",
25
- "Gemfile.lock",
26
- "LICENSE.txt",
27
- "README.rdoc",
28
- "Rakefile",
29
- "VERSION",
30
- "gemfiles/rails2.gemfile",
31
- "gemfiles/rails2_3_8.gemfile",
32
- "gemfiles/rails3.gemfile",
33
- "gemfiles/rails3_1.gemfile",
34
- "gemfiles/rails4.gemfile",
35
- "lib/timecapsule.rb",
36
- "lib/timecapsule/railtie.rb",
37
- "test/helper.rb",
38
- "test/test_timecapsule.rb",
39
- "timecapsule.gemspec"
40
- ]
41
- s.homepage = "http://github.com/reneedv/timecapsule"
42
- s.licenses = ["MIT"]
43
- s.require_paths = ["lib"]
44
- s.rubygems_version = "2.1.11"
45
- s.summary = "gem for importing and exporting ActiveRecord data."
46
-
47
- if s.respond_to? :specification_version then
48
- s.specification_version = 4
49
-
50
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<activerecord>, [">= 2.3.5"])
52
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
53
- s.add_runtime_dependency(%q<rails>, [">= 2.3.5"])
54
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
55
- s.add_development_dependency(%q<shoulda>, [">= 0"])
56
- s.add_development_dependency(%q<bundler>, [">= 0"])
57
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
58
- s.add_development_dependency(%q<rdoc>, [">= 0"])
59
- else
60
- s.add_dependency(%q<activerecord>, [">= 2.3.5"])
61
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
62
- s.add_dependency(%q<rails>, [">= 2.3.5"])
63
- s.add_dependency(%q<sqlite3>, [">= 0"])
64
- s.add_dependency(%q<shoulda>, [">= 0"])
65
- s.add_dependency(%q<bundler>, [">= 0"])
66
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
67
- s.add_dependency(%q<rdoc>, [">= 0"])
68
- end
69
- else
70
- s.add_dependency(%q<activerecord>, [">= 2.3.5"])
71
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
72
- s.add_dependency(%q<rails>, [">= 2.3.5"])
73
- s.add_dependency(%q<sqlite3>, [">= 0"])
74
- s.add_dependency(%q<shoulda>, [">= 0"])
75
- s.add_dependency(%q<bundler>, [">= 0"])
76
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
77
- s.add_dependency(%q<rdoc>, [">= 0"])
78
- end
79
- end
80
-