rails_new 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/Gemfile.lock +11 -1
- data/lib/files/.gitignore.erb +2 -2
- data/lib/files/Gemfile.erb +4 -1
- data/lib/files/config/database.yml.erb +14 -4
- data/lib/rails_new/version.rb +1 -1
- data/lib/template.rb +2 -5
- data/rails_new.gemspec +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/support/macros.rb +4 -0
- data/spec/templates/files_spec.rb +145 -0
- metadata +35 -5
data/.rspec
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails_new (0.0.
|
4
|
+
rails_new (0.0.7)
|
5
5
|
rails (= 3.2.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -36,6 +36,7 @@ GEM
|
|
36
36
|
multi_json (~> 1.0)
|
37
37
|
arel (3.0.2)
|
38
38
|
builder (3.0.4)
|
39
|
+
diff-lcs (1.1.3)
|
39
40
|
erubis (2.7.0)
|
40
41
|
hike (1.2.1)
|
41
42
|
i18n (0.6.1)
|
@@ -73,6 +74,14 @@ GEM
|
|
73
74
|
rake (10.0.3)
|
74
75
|
rdoc (3.12)
|
75
76
|
json (~> 1.4)
|
77
|
+
rspec (2.12.0)
|
78
|
+
rspec-core (~> 2.12.0)
|
79
|
+
rspec-expectations (~> 2.12.0)
|
80
|
+
rspec-mocks (~> 2.12.0)
|
81
|
+
rspec-core (2.12.1)
|
82
|
+
rspec-expectations (2.12.0)
|
83
|
+
diff-lcs (~> 1.1.3)
|
84
|
+
rspec-mocks (2.12.0)
|
76
85
|
sprockets (2.2.2)
|
77
86
|
hike (~> 1.2)
|
78
87
|
multi_json (~> 1.0)
|
@@ -90,3 +99,4 @@ PLATFORMS
|
|
90
99
|
|
91
100
|
DEPENDENCIES
|
92
101
|
rails_new!
|
102
|
+
rspec
|
data/lib/files/.gitignore.erb
CHANGED
@@ -7,10 +7,10 @@
|
|
7
7
|
# Ignore bundler config
|
8
8
|
/.bundle
|
9
9
|
|
10
|
-
<%- if database_adapter == 'sqlite3'
|
10
|
+
<%- if database_adapter == 'sqlite3' -%>
|
11
11
|
# Ignore the default SQLite database.
|
12
12
|
/db/*.sqlite3
|
13
|
-
|
13
|
+
<%- end -%>
|
14
14
|
|
15
15
|
# Ignore all logfiles and tempfiles
|
16
16
|
/log/*.log
|
data/lib/files/Gemfile.erb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
ruby '1.9.3'
|
3
3
|
|
4
|
-
|
4
|
+
<%- if @haml -%>
|
5
|
+
gem 'haml-rails'
|
6
|
+
<%- end -%>
|
5
7
|
gem 'jquery-rails'
|
6
8
|
gem '<%= database_adapter %>'
|
7
9
|
gem 'rails', '3.2.9'
|
8
10
|
|
9
11
|
group :development do
|
12
|
+
gem 'better_errors'
|
10
13
|
gem 'thin'
|
11
14
|
end
|
12
15
|
|
@@ -1,12 +1,22 @@
|
|
1
1
|
defaults: &defaults
|
2
2
|
adapter: <%= database_adapter %>
|
3
|
-
|
4
|
-
|
3
|
+
<%- if database_encoding -%>
|
4
|
+
encoding: <%= database_encoding %>
|
5
|
+
<%- end -%>
|
6
|
+
<%- if database_adapter == 'mysql2' %>
|
7
|
+
reconnect: false
|
8
|
+
<%- end -%>
|
5
9
|
pool: 5
|
6
|
-
|
10
|
+
<%- if database_adapter == 'sqlite3' -%>
|
11
|
+
timeout: 5000
|
12
|
+
<%- end -%>
|
13
|
+
<%- if database_adapter != 'sqlite3' -%>
|
7
14
|
username:
|
8
15
|
password:
|
9
|
-
|
16
|
+
<%- end -%>
|
17
|
+
<%- if database_adapter == 'mysql2' -%>
|
18
|
+
socket: /tmp/mysql.sock
|
19
|
+
<%- end -%>
|
10
20
|
|
11
21
|
development:
|
12
22
|
<<: *defaults
|
data/lib/rails_new/version.rb
CHANGED
data/lib/template.rb
CHANGED
@@ -15,11 +15,8 @@ def prompt(question, options)
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def apply_template(file)
|
18
|
-
# template "files/#{file}.erb", file, force: true
|
19
18
|
template "#{File.dirname(__FILE__)}/files/#{file}.erb", file, force: true
|
20
|
-
#
|
21
|
-
# second sed: remove lines with whitespaces
|
22
|
-
system "cat #{file} | sed '/^$/N;/^\\n$/D' | sed '/^ *$/d' > sed_output"
|
19
|
+
system "sed '/^$/N;/^\\n$/D' #{file} > sed_output" # remove duplicated empty lines
|
23
20
|
system "mv sed_output #{file}"
|
24
21
|
end
|
25
22
|
|
@@ -42,7 +39,7 @@ end
|
|
42
39
|
def database_encoding
|
43
40
|
case database_adapter
|
44
41
|
when 'pg' then 'unicode'
|
45
|
-
when '
|
42
|
+
when 'mysql2' then 'utf8'
|
46
43
|
end
|
47
44
|
end
|
48
45
|
|
data/rails_new.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.homepage = 'https://github.com/lucascaton/rails_new'
|
14
14
|
|
15
15
|
gem.add_dependency 'rails', '3.2.9'
|
16
|
-
|
16
|
+
gem.add_development_dependency 'rspec'
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($/)
|
19
19
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
describe 'files' do
|
5
|
+
describe 'Gemfile' do
|
6
|
+
before do
|
7
|
+
stub!(:database_adapter).and_return('pg')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'has the correct source' do
|
11
|
+
expect(read_template).to match(%r{source 'https://rubygems.org'})
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'has the correct Ruby version' do
|
15
|
+
expect(read_template).to match(%r{ruby '1.9.3'})
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'includes haml-rails gem' do
|
19
|
+
@haml = true
|
20
|
+
expect(read_template).to match(%r{gem 'haml-rails'})
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'does not include haml-rails gem' do
|
24
|
+
@haml = false
|
25
|
+
expect(read_template).to_not match(%r{gem 'haml-rails'})
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'includes database adapter gem' do
|
29
|
+
expect(read_template).to match(%r{gem 'pg'})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.gitignore' do
|
34
|
+
before do
|
35
|
+
stub!(:database_adapter)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'has the correct information' do
|
39
|
+
expect(read_template).to match(%r{# See http://help.github.com/ignore-files/ for more about ignoring files.})
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'includes sqlite3 files' do
|
43
|
+
stub!(:database_adapter).and_return('sqlite3')
|
44
|
+
expect(read_template).to match(%r{/db/\*.sqlite3})
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'does not include sqlite3 files' do
|
48
|
+
stub!(:database_adapter).and_return('pg')
|
49
|
+
expect(read_template).to_not match(%r{/db/\*.sqlite3})
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'config/database.yml' do
|
54
|
+
before do
|
55
|
+
stub!(:database_adapter)
|
56
|
+
stub!(:database_encoding)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'has the correct YAML groups' do
|
60
|
+
[%r{defaults: &defaults}, %r{development:}, %r{test:}, %r{production:}].each do |group|
|
61
|
+
expect(read_template).to match(group)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'has the default keys' do
|
66
|
+
[%r{pool: 5}].each do |key|
|
67
|
+
expect(read_template).to match(key)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'includes the database adapter key' do
|
72
|
+
stub!(:database_adapter).and_return('pg')
|
73
|
+
expect(read_template).to match(%r{adapter: pg})
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'includes the database encoding key' do
|
77
|
+
stub!(:database_encoding).and_return('utf8')
|
78
|
+
expect(read_template).to match(%r{encoding: utf8})
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'does not include the database encoding key' do
|
82
|
+
stub!(:database_encoding).and_return(nil)
|
83
|
+
expect(read_template).to_not match(%r{encoding:})
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'includes the reconnect key' do
|
87
|
+
stub!(:database_adapter).and_return('mysql2')
|
88
|
+
expect(read_template).to match(%r{reconnect: false})
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'does not include the reconnect key' do
|
92
|
+
stub!(:database_adapter).and_return('pg')
|
93
|
+
expect(read_template).to_not match(%r{reconnect:})
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'includes the timeout key' do
|
97
|
+
stub!(:database_adapter).and_return('sqlite3')
|
98
|
+
expect(read_template).to match(%r{timeout: 5000})
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'does not include the timeout key' do
|
102
|
+
stub!(:database_adapter).and_return('pg')
|
103
|
+
expect(read_template).to_not match(%r{timeout:})
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'has the username and password keys' do
|
107
|
+
stub!(:database_adapter).and_return('pg')
|
108
|
+
[%r{username:}, %r{password:}].each do |key|
|
109
|
+
expect(read_template).to match(key)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'has no the username and password keys' do
|
114
|
+
stub!(:database_adapter).and_return('sqlite3')
|
115
|
+
[%r{username:}, %r{password:}].each do |key|
|
116
|
+
expect(read_template).to_not match(key)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'includes the socket key' do
|
121
|
+
stub!(:database_adapter).and_return('mysql2')
|
122
|
+
expect(read_template).to match(%r{socket: /tmp/mysql.sock})
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'does not include the socket key' do
|
126
|
+
stub!(:database_adapter).and_return('pg')
|
127
|
+
expect(read_template).to_not match(%r{socket:})
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'includes the sqlite databases' do
|
131
|
+
stub!(:database_adapter).and_return('sqlite3')
|
132
|
+
[%r{database: db/development.sqlite3}, %r{database: db/test.sqlite3}, %r{database: db/production.sqlite3}].each do |database_name|
|
133
|
+
expect(read_template).to match(database_name)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'includes the databases keys' do
|
138
|
+
stub!(:database_adapter).and_return('pg')
|
139
|
+
@app_name = 'application_name'
|
140
|
+
[%r{database: application_name_development}, %r{database: application_name_test}, %r{database: application_name}].each do |database_name|
|
141
|
+
expect(read_template).to match(database_name)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
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.
|
4
|
+
version: 0.0.7
|
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-
|
12
|
+
date: 2012-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.2.9
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
description: Bootstrap for Rails projects - Customizable Rails template with Twitter
|
31
47
|
Bootstrap, Devise and more!
|
32
48
|
email:
|
@@ -39,6 +55,8 @@ extra_rdoc_files: []
|
|
39
55
|
files:
|
40
56
|
- !binary |-
|
41
57
|
LmdpdGlnbm9yZQ==
|
58
|
+
- !binary |-
|
59
|
+
LnJzcGVj
|
42
60
|
- !binary |-
|
43
61
|
R2VtZmlsZQ==
|
44
62
|
- !binary |-
|
@@ -61,6 +79,12 @@ files:
|
|
61
79
|
bGliL3RlbXBsYXRlLnJi
|
62
80
|
- !binary |-
|
63
81
|
cmFpbHNfbmV3LmdlbXNwZWM=
|
82
|
+
- !binary |-
|
83
|
+
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
84
|
+
- !binary |-
|
85
|
+
c3BlYy9zdXBwb3J0L21hY3Jvcy5yYg==
|
86
|
+
- !binary |-
|
87
|
+
c3BlYy90ZW1wbGF0ZXMvZmlsZXNfc3BlYy5yYg==
|
64
88
|
homepage: https://github.com/lucascaton/rails_new
|
65
89
|
licenses: []
|
66
90
|
post_install_message:
|
@@ -75,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
99
|
version: '0'
|
76
100
|
segments:
|
77
101
|
- 0
|
78
|
-
hash:
|
102
|
+
hash: 295243804331268507
|
79
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
104
|
none: false
|
81
105
|
requirements:
|
@@ -84,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
108
|
version: '0'
|
85
109
|
segments:
|
86
110
|
- 0
|
87
|
-
hash:
|
111
|
+
hash: 295243804331268507
|
88
112
|
requirements: []
|
89
113
|
rubyforge_project:
|
90
114
|
rubygems_version: 1.8.24
|
@@ -92,4 +116,10 @@ signing_key:
|
|
92
116
|
specification_version: 3
|
93
117
|
summary: Bootstrap for Rails projects - Customizable Rails template with Twitter Bootstrap,
|
94
118
|
Devise and more!
|
95
|
-
test_files:
|
119
|
+
test_files:
|
120
|
+
- !binary |-
|
121
|
+
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
122
|
+
- !binary |-
|
123
|
+
c3BlYy9zdXBwb3J0L21hY3Jvcy5yYg==
|
124
|
+
- !binary |-
|
125
|
+
c3BlYy90ZW1wbGF0ZXMvZmlsZXNfc3BlYy5yYg==
|