rails_new 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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_new (0.0.7)
4
+ rails_new (0.0.8)
5
5
  rails (= 3.2.9)
6
6
 
7
7
  GEM
@@ -41,7 +41,7 @@ GEM
41
41
  hike (1.2.1)
42
42
  i18n (0.6.1)
43
43
  journey (1.0.4)
44
- json (1.7.5)
44
+ json (1.7.6)
45
45
  mail (2.4.4)
46
46
  i18n (>= 0.4.0)
47
47
  mime-types (~> 1.16)
@@ -49,7 +49,7 @@ GEM
49
49
  mime-types (1.19)
50
50
  multi_json (1.5.0)
51
51
  polyglot (0.3.3)
52
- rack (1.4.1)
52
+ rack (1.4.3)
53
53
  rack-cache (1.2)
54
54
  rack (>= 0.4)
55
55
  rack-ssl (1.3.2)
@@ -1,12 +1,17 @@
1
1
  source 'https://rubygems.org'
2
2
  ruby '1.9.3'
3
3
 
4
+ gem 'rails', '3.2.10'
5
+ gem 'jquery-rails'
4
6
  <%- if @haml -%>
5
7
  gem 'haml-rails'
6
8
  <%- end -%>
7
- gem 'jquery-rails'
8
9
  gem '<%= database_adapter %>'
9
- gem 'rails', '3.2.9'
10
+ <%- if @twitter_bootstrap -%>
11
+ gem 'therubyracer'
12
+ gem 'less-rails'
13
+ gem 'twitter-bootstrap-rails'
14
+ <%- end -%>
10
15
 
11
16
  group :development do
12
17
  gem 'better_errors'
@@ -1,31 +1,31 @@
1
1
  defaults: &defaults
2
- adapter: <%= database_adapter %>
2
+ adapter: <%= database_yaml_adapter %>
3
3
  <%- if database_encoding -%>
4
4
  encoding: <%= database_encoding %>
5
5
  <%- end -%>
6
- <%- if database_adapter == 'mysql2' %>
6
+ <%- if database_yaml_adapter == 'mysql2' %>
7
7
  reconnect: false
8
8
  <%- end -%>
9
9
  pool: 5
10
- <%- if database_adapter == 'sqlite3' -%>
10
+ <%- if database_yaml_adapter == 'sqlite3' -%>
11
11
  timeout: 5000
12
12
  <%- end -%>
13
- <%- if database_adapter != 'sqlite3' -%>
13
+ <%- if database_yaml_adapter != 'sqlite3' -%>
14
14
  username:
15
15
  password:
16
16
  <%- end -%>
17
- <%- if database_adapter == 'mysql2' -%>
17
+ <%- if database_yaml_adapter == 'mysql2' -%>
18
18
  socket: /tmp/mysql.sock
19
19
  <%- end -%>
20
20
 
21
21
  development:
22
22
  <<: *defaults
23
- <%= database_adapter == 'sqlite3' ? 'database: db/development.sqlite3' : "database: #{@app_name}_development" %>
23
+ <%= database_yaml_adapter == 'sqlite3' ? 'database: db/development.sqlite3' : "database: #{@app_name}_development" %>
24
24
 
25
25
  test:
26
26
  <<: *defaults
27
- <%= database_adapter == 'sqlite3' ? 'database: db/test.sqlite3' : "database: #{@app_name}_test" %>
27
+ <%= database_yaml_adapter == 'sqlite3' ? 'database: db/test.sqlite3' : "database: #{@app_name}_test" %>
28
28
 
29
29
  production:
30
30
  <<: *defaults
31
- <%= database_adapter == 'sqlite3' ? 'database: db/production.sqlite3' : "database: #{@app_name}" %>
31
+ <%= database_yaml_adapter == 'sqlite3' ? 'database: db/production.sqlite3' : "database: #{@app_name}" %>
@@ -1,3 +1,3 @@
1
1
  module RailsNew
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
data/lib/template.rb CHANGED
@@ -31,11 +31,17 @@ def database_adapter
31
31
  when 'postgresql', 'postgres', 'psql' then 'pg'
32
32
  when 'mysql' then 'mysql2'
33
33
  when 'sqlite' then 'sqlite3'
34
- when 'mongo', 'mongodb' then 'mongoid'
35
34
  else @database
36
35
  end
37
36
  end
38
37
 
38
+ def database_yaml_adapter
39
+ case database_adapter
40
+ when 'pg' then 'postgresql'
41
+ else database_adapter
42
+ end
43
+ end
44
+
39
45
  def database_encoding
40
46
  case database_adapter
41
47
  when 'pg' then 'unicode'
@@ -50,10 +56,10 @@ end
50
56
  @database = prompt 'What database you want to use?', default_answer: 'postgresql'
51
57
  @customized = yes? 'Would you like to customize the template options?'
52
58
  @create_commits = yes? 'Create first git commits?'
53
- # @static_pages = yes? 'Create static pages?'
54
- # @haml = yes? 'Use HAML?'
59
+ @static_pages = yes? 'Create static pages?'
60
+ @haml = yes? 'Use HAML?'
55
61
  @pt_br_locales = yes? 'Use brazilian portuguese locale (I18n)?'
56
- # @twitter_bootstrap = yes? 'Install and configure Twitter Bootstrap Rails gem?'
62
+ @twitter_bootstrap = yes? 'Install and configure Twitter Bootstrap Rails gem?'
57
63
  # @devise = yes? 'Install and configure Devise gem?'
58
64
 
59
65
 
@@ -78,6 +84,14 @@ if @pt_br_locales
78
84
  commit 'Including pt-br locales' if @create_commits
79
85
  end
80
86
 
81
- # route "map.root :controller => 'people'"
82
- # rake 'db:migrate'
83
- # rake 'twitter boostrap rake tasks...'
87
+ if @twitter_bootstrap
88
+ system 'rails generate bootstrap:install less'
89
+ system 'rails generate bootstrap:layout application'
90
+ commit 'Installing twitter bootstrap gem' if @create_commits
91
+ end
92
+
93
+ if @static_pages
94
+ if @twitter_bootstrap
95
+ else
96
+ end
97
+ end
@@ -1,4 +1,4 @@
1
1
  def read_template
2
2
  file = File.expand_path("../../../lib/files/#{example.metadata[:example_group][:description]}.erb", __FILE__)
3
- ERB.new(File.new(file).read, nil, '%').result(binding)
3
+ ERB.new(File.new(file).read, nil, '-', '@output_buffer').result(binding)
4
4
  end
@@ -25,6 +25,20 @@ describe 'files' do
25
25
  expect(read_template).to_not match(%r{gem 'haml-rails'})
26
26
  end
27
27
 
28
+ it 'includes twitter-bootstrap-rails gems' do
29
+ @twitter_bootstrap = true
30
+ [%r{therubyracer}, %r{less-rails}, %r{twitter-bootstrap-rails}].each do |group|
31
+ expect(read_template).to match(group)
32
+ end
33
+ end
34
+
35
+ it 'does not include twitter-bootstrap-rails gems' do
36
+ @twitter_bootstrap = false
37
+ [%r{therubyracer}, %r{less-rails}, %r{twitter-bootstrap-rails}].each do |group|
38
+ expect(read_template).to_not match(group)
39
+ end
40
+ end
41
+
28
42
  it 'includes database adapter gem' do
29
43
  expect(read_template).to match(%r{gem 'pg'})
30
44
  end
@@ -52,7 +66,7 @@ describe 'files' do
52
66
 
53
67
  describe 'config/database.yml' do
54
68
  before do
55
- stub!(:database_adapter)
69
+ stub!(:database_yaml_adapter)
56
70
  stub!(:database_encoding)
57
71
  end
58
72
 
@@ -69,8 +83,8 @@ describe 'files' do
69
83
  end
70
84
 
71
85
  it 'includes the database adapter key' do
72
- stub!(:database_adapter).and_return('pg')
73
- expect(read_template).to match(%r{adapter: pg})
86
+ stub!(:database_yaml_adapter).and_return('postgresql')
87
+ expect(read_template).to match(%r{adapter: postgresql})
74
88
  end
75
89
 
76
90
  it 'includes the database encoding key' do
@@ -84,58 +98,58 @@ describe 'files' do
84
98
  end
85
99
 
86
100
  it 'includes the reconnect key' do
87
- stub!(:database_adapter).and_return('mysql2')
101
+ stub!(:database_yaml_adapter).and_return('mysql2')
88
102
  expect(read_template).to match(%r{reconnect: false})
89
103
  end
90
104
 
91
105
  it 'does not include the reconnect key' do
92
- stub!(:database_adapter).and_return('pg')
106
+ stub!(:database_yaml_adapter).and_return('postgresql')
93
107
  expect(read_template).to_not match(%r{reconnect:})
94
108
  end
95
109
 
96
110
  it 'includes the timeout key' do
97
- stub!(:database_adapter).and_return('sqlite3')
111
+ stub!(:database_yaml_adapter).and_return('sqlite3')
98
112
  expect(read_template).to match(%r{timeout: 5000})
99
113
  end
100
114
 
101
115
  it 'does not include the timeout key' do
102
- stub!(:database_adapter).and_return('pg')
116
+ stub!(:database_yaml_adapter).and_return('postgresql')
103
117
  expect(read_template).to_not match(%r{timeout:})
104
118
  end
105
119
 
106
120
  it 'has the username and password keys' do
107
- stub!(:database_adapter).and_return('pg')
121
+ stub!(:database_yaml_adapter).and_return('postgresql')
108
122
  [%r{username:}, %r{password:}].each do |key|
109
123
  expect(read_template).to match(key)
110
124
  end
111
125
  end
112
126
 
113
127
  it 'has no the username and password keys' do
114
- stub!(:database_adapter).and_return('sqlite3')
128
+ stub!(:database_yaml_adapter).and_return('sqlite3')
115
129
  [%r{username:}, %r{password:}].each do |key|
116
130
  expect(read_template).to_not match(key)
117
131
  end
118
132
  end
119
133
 
120
134
  it 'includes the socket key' do
121
- stub!(:database_adapter).and_return('mysql2')
135
+ stub!(:database_yaml_adapter).and_return('mysql2')
122
136
  expect(read_template).to match(%r{socket: /tmp/mysql.sock})
123
137
  end
124
138
 
125
139
  it 'does not include the socket key' do
126
- stub!(:database_adapter).and_return('pg')
140
+ stub!(:database_yaml_adapter).and_return('postgresql')
127
141
  expect(read_template).to_not match(%r{socket:})
128
142
  end
129
143
 
130
144
  it 'includes the sqlite databases' do
131
- stub!(:database_adapter).and_return('sqlite3')
145
+ stub!(:database_yaml_adapter).and_return('sqlite3')
132
146
  [%r{database: db/development.sqlite3}, %r{database: db/test.sqlite3}, %r{database: db/production.sqlite3}].each do |database_name|
133
147
  expect(read_template).to match(database_name)
134
148
  end
135
149
  end
136
150
 
137
151
  it 'includes the databases keys' do
138
- stub!(:database_adapter).and_return('pg')
152
+ stub!(:database_yaml_adapter).and_return('postgresql')
139
153
  @app_name = 'application_name'
140
154
  [%r{database: application_name_development}, %r{database: application_name_test}, %r{database: application_name}].each do |database_name|
141
155
  expect(read_template).to match(database_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_new
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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: 2012-12-21 00:00:00.000000000 Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  segments:
101
101
  - 0
102
- hash: 295243804331268507
102
+ hash: 2811988831036325912
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements:
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: 295243804331268507
111
+ hash: 2811988831036325912
112
112
  requirements: []
113
113
  rubyforge_project:
114
114
  rubygems_version: 1.8.24