alexrothenberg-legacy_data 0.0.7 → 0.0.8

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -11,7 +11,11 @@ class ModelsFromTablesGenerator < Rails::Generator::Base
11
11
 
12
12
  analyzed_tables = LegacyData::Schema.analyze(:table_name=>options[:table_name])
13
13
  LegacyData::TableClassNameMapper.save_dictionary
14
- puts "Please look at #{LegacyData::TableClassNameMapper.dictionary_file_name} [hit <enter> to continue]"
14
+ puts <<-MSG
15
+ Done analyzing the tables.
16
+ Please review the class names shown above. If any do not look correct (for example it did not separate the words with CamelCase) please supply the correct mappings by editing the file #{LegacyData::TableClassNameMapper.dictionary_file_name}.
17
+ Once you're done hit <enter> to continue generating the models"
18
+ MSG
15
19
  gets
16
20
  LegacyData::TableClassNameMapper.load_dictionary
17
21
 
@@ -1,6 +1,6 @@
1
1
  class <%= class_name -%> < ActiveRecord::Base
2
- set_table_name :<%= table_name %>
3
- <%= "set_primary_key #{primary_key.inspect}" if primary_key %>
2
+ set_table_name <%= table_name.to_sym.inspect %>
3
+ <%= "set_primary_key #{primary_key.to_sym.inspect}" if primary_key %>
4
4
 
5
5
  # Relationships
6
6
  <%- relations[:has_some].each do |table_name, foreign_key|
data/legacy_data.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{legacy_data}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex Rothenberg"]
@@ -26,7 +26,7 @@ module LegacyData
26
26
 
27
27
  def load_dictionary
28
28
  @dictionary = nil
29
- YAML.load_file(dictionary_file_name) || {}
29
+ File.exists?(dictionary_file_name) ? YAML.load_file(dictionary_file_name) : {}
30
30
  end
31
31
 
32
32
  def save_dictionary
@@ -36,7 +36,7 @@ module LegacyData
36
36
  end
37
37
 
38
38
  def dictionary_file_name
39
- File.join(RAILS_ROOT, 'app', 'models', 'table_mappings.yaml')
39
+ File.join(RAILS_ROOT, 'app', 'models', 'table_mappings.yml')
40
40
  end
41
41
 
42
42
  def self.class_name_for table_name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexrothenberg-legacy_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rothenberg