Skip to content

Commit d85f317

Browse files
committedJun 11, 2019
App template rails new app -m https://vueonrails.com/vue` now points to vueonrails 1.x and webpacker 4 by default
To run webpacker 3, please run `rails new app -m https://vueonrails.com/vue3`
1 parent 77cee05 commit d85f317

File tree

2 files changed

+128
-2
lines changed

2 files changed

+128
-2
lines changed
 

‎vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
gem 'webpacker', '~> 3.x'
2-
gem 'vueonrails', '~> 0.x'
1+
gem 'webpacker', '>= 4.x'
2+
gem 'vueonrails', '~> 1.x'
33
route "mount Vueonrails::Engine, at: 'vue'"
44

55
# Use --bootstrap to add bootstrap style with jquery. Read more https://getbootstrap.com
@@ -61,6 +61,7 @@ rails_command 'db:create'
6161
rails_command 'db:migrate'
6262
rails_command 'webpacker:install'
6363
rails_command 'webpacker:install:vue'
64+
run "yarn add @rails/webpacker@next"
6465

6566
# Vue on Rails setup to install Vue dependencies, Vue component generators
6667
# Configuration and Jest dependencies. Read more http://github.com/vueonrails/vueonrails

‎vue3

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
gem 'webpacker', '~> 3.x'
2+
gem 'vueonrails', '~> 0.x'
3+
route "mount Vueonrails::Engine, at: 'vue'"
4+
5+
# Use --bootstrap to add bootstrap style with jquery. Read more https://getbootstrap.com
6+
# Read more about the full options of this application template, please go to github.com/vueonrails/vueonrails
7+
if ARGV.include? "--bootstrap"
8+
gem 'bootstrap', '~> 4.1.3'
9+
gem 'jquery-rails'
10+
end
11+
12+
# Use --foundation to add foundation style. Read more https://foundation.zurb.com
13+
# Read more about the full options of this application template, please go to github.com/vueonrails/vueonrails
14+
if ARGV.include? "--foundation"
15+
gem 'foundation-rails'
16+
gem 'autoprefixer-rails'
17+
end
18+
19+
# Add font-awesome fonts
20+
if ARGV.include? "--fontawesome"
21+
gem "font-awesome-rails"
22+
end
23+
24+
# Add live-reloading to refresh Rails view https://github.com/guard/guard-livereload
25+
if ARGV.include? "--livereload"
26+
gem_group :development do
27+
gem 'guard'
28+
gem 'guard-livereload', '~> 2.5', require: false
29+
end
30+
end
31+
32+
# Add whenever for automating cron jobs. Read more https://github.com/javan/whenever
33+
if ARGV.include? "--whenever"
34+
gem 'whenever', require: false
35+
end
36+
37+
# Use --devise to add Devise. Read more https://github.com/plataformatec/devise
38+
# Read more about the full options of this application template, please go to http://github.com/vueonrails/vueonrails
39+
if ARGV.include? "--devise"
40+
gem 'devise', '~> 4.4', '>= 4.4.3'
41+
end
42+
43+
# Use --admin to add Administrate as your administrative manager. Read more https://github.com/thoughtbot/administrate
44+
if ARGV.include? "--admin"
45+
gem 'administrate'
46+
end
47+
48+
# Use --sidekiq to add Sidekiq as your background processor. Read more https://github.com/mperham/sidekiq
49+
if ARGV.include? "--sidekiq"
50+
gem 'sidekiq'
51+
end
52+
53+
run 'bundle install'
54+
55+
unless ARGV.include? "--no-page"
56+
generate(:scaffold, 'page')
57+
route "root to: 'pages#index'"
58+
end
59+
60+
rails_command 'db:create'
61+
rails_command 'db:migrate'
62+
rails_command 'webpacker:install'
63+
rails_command 'webpacker:install:vue'
64+
65+
# Vue on Rails setup to install Vue dependencies, Vue component generators
66+
# Configuration and Jest dependencies. Read more http://github.com/vueonrails/vueonrails
67+
rails_command 'vue:setup'
68+
69+
# Gem setup after bundle install
70+
if ARGV.include? "--foundation"
71+
rails_command 'generate foundation:install'
72+
end
73+
74+
# Init livereload
75+
if ARGV.include? "--livereload"
76+
run "guard init livereload"
77+
end
78+
79+
# Finish the fontawesome setup
80+
if ARGV.include? "--fontawesome"
81+
fontawesome = <<-eos
82+
*= require font-awesome
83+
eos
84+
insert_into_file "app/assets/stylesheets/application.css",
85+
fontawesome, before: " *= require_self"
86+
end
87+
88+
# Finish the bootstrap setup
89+
if ARGV.include? "--bootstrap"
90+
run "mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss"
91+
92+
bootstrapcss = <<-eos
93+
@import "bootstrap";
94+
eos
95+
96+
insert_into_file "app/assets/stylesheets/application.scss",
97+
bootstrapcss, after: " */\n"
98+
99+
bootstrap = <<-eos
100+
//= require jquery3
101+
//= require bootstrap-sprockets
102+
eos
103+
104+
insert_into_file "app/assets/javascripts/application.js",
105+
bootstrap, before: "//= require_tree ."
106+
end
107+
108+
# Finish the administrate setup.
109+
if ARGV.include? "--admin"
110+
rails_command 'generate administrate:install'
111+
end
112+
113+
# Finish the whenever gem setup.
114+
if ARGV.include? "--whenever"
115+
run "wheneverize ."
116+
end
117+
118+
# Finish the devise installation.
119+
if ARGV.include? "--devise"
120+
rails_command "generate devise:install"
121+
end
122+
123+
# Generate your first git commit message.
124+
git add: "."
125+
git commit: %Q{ -m 'First commit' }

0 commit comments

Comments
 (0)
Please sign in to comment.