Skip to content

Commit

Permalink
添加 jdbc-sqlite3 支持,清理配置文件中不合理的地方,补充部分gem
Browse files Browse the repository at this point in the history
  • Loading branch information
fsword committed Mar 3, 2011
1 parent 974dca4 commit 4715cfd
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions jruby_template1.rb
Expand Up @@ -73,7 +73,7 @@
=end
#FIXME code not work, temp fix
run 'rm .gitignore'
get "https://gist.github.com/822048.txt", ".gitignore"
get "https://github.com/fsword/rails_templates/raw/master/resource/gitignore", ".gitignore"
# to remain log/ tmp/ in git
run 'touch log/.gitignore tmp/.gitignore'

Expand All @@ -85,6 +85,7 @@
# Remove unneeded files
#----------------------------------------------------------------------------
say("removing unneeded files...", :yellow)

run 'cp config/database.yml config/default.database.yml'
run 'rm public/index.html'
run 'rm public/favicon.ico'
Expand All @@ -101,6 +102,10 @@
#----------------------------------------------------------------------------
say "setting up the Gemfile...", :yellow

gem 'bouncy-castle-java'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'rubyzip2'

gem 'by_star'
gem 'meta_where'
gem 'meta_search'
Expand All @@ -119,7 +124,7 @@

gem 'rails_config'

# gem 'unicorn'
#gem 'unicorn'
#gem 'thin'

#gem 'capistrano'
Expand Down Expand Up @@ -166,6 +171,21 @@
end


# before bundle install, change sqlite3 db connection to jdbc-sqlite3
database_configs = File.readlines 'config/database.yml'
File.open('config/database.yml','w'){|f|
database_configs.each{|line|
f.write(line.sub /adapter:\ sqlite3/, 'adapter: jdbcsqlite3')
}
}

gem_configs = File.readlines 'Gemfile'
File.open('Gemfile','w'){|f|
gem_configs.each{|line|
f.write(line.sub /gem\ 'sqlite3'/, "gem 'jdbc-sqlite3'")
}
}

# Install gems
say("installing gems (takes a few minutes!)...", :yellow)
run 'bundle install'
Expand Down

0 comments on commit 4715cfd

Please sign in to comment.