rails_new 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -4
- data/README.md +1 -1
- data/bin/rails_new +2 -2
- data/lib/files/.gitignore.erb +54 -0
- data/lib/files/Gemfile.erb +31 -0
- data/lib/files/config/database.yml.erb +21 -0
- data/lib/rails_new/version.rb +1 -1
- data/lib/template.rb +46 -104
- data/rails_new.gemspec +2 -2
- metadata +14 -6
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.5)
|
5
5
|
rails (= 3.2.9)
|
6
6
|
|
7
7
|
GEM
|
@@ -46,7 +46,7 @@ GEM
|
|
46
46
|
mime-types (~> 1.16)
|
47
47
|
treetop (~> 1.4.8)
|
48
48
|
mime-types (1.19)
|
49
|
-
multi_json (1.
|
49
|
+
multi_json (1.5.0)
|
50
50
|
polyglot (0.3.3)
|
51
51
|
rack (1.4.1)
|
52
52
|
rack-cache (1.2)
|
@@ -70,10 +70,10 @@ GEM
|
|
70
70
|
rake (>= 0.8.7)
|
71
71
|
rdoc (~> 3.4)
|
72
72
|
thor (>= 0.14.6, < 2.0)
|
73
|
-
rake (10.0.
|
73
|
+
rake (10.0.3)
|
74
74
|
rdoc (3.12)
|
75
75
|
json (~> 1.4)
|
76
|
-
sprockets (2.2.
|
76
|
+
sprockets (2.2.2)
|
77
77
|
hike (~> 1.2)
|
78
78
|
multi_json (~> 1.0)
|
79
79
|
rack (~> 1.0)
|
data/README.md
CHANGED
data/bin/rails_new
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# rails_new
|
3
3
|
# https://github.com/lucascaton/rails_new
|
4
|
-
# Created by Lucas Caton at 2012,
|
4
|
+
# Created by Lucas Caton at 2012, November 23
|
5
5
|
|
6
6
|
app_name = ARGV.first
|
7
|
-
system "rails new #{app_name} --skip-bundle --skip-test-unit -m
|
7
|
+
system "rails new #{app_name} --skip-bundle --skip-test-unit -m #{File.expand_path('../../lib/template.rb', __FILE__)}"
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
<%- if database_adapter == 'sqlite3' %>
|
11
|
+
# Ignore the default SQLite database.
|
12
|
+
/db/*.sqlite3
|
13
|
+
<% end -%>
|
14
|
+
|
15
|
+
# Ignore all logfiles and tempfiles
|
16
|
+
/log/*.log
|
17
|
+
/tmp
|
18
|
+
|
19
|
+
# Ignore config files
|
20
|
+
/config/database.yml
|
21
|
+
|
22
|
+
# Ignore docs
|
23
|
+
/doc/api
|
24
|
+
/doc/app
|
25
|
+
|
26
|
+
# Ignore public sub-directories
|
27
|
+
/public/packages/*
|
28
|
+
/public/system/*
|
29
|
+
|
30
|
+
# Ignore files from text editors and IDEs
|
31
|
+
Session.vim
|
32
|
+
*.sw?
|
33
|
+
|
34
|
+
# Ignore files from Operating System
|
35
|
+
*~
|
36
|
+
.DS_Store
|
37
|
+
|
38
|
+
# Ignore files from Ctags
|
39
|
+
/tags
|
40
|
+
|
41
|
+
# Ignore files from RVM
|
42
|
+
/.rvmrc
|
43
|
+
|
44
|
+
# Ignore files from SASS
|
45
|
+
/.sass-cache/
|
46
|
+
|
47
|
+
# Ignore routes cache
|
48
|
+
/.routes
|
49
|
+
|
50
|
+
# Ignore simplecov files
|
51
|
+
coverage/
|
52
|
+
|
53
|
+
# Ignore other files
|
54
|
+
rails_best_practices_output.html
|
@@ -0,0 +1,31 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
ruby '1.9.3'
|
3
|
+
|
4
|
+
<%= @haml ? "gem 'haml-rails'" : '' %>
|
5
|
+
gem 'jquery-rails'
|
6
|
+
gem '<%= database_adapter %>'
|
7
|
+
gem 'rails', '3.2.9'
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem 'thin'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :development, :test do
|
14
|
+
gem 'pry'
|
15
|
+
gem 'awesome_print'
|
16
|
+
end
|
17
|
+
|
18
|
+
group :test do
|
19
|
+
gem 'capybara'
|
20
|
+
gem 'factory_girl_rails'
|
21
|
+
gem 'forgery'
|
22
|
+
gem 'poltergeist'
|
23
|
+
gem 'rspec-rails'
|
24
|
+
gem 'simplecov', require: false
|
25
|
+
end
|
26
|
+
|
27
|
+
group :assets do
|
28
|
+
# gem 'sass-rails', '~> 3.2.3'
|
29
|
+
gem 'coffee-rails', '~> 3.2.1'
|
30
|
+
gem 'uglifier', '>= 1.0.3'
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
adapter: <%= database_adapter %>
|
3
|
+
<%= database_encoding ? "encoding: #{database_encoding}" : '' %>
|
4
|
+
<%= database_adapter == 'mysql2' ? 'reconnect: false' : '' %>
|
5
|
+
pool: 5
|
6
|
+
<%= database_adapter == 'sqlite3' ? 'timeout: 5000' : '' %>
|
7
|
+
username:
|
8
|
+
password:
|
9
|
+
<%= database_adapter == 'mysql2' ? 'socket: /tmp/mysql.sock' : '' %>
|
10
|
+
|
11
|
+
development:
|
12
|
+
<<: *defaults
|
13
|
+
<%= database_adapter == 'sqlite3' ? 'database: db/development.sqlite3' : "database: #{@app_name}_development" %>
|
14
|
+
|
15
|
+
test:
|
16
|
+
<<: *defaults
|
17
|
+
<%= database_adapter == 'sqlite3' ? 'database: db/test.sqlite3' : "database: #{@app_name}_test" %>
|
18
|
+
|
19
|
+
production:
|
20
|
+
<<: *defaults
|
21
|
+
<%= database_adapter == 'sqlite3' ? 'database: db/production.sqlite3' : "database: #{@app_name}" %>
|
data/lib/rails_new/version.rb
CHANGED
data/lib/template.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
def yes?(question)
|
2
|
+
return true unless @customized
|
3
|
+
|
2
4
|
answer = ask " \e[1m\e[32mpromp".rjust(10) + " \e[0m#{question} \e[33m(y/n)\e[0m"
|
3
5
|
case answer.downcase
|
4
|
-
when 'yes', 'y'
|
5
|
-
|
6
|
-
|
7
|
-
false
|
8
|
-
else
|
9
|
-
yes?(question)
|
6
|
+
when 'yes', 'y' then true
|
7
|
+
when 'no', 'n' then false
|
8
|
+
else yes?(question)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
@@ -15,9 +14,19 @@ def prompt(question, options)
|
|
15
14
|
answer.present? ? answer : options[:default_answer]
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
17
|
+
def apply_template(file)
|
18
|
+
# template "files/#{file}.erb", file, force: true
|
19
|
+
template "#{File.dirname(__FILE__)}/files/#{file}.erb", file, force: true
|
20
|
+
# first sed: remove duplicated empty lines
|
21
|
+
# second sed: remove lines with whitespaces
|
22
|
+
system "cat #{file} | sed '/^$/N;/^\\n$/D' | sed '/^ *$/d' > sed_output"
|
23
|
+
system "mv sed_output #{file}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def commit(description)
|
27
|
+
system 'git add .'
|
28
|
+
system 'git add --update .'
|
29
|
+
system "git commit -am '#{description}'"
|
21
30
|
end
|
22
31
|
|
23
32
|
def database_adapter
|
@@ -25,120 +34,53 @@ def database_adapter
|
|
25
34
|
when 'postgresql', 'postgres', 'psql' then 'pg'
|
26
35
|
when 'mysql' then 'mysql2'
|
27
36
|
when 'sqlite' then 'sqlite3'
|
37
|
+
when 'mongo', 'mongodb' then 'mongoid'
|
28
38
|
else @database
|
29
39
|
end
|
30
40
|
end
|
31
41
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
remove_file 'app/assets/images/rails.png'
|
38
|
-
|
39
|
-
rewrite_file 'Gemfile', %Q(
|
40
|
-
source 'https://rubygems.org'
|
41
|
-
ruby '1.9.3'
|
42
|
-
|
43
|
-
gem 'haml-rails'
|
44
|
-
gem 'jquery-rails'
|
45
|
-
gem '#{database_adapter}'
|
46
|
-
gem 'rails', '3.2.9'
|
47
|
-
|
48
|
-
group :development do
|
49
|
-
gem 'thin'
|
50
|
-
end
|
51
|
-
|
52
|
-
group :development, :test do
|
53
|
-
gem 'pry'
|
54
|
-
gem 'awesome_print'
|
55
|
-
end
|
56
|
-
|
57
|
-
group :test do
|
58
|
-
gem 'capybara'
|
59
|
-
gem 'database_cleaner'
|
60
|
-
gem 'factory_girl_rails'
|
61
|
-
gem 'forgery'
|
62
|
-
gem 'poltergeist'
|
63
|
-
gem 'rspec-rails'
|
64
|
-
gem 'simplecov', require: false
|
65
|
-
end
|
66
|
-
|
67
|
-
group :assets do
|
68
|
-
gem 'sass-rails', '~> 3.2.3'
|
69
|
-
gem 'coffee-rails', '~> 3.2.1'
|
70
|
-
gem 'uglifier', '>= 1.0.3'
|
42
|
+
def database_encoding
|
43
|
+
case database_adapter
|
44
|
+
when 'pg' then 'unicode'
|
45
|
+
when 'mysql1' then 'utf8'
|
46
|
+
end
|
71
47
|
end
|
72
|
-
).strip
|
73
|
-
|
74
|
-
rewrite_file '.gitignore', %Q(
|
75
|
-
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
76
|
-
#
|
77
|
-
# If you find yourself ignoring temporary files generated by your text editor
|
78
|
-
# or operating system, you probably want to add a global ignore instead:
|
79
|
-
# git config --global core.excludesfile ~/.gitignore_global
|
80
|
-
|
81
|
-
# Ignore bundler config
|
82
|
-
/.bundle
|
83
|
-
|
84
|
-
# Ignore all logfiles and tempfiles
|
85
|
-
/log/*.log
|
86
|
-
/tmp
|
87
|
-
|
88
|
-
# Ignore config files
|
89
|
-
/config/database.yml
|
90
|
-
|
91
|
-
# Ignore docs
|
92
|
-
/doc/api
|
93
|
-
/doc/app
|
94
|
-
|
95
|
-
# Ignore public sub-directories
|
96
|
-
/public/packages/*
|
97
|
-
/public/system/*
|
98
48
|
|
99
|
-
# Ignore files from text editors and IDEs
|
100
|
-
Session.vim
|
101
|
-
*.sw?
|
102
49
|
|
103
|
-
|
104
|
-
|
105
|
-
.DS_Store
|
50
|
+
@app_name = `pwd`.gsub(/.*\/(.+)/, '\1').strip
|
51
|
+
@customized = true
|
106
52
|
|
107
|
-
|
108
|
-
|
53
|
+
@database = prompt 'What database you want to use?', default_answer: 'postgresql'
|
54
|
+
@customized = yes? 'Would you like to customize the template options?'
|
55
|
+
@create_commits = yes? 'Create first git commits?'
|
56
|
+
# @static_pages = yes? 'Create static pages?'
|
57
|
+
# @haml = yes? 'Use HAML?'
|
58
|
+
@pt_br_locales = yes? 'Use brazilian portuguese locale (I18n)?'
|
59
|
+
# @twitter_bootstrap = yes? 'Install and configure Twitter Bootstrap Rails gem?'
|
60
|
+
# @devise = yes? 'Install and configure Devise gem?'
|
109
61
|
|
110
|
-
# Ignore files from RVM
|
111
|
-
/.rvmrc
|
112
62
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
# Ignore routes cache
|
117
|
-
/.routes
|
118
|
-
|
119
|
-
# Ignore simplecov files
|
120
|
-
coverage/
|
63
|
+
remove_file 'public/index.html'
|
64
|
+
remove_file 'app/assets/images/rails.png'
|
121
65
|
|
122
|
-
|
123
|
-
|
124
|
-
|
66
|
+
apply_template 'Gemfile'
|
67
|
+
apply_template '.gitignore'
|
68
|
+
apply_template 'config/database.yml'
|
125
69
|
|
126
70
|
system 'bundle install'
|
127
71
|
|
128
72
|
if @create_commits
|
129
73
|
system 'git init'
|
130
|
-
|
131
|
-
system "git commit -am 'Initial Rails directory structure'"
|
74
|
+
commit 'Initial Rails directory structure'
|
132
75
|
end
|
133
76
|
|
134
|
-
|
135
|
-
# end
|
136
|
-
#
|
137
|
-
# if yes?('Install and configure Devise gem?')
|
138
|
-
# end
|
139
|
-
|
140
|
-
if yes?('Use brazilian portuguese locale (I18n)?')
|
77
|
+
if @pt_br_locales
|
141
78
|
remove_file 'config/locales/en.yml'
|
142
79
|
# Include config/locales*.pt-BR.yml files
|
143
80
|
# Update config/application.rb
|
81
|
+
commit 'Including pt-br locales' if @create_commits
|
144
82
|
end
|
83
|
+
|
84
|
+
# route "map.root :controller => 'people'"
|
85
|
+
# rake 'db:migrate'
|
86
|
+
# rake 'twitter boostrap rake tasks...'
|
data/rails_new.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = RailsNew::VERSION
|
9
9
|
gem.authors = ['Lucas Caton']
|
10
10
|
gem.email = ['lucascaton@gmail.com']
|
11
|
-
gem.description = %q{Customizable Rails template with Twitter Bootstrap, Devise and more!}
|
12
|
-
gem.summary = %q{Customizable Rails template with Twitter Bootstrap, Devise and more!}
|
11
|
+
gem.description = %q{Bootstrap for Rails projects - Customizable Rails template with Twitter Bootstrap, Devise and more!}
|
12
|
+
gem.summary = %q{Bootstrap for Rails projects - Customizable Rails template with Twitter Bootstrap, Devise and more!}
|
13
13
|
gem.homepage = 'https://github.com/lucascaton/rails_new'
|
14
14
|
|
15
15
|
gem.add_dependency 'rails', '3.2.9'
|
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.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: 2012-
|
12
|
+
date: 2012-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -27,7 +27,8 @@ dependencies:
|
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.2.9
|
30
|
-
description: Customizable Rails template with Twitter
|
30
|
+
description: Bootstrap for Rails projects - Customizable Rails template with Twitter
|
31
|
+
Bootstrap, Devise and more!
|
31
32
|
email:
|
32
33
|
- lucascaton@gmail.com
|
33
34
|
executables:
|
@@ -48,6 +49,12 @@ files:
|
|
48
49
|
UmFrZWZpbGU=
|
49
50
|
- !binary |-
|
50
51
|
YmluL3JhaWxzX25ldw==
|
52
|
+
- !binary |-
|
53
|
+
bGliL2ZpbGVzLy5naXRpZ25vcmUuZXJi
|
54
|
+
- !binary |-
|
55
|
+
bGliL2ZpbGVzL0dlbWZpbGUuZXJi
|
56
|
+
- !binary |-
|
57
|
+
bGliL2ZpbGVzL2NvbmZpZy9kYXRhYmFzZS55bWwuZXJi
|
51
58
|
- !binary |-
|
52
59
|
bGliL3JhaWxzX25ldy92ZXJzaW9uLnJi
|
53
60
|
- !binary |-
|
@@ -68,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
75
|
version: '0'
|
69
76
|
segments:
|
70
77
|
- 0
|
71
|
-
hash:
|
78
|
+
hash: 4240153038540612432
|
72
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
80
|
none: false
|
74
81
|
requirements:
|
@@ -77,11 +84,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
84
|
version: '0'
|
78
85
|
segments:
|
79
86
|
- 0
|
80
|
-
hash:
|
87
|
+
hash: 4240153038540612432
|
81
88
|
requirements: []
|
82
89
|
rubyforge_project:
|
83
90
|
rubygems_version: 1.8.24
|
84
91
|
signing_key:
|
85
92
|
specification_version: 3
|
86
|
-
summary: Customizable Rails template with Twitter Bootstrap,
|
93
|
+
summary: Bootstrap for Rails projects - Customizable Rails template with Twitter Bootstrap,
|
94
|
+
Devise and more!
|
87
95
|
test_files: []
|