Skip to content

Commit 2a63904

Browse files
committed
first release
1 parent 6d259b3 commit 2a63904

33 files changed

+789
-0
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
10+
# rspec failure tracking
11+
.rspec_status

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sudo: false
3+
language: ruby
4+
cache: bundler
5+
rvm:
6+
- 2.4.5
7+
before_install: gem install bundler -v 1.17.3

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4+
5+
# Specify your gem's dependencies in vue_cli-rails.gemspec
6+
gemspec
7+
8+
gem 'pry-byebug'

Gemfile.lock

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
PATH
2+
remote: .
3+
specs:
4+
vue_cli-rails (0.1.0)
5+
activesupport (>= 4.2)
6+
rack-proxy (>= 0.6)
7+
railties (>= 4.2)
8+
9+
GEM
10+
remote: https://rubygems.org/
11+
specs:
12+
actionpack (5.2.2)
13+
actionview (= 5.2.2)
14+
activesupport (= 5.2.2)
15+
rack (~> 2.0)
16+
rack-test (>= 0.6.3)
17+
rails-dom-testing (~> 2.0)
18+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
19+
actionview (5.2.2)
20+
activesupport (= 5.2.2)
21+
builder (~> 3.1)
22+
erubi (~> 1.4)
23+
rails-dom-testing (~> 2.0)
24+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
25+
activesupport (5.2.2)
26+
concurrent-ruby (~> 1.0, >= 1.0.2)
27+
i18n (>= 0.7, < 2)
28+
minitest (~> 5.1)
29+
tzinfo (~> 1.1)
30+
builder (3.2.3)
31+
byebug (11.0.0)
32+
coderay (1.1.2)
33+
concurrent-ruby (1.1.4)
34+
crass (1.0.4)
35+
diff-lcs (1.3)
36+
erubi (1.8.0)
37+
i18n (1.5.3)
38+
concurrent-ruby (~> 1.0)
39+
loofah (2.2.3)
40+
crass (~> 1.0.2)
41+
nokogiri (>= 1.5.9)
42+
method_source (0.9.2)
43+
mini_portile2 (2.4.0)
44+
minitest (5.11.3)
45+
nokogiri (1.10.1)
46+
mini_portile2 (~> 2.4.0)
47+
pry (0.12.2)
48+
coderay (~> 1.1.0)
49+
method_source (~> 0.9.0)
50+
pry-byebug (3.7.0)
51+
byebug (~> 11.0)
52+
pry (~> 0.10)
53+
rack (2.0.6)
54+
rack-proxy (0.6.5)
55+
rack
56+
rack-test (1.1.0)
57+
rack (>= 1.0, < 3)
58+
rails-dom-testing (2.0.3)
59+
activesupport (>= 4.2.0)
60+
nokogiri (>= 1.6)
61+
rails-html-sanitizer (1.0.4)
62+
loofah (~> 2.2, >= 2.2.2)
63+
railties (5.2.2)
64+
actionpack (= 5.2.2)
65+
activesupport (= 5.2.2)
66+
method_source
67+
rake (>= 0.8.7)
68+
thor (>= 0.19.0, < 2.0)
69+
rake (10.5.0)
70+
rspec (3.8.0)
71+
rspec-core (~> 3.8.0)
72+
rspec-expectations (~> 3.8.0)
73+
rspec-mocks (~> 3.8.0)
74+
rspec-core (3.8.0)
75+
rspec-support (~> 3.8.0)
76+
rspec-expectations (3.8.2)
77+
diff-lcs (>= 1.2.0, < 2.0)
78+
rspec-support (~> 3.8.0)
79+
rspec-mocks (3.8.0)
80+
diff-lcs (>= 1.2.0, < 2.0)
81+
rspec-support (~> 3.8.0)
82+
rspec-support (3.8.0)
83+
thor (0.20.3)
84+
thread_safe (0.3.6)
85+
tzinfo (1.2.5)
86+
thread_safe (~> 0.1)
87+
88+
PLATFORMS
89+
ruby
90+
91+
DEPENDENCIES
92+
bundler (~> 1.16)
93+
pry-byebug
94+
rake (~> 10.0)
95+
rspec (~> 3.0)
96+
vue_cli-rails!
97+
98+
BUNDLED WITH
99+
1.17.3

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# VueCli::Rails
2+
3+
Get `vue-cli` working on Rails
4+
5+
## Installation
6+
7+
Add this line to your Rails application's `Gemfile`:
8+
9+
```ruby
10+
gem 'vue_cli-rails'
11+
```
12+
13+
And then execute:
14+
15+
$ bundle install
16+
$ bundle exec rake vue:create
17+
18+
> Currently `rake vue:create` will overwrite all files, please be careful!
19+
20+
Add those lines to your `config/routes.rb`:
21+
22+
```ruby
23+
get 'vue/foo' => 'vue#foo'
24+
get 'vue/bar' => 'vue#bar'
25+
```
26+
27+
## Usage
28+
29+
This gem is fully depends on `vue-cli`. You can do everything with [`vue.config.js`](https://cli.vuejs.org/config/) just don't break `manifest` plugin which required by `vue_cli-rails`.
30+
31+
When you starting `rails server` with development mode, `vue-cli-service serve` will be running at the same time.
32+
33+
Please use `RAILS_ENV=production` to build your production assets. `NODE_ENV` will be ignored!
34+
35+
You can put `app/assets/vue/manifest.dev.json` into your VCS ignore list.
36+
37+
## Warning
38+
39+
Currently `vue.config.js` is reading configurations via `bundle exec rake vue:json_config`. You may suffer performance issue if your rake tasks are slow.

Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "bundler/gem_tasks"
2+
require "rspec/core/rake_task"
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
6+
task :default => :spec

bin/console

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env ruby
2+
3+
require "bundler/setup"
4+
require "vue_cli/rails"
5+
6+
# You can add fixtures and/or initialization code here to make experimenting
7+
# with your gem easier. You can also use a different console, if you like.
8+
9+
# (If you use this, don't forget to add pry to your Gemfile!)
10+
# require "pry"
11+
# Pry.start
12+
13+
require "pry"
14+
Pry.start(__FILE__)

bin/setup

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install
7+
8+
# Do any other automated setup that you need to do here
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div id="app">
3+
<slot></slot>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'App',
10+
};
11+
</script>
12+
13+
<style>
14+
#app {
15+
box-sizing: border-box;
16+
}
17+
18+
#app * {
19+
box-sizing: border-box;
20+
}
21+
</style>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Vue from 'vue';
2+
3+
import App from './App.vue';
4+
5+
Vue.config.productionTip = false;
6+
7+
export default Component => new Vue({
8+
render: h => h(App, { scopedSlots: { default: () => h(Component) } }),
9+
}).$mount('#app');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<div id="bar">
3+
<h1>Bar</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'Bar',
10+
};
11+
</script>
12+
13+
<style>
14+
#bar {
15+
color: blue;
16+
}
17+
</style>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<div id="foo">
3+
<h1>Foo</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'Foo',
10+
};
11+
</script>
12+
13+
<style>
14+
#foo {
15+
color: red
16+
}
17+
</style>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import launch from '~v-launcher';
2+
import Bar from '~views/Bar.vue';
3+
4+
launch(Bar);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import launch from '~v-launcher';
2+
import Foo from '~views/Foo.vue';
3+
4+
launch(Foo);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class VueController < ApplicationController
2+
layout 'vue'
3+
4+
def foo
5+
end
6+
7+
def bar
8+
end
9+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Vue</title>
5+
<%= csrf_meta_tags %>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<%= yield %>
10+
</body>
11+
</html>

lib/source/app/views/vue/bar.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= vue_entry('bar') %>

lib/source/app/views/vue/foo.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= vue_entry('foo') %>

0 commit comments

Comments
 (0)