rails_new 0.0.1 → 0.0.2
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/README.md +4 -10
- data/bin/rails_new +3 -4
- data/lib/rails_new/version.rb +1 -1
- data/template.rb +27 -13
- metadata +1 -1
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
|
1
|
+
## About
|
2
2
|
|
3
3
|
Customizable Rails template for Twitter Bootstrap, Devise and more!
|
4
4
|
|
5
|
-
|
5
|
+
### Required Rails version
|
6
6
|
|
7
|
-
|
7
|
+
3.2.9
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -12,16 +12,10 @@ Rails 3.2.9
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
rails_new project_name
|
15
|
+
rails_new project_name
|
16
16
|
|
17
17
|
After that, you'll answer some questions about what you want to use (Twitter Bootstrap, Devise, etc).
|
18
18
|
|
19
|
-
## Customization
|
20
|
-
|
21
|
-
You can also customize the default Rails options:
|
22
|
-
|
23
|
-
rails_new project_name -d mysql # check all options using `rails new --help`
|
24
|
-
|
25
19
|
## Contributing
|
26
20
|
|
27
21
|
1. Fork it
|
data/bin/rails_new
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
#
|
3
2
|
# rails_new
|
3
|
+
# https://github.com/lucascaton/rails_new
|
4
4
|
# Created by Lucas Caton at 2012, november 23
|
5
|
-
#
|
6
5
|
|
7
|
-
app_name =
|
8
|
-
system "rails new #{app_name} --skip-bundle --skip-test-unit -
|
6
|
+
app_name = ARGV.first
|
7
|
+
system "rails new #{app_name} --skip-bundle --skip-test-unit -m https://raw.github.com/lucascaton/rails_new/master/template.rb"
|
data/lib/rails_new/version.rb
CHANGED
data/template.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
def
|
1
|
+
def yes?(question)
|
2
2
|
answer = ask " \e[1m\e[32mpromp".rjust(10) + " \e[0m#{question} \e[33m(y/n)\e[0m"
|
3
3
|
case answer.downcase
|
4
4
|
when 'yes', 'y'
|
@@ -6,12 +6,13 @@ def yes_wizard?(question)
|
|
6
6
|
when 'no', 'n'
|
7
7
|
false
|
8
8
|
else
|
9
|
-
|
9
|
+
yes?(question)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
def prompt(question, options)
|
14
|
+
answer = ask(" \e[1m\e[32mpromp".rjust(10) + " \e[0m#{question} \e[33m[#{options[:default_answer]}]\e[0m").strip
|
15
|
+
answer.present? ? answer : options[:default_answer]
|
15
16
|
end
|
16
17
|
|
17
18
|
def rewrite_file(file_name, content)
|
@@ -19,6 +20,19 @@ def rewrite_file(file_name, content)
|
|
19
20
|
append_to_file(file_name, content)
|
20
21
|
end
|
21
22
|
|
23
|
+
def database_adapter
|
24
|
+
case @database
|
25
|
+
when 'postgresql', 'postgres', 'psql' then 'pg'
|
26
|
+
when 'mysql' then 'mysql2'
|
27
|
+
when 'sqlite' then 'sqlite3'
|
28
|
+
else @database
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
@database = prompt 'What database you want to use?', default_answer: 'postgresql'
|
34
|
+
@create_commits = true if yes?('Create first git commits?')
|
35
|
+
|
22
36
|
remove_file 'public/index.html'
|
23
37
|
remove_file 'app/assets/images/rails.png'
|
24
38
|
|
@@ -28,7 +42,7 @@ ruby '1.9.3'
|
|
28
42
|
|
29
43
|
gem 'haml-rails'
|
30
44
|
gem 'jquery-rails'
|
31
|
-
gem '
|
45
|
+
gem '#{database_adapter}'
|
32
46
|
gem 'rails', '3.2.9'
|
33
47
|
|
34
48
|
group :development do
|
@@ -117,14 +131,14 @@ if @create_commits
|
|
117
131
|
system "git commit -am 'Initial Rails directory structure'"
|
118
132
|
end
|
119
133
|
|
120
|
-
# if
|
134
|
+
# if yes?('Install and configure Twitter Bootstrap Rails gem?')
|
121
135
|
# end
|
122
136
|
#
|
123
|
-
# if
|
124
|
-
# end
|
125
|
-
#
|
126
|
-
# if yes_wizard?('Use brazilian portuguese locale (I18n)?')
|
127
|
-
# # Apagar config/locales/en.yml
|
128
|
-
# # Incluir config/locales*.pt-BR.yml
|
129
|
-
# # Atualizar config/application.rb
|
137
|
+
# if yes?('Install and configure Devise gem?')
|
130
138
|
# end
|
139
|
+
|
140
|
+
if yes?('Use brazilian portuguese locale (I18n)?')
|
141
|
+
remove_file 'config/locales/en.yml'
|
142
|
+
# Include config/locales*.pt-BR.yml files
|
143
|
+
# Update config/application.rb
|
144
|
+
end
|