databasion 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,11 +2,9 @@
2
2
 
3
3
  ## Google Spreadsheet/Excel -> YAML -> Ruby Migration -> Database Management Tool
4
4
 
5
- If we were all part of a hive mind, we wouldn't need management anything. Databases would get built, the correct columns would get used, programmers would align their ORMs, and keeping it all together wouldn't be some kind of management nightmare.
5
+ A database management tool. The theory is that a designer/planner can edit application data, a programmer can setup the database and it's fields, all in one happy little place. As tables are added, and data is changed, if the script is run once again it will update the target database.
6
6
 
7
- Fortunately we aren't a hive mind*. Still, even though my coworkers can't read my mind, we've come up with a tool that allows top end planners to describe system data in a spreadsheet, programmers to fudge in the column types, sizes, and database relationships, and everyone to export it out into YAML and Ruby migration scripts which update your infrastructure. Ideally the fully automated suite is used in your test environment so your planner can quickly test changes, and a step by step process used if you are updating production machines.
8
-
9
- * If we were I would be just as confused as I am any other day, our office's main language is Japanese. Although I've been studying it for 9 years...
7
+ TODO: While this system uses Rails Migrations, it isn't taking full advantage of them (i.e. tracking changes, allowing for rollbacks, etc.). This was also created under a high pressure timeline, so it was unfortunate that I could not create a fully working test suite.
10
8
 
11
9
  ## Requirements
12
10
 
@@ -136,7 +134,7 @@ __0.1.0__
136
134
 
137
135
  ## Testing
138
136
 
139
- Currently Databasion uses the cucumber test suite. Any patches or pull requests must have a corresponding Feature, and all tests must pass. Feature branches get bonus points.
137
+ Currently Databasion uses the cucumber test suite. The tests aren't complete, unfortunately.
140
138
 
141
139
  ## Author
142
140
 
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Jeweler::Tasks.new do |gem|
8
8
  gem.email = "mojobojo@gmail.com"
9
9
  gem.homepage = "http://github.com/boj/databasion"
10
10
  gem.authors = ["Brian Jones", "Istpika"]
11
- gem.version = "0.0.8"
11
+ gem.version = "0.0.9"
12
12
 
13
13
  gem.add_dependency('activerecord', '>= 2.3.5')
14
14
  gem.add_dependency('activesupport', '>= 2.3.5')
data/databasion.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{databasion}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Jones", "Istpika"]
12
- s.date = %q{2010-07-05}
12
+ s.date = %q{2010-10-12}
13
13
  s.default_executable = %q{databasion}
14
14
  s.email = %q{mojobojo@gmail.com}
15
15
  s.executables = ["databasion"]
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
39
39
  "lib/databasion/csvilize.rb",
40
40
  "lib/databasion/datacize.rb",
41
41
  "lib/databasion/excelize.rb",
42
- "lib/databasion/gititlize.rb",
42
+ "lib/databasion/gitilize.rb",
43
43
  "lib/databasion/googlize.rb",
44
44
  "lib/databasion/loadlize.rb",
45
45
  "lib/databasion/migitize.rb",
File without changes
@@ -59,7 +59,8 @@ module Databasion
59
59
  spreadsheet.worksheets.each do |worksheet|
60
60
  next unless master_list.collect { |row| row['spreadsheet'] }.include?(worksheet.title)
61
61
  data_hash = parse(worksheet)
62
- data_hash['connection'] = master_list.collect { |row| row if row['spreadsheet'] == data_hash['name'] }.reject { |d| d.nil? }[0]
62
+ data_hash['connection'] = master_list.collect { |row| row if row['spreadsheet'] == worksheet.title }.reject { |d| d.nil? }[0]
63
+ puts data_hash.inspect
63
64
  Databasion::Yamalize.yamlbate(data_hash, @@config['output']['yaml_path'])
64
65
  end
65
66
  end
@@ -103,11 +104,13 @@ module Databasion
103
104
 
104
105
  case row[0]
105
106
  when "table"
106
- if d = row[1].split(",")
107
- name = d[0]
108
- plural = false if d[1] == 'false'
109
- else
107
+ begin
108
+ d = row[1].split(",")
109
+ name = d[0].strip
110
+ plural = false if d[1].strip == 'false'
111
+ rescue
110
112
  name = row[1]
113
+ plural = true
111
114
  end
112
115
  when "field"
113
116
  row.each do |field|
@@ -58,7 +58,7 @@ module Databasion
58
58
 
59
59
  def self.set_table_name(meta)
60
60
  return meta['name'].pluralize if meta['plural']
61
- meta['name'].pluralize
61
+ meta['name']
62
62
  end
63
63
 
64
64
  def self.ruby_model(meta)
@@ -76,7 +76,7 @@ module Databasion
76
76
  end
77
77
 
78
78
  def self.ruby_model_name(meta)
79
- meta['plural'] ? meta['name'].camelize.pluralize : meta['name'].camelize
79
+ meta['name'].camelize
80
80
  end
81
81
 
82
82
  def self.ruby_model_table_name(meta)
@@ -1,5 +1,5 @@
1
1
  class <%= class_name %> < ActiveRecord::Base
2
- <%= 'set_table_name %s' % table_name unless table_name.nil? %><%= "\n" %>
2
+ <%= 'set_table_name "%s"' % table_name unless table_name.nil? %><%= "\n" %>
3
3
  end
4
4
  <%= class_name %>.establish_connection(
5
5
  <% count = 0 %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databasion
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Jones
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-07-05 00:00:00 +09:00
19
+ date: 2010-10-12 00:00:00 +09:00
20
20
  default_executable: databasion
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -115,7 +115,7 @@ files:
115
115
  - lib/databasion/csvilize.rb
116
116
  - lib/databasion/datacize.rb
117
117
  - lib/databasion/excelize.rb
118
- - lib/databasion/gititlize.rb
118
+ - lib/databasion/gitilize.rb
119
119
  - lib/databasion/googlize.rb
120
120
  - lib/databasion/loadlize.rb
121
121
  - lib/databasion/migitize.rb