masshtab_dev_tools 0.0.4 → 0.0.5

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.
@@ -1 +1 @@
1
- Generates database.yml configured on mysql2 for OS X and linux
1
+ Generates database.yml configured on mysql2 for OS X and ubuntu
@@ -2,14 +2,20 @@ module Masshtab
2
2
  class DatabaseGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path('../templates', __FILE__)
4
4
 
5
+ class_option :mysql_with_sqlite, type: :boolean, default: false, desc: 'configure to sqlite on darwin and to mysql on others'
5
6
  class_option :application_name, type: :string, default: Rails.application.class.parent_name.underscore, desc: 'Rails application name'
6
7
 
7
8
  def mysql2_gem
9
+ gem 'sqlite3' if options[:mysql_with_sqlite]
8
10
  gem 'mysql2'
9
11
  end
10
12
 
11
13
  def database_yml
12
- template 'database.yml', Rails.root.join('config', 'database.yml')
14
+ if options[:mysql_with_sqlite]
15
+ template 'mysql_with_sqlite.yml', Rails.root.join('config', 'database.yml')
16
+ else
17
+ template 'mysql.yml', Rails.root.join('config', 'database.yml')
18
+ end
13
19
  end
14
20
 
15
21
  end
@@ -0,0 +1,73 @@
1
+ <%% if is_darwin = RUBY_PLATFORM.downcase.include?('darwin') %>
2
+ # SQLite version 3.x
3
+ # gem install sqlite3
4
+ #
5
+ # Ensure the SQLite 3 gem is defined in your Gemfile
6
+ # gem 'sqlite3'
7
+ development:
8
+ adapter: sqlite3
9
+ database: db/development.sqlite3
10
+ pool: 5
11
+ timeout: 5000
12
+
13
+ # Warning: The database defined as "test" will be erased and
14
+ # re-generated from your development database when you run "rake".
15
+ # Do not set this db to the same as development or production.
16
+ test:
17
+ adapter: sqlite3
18
+ database: db/test.sqlite3
19
+ pool: 5
20
+ timeout: 5000
21
+
22
+ production:
23
+ adapter: sqlite3
24
+ database: db/production.sqlite3
25
+ pool: 5
26
+ timeout: 5000
27
+
28
+ <%% else %>
29
+ # MySQL. Versions 4.1 and 5.0 are recommended.
30
+ #
31
+ # Install the MYSQL driver
32
+ # gem install mysql2
33
+ #
34
+ # Ensure the MySQL gem is defined in your Gemfile
35
+ # gem 'mysql2'
36
+ #
37
+ # And be sure to use new-style password hashing:
38
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
39
+
40
+ <%% socket = is_darwin ? '/tmp/mysqld.sock' : '/var/run/mysqld/mysqld.sock' %>
41
+ development:
42
+ adapter: mysql2
43
+ encoding: utf8
44
+ reconnect: false
45
+ database: <%= options.application_name %>_development
46
+ pool: 5
47
+ username: root
48
+ password:
49
+ socket: <%%= socket %>
50
+
51
+ # Warning: The database defined as "test" will be erased and
52
+ # re-generated from your development database when you run "rake".
53
+ # Do not set this db to the same as development or production.
54
+ test:
55
+ adapter: mysql2
56
+ encoding: utf8
57
+ reconnect: false
58
+ database: <%= options.application_name %>_test
59
+ pool: 5
60
+ username: root
61
+ password:
62
+ socket: <%%= socket %>
63
+
64
+ production:
65
+ adapter: mysql2
66
+ encoding: utf8
67
+ reconnect: false
68
+ database: <%= options.application_name %>_production
69
+ pool: 5
70
+ username: root
71
+ password:
72
+ socket: <%%= socket %>
73
+ <%% end %>
@@ -1,3 +1,3 @@
1
1
  module MasshtabDevTools
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masshtab_dev_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2013-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -75,7 +75,8 @@ files:
75
75
  - bin/make-ctags
76
76
  - lib/generators/masshtab/database/USAGE
77
77
  - lib/generators/masshtab/database/database_generator.rb
78
- - lib/generators/masshtab/database/templates/database.yml
78
+ - lib/generators/masshtab/database/templates/mysql.yml
79
+ - lib/generators/masshtab/database/templates/mysql_with_sqlite.yml
79
80
  - lib/generators/masshtab/deploy/USAGE
80
81
  - lib/generators/masshtab/deploy/deploy_generator.rb
81
82
  - lib/generators/masshtab/deploy/templates/Capfile