Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
eGust committed Feb 24, 2019
1 parent 6d259b3 commit 2a63904
Show file tree
Hide file tree
Showing 33 changed files with 789 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 2.4.5
before_install: gem install bundler -v 1.17.3
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in vue_cli-rails.gemspec
gemspec

gem 'pry-byebug'
99 changes: 99 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
PATH
remote: .
specs:
vue_cli-rails (0.1.0)
activesupport (>= 4.2)
rack-proxy (>= 0.6)
railties (>= 4.2)

GEM
remote: https://rubygems.org/
specs:
actionpack (5.2.2)
actionview (= 5.2.2)
activesupport (= 5.2.2)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.2)
activesupport (= 5.2.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
builder (3.2.3)
byebug (11.0.0)
coderay (1.1.2)
concurrent-ruby (1.1.4)
crass (1.0.4)
diff-lcs (1.3)
erubi (1.8.0)
i18n (1.5.3)
concurrent-ruby (~> 1.0)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (0.9.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
rack (2.0.6)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.2)
actionpack (= 5.2.2)
activesupport (= 5.2.2)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (10.5.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
thor (0.20.3)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.16)
pry-byebug
rake (~> 10.0)
rspec (~> 3.0)
vue_cli-rails!

BUNDLED WITH
1.17.3
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# VueCli::Rails

Get `vue-cli` working on Rails

## Installation

Add this line to your Rails application's `Gemfile`:

```ruby
gem 'vue_cli-rails'
```

And then execute:

$ bundle install
$ bundle exec rake vue:create

> Currently `rake vue:create` will overwrite all files, please be careful!

Add those lines to your `config/routes.rb`:

```ruby
get 'vue/foo' => 'vue#foo'
get 'vue/bar' => 'vue#bar'
```

## Usage

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`.

When you starting `rails server` with development mode, `vue-cli-service serve` will be running at the same time.

Please use `RAILS_ENV=production` to build your production assets. `NODE_ENV` will be ignored!

You can put `app/assets/vue/manifest.dev.json` into your VCS ignore list.

## Warning

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.
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "vue_cli/rails"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "pry"
Pry.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
21 changes: 21 additions & 0 deletions lib/source/app/assets/vue/components/layouts/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<div id="app">
<slot></slot>
</div>
</template>

<script>
export default {
name: 'App',
};
</script>

<style>
#app {
box-sizing: border-box;
}
#app * {
box-sizing: border-box;
}
</style>
9 changes: 9 additions & 0 deletions lib/source/app/assets/vue/components/layouts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Vue from 'vue';

import App from './App.vue';

Vue.config.productionTip = false;

export default Component => new Vue({
render: h => h(App, { scopedSlots: { default: () => h(Component) } }),
}).$mount('#app');
17 changes: 17 additions & 0 deletions lib/source/app/assets/vue/components/views/Bar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div id="bar">
<h1>Bar</h1>
</div>
</template>

<script>
export default {
name: 'Bar',
};
</script>

<style>
#bar {
color: blue;
}
</style>
17 changes: 17 additions & 0 deletions lib/source/app/assets/vue/components/views/Foo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div id="foo">
<h1>Foo</h1>
</div>
</template>

<script>
export default {
name: 'Foo',
};
</script>

<style>
#foo {
color: red
}
</style>
4 changes: 4 additions & 0 deletions lib/source/app/assets/vue/views/bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import launch from '~v-launcher';
import Bar from '~views/Bar.vue';

launch(Bar);
4 changes: 4 additions & 0 deletions lib/source/app/assets/vue/views/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import launch from '~v-launcher';
import Foo from '~views/Foo.vue';

launch(Foo);
9 changes: 9 additions & 0 deletions lib/source/app/controllers/vue_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class VueController < ApplicationController
layout 'vue'

def foo
end

def bar
end
end
11 changes: 11 additions & 0 deletions lib/source/app/views/layouts/vue.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Vue</title>
<%= csrf_meta_tags %>
</head>
<body>
<div id="app"></div>
<%= yield %>
</body>
</html>
1 change: 1 addition & 0 deletions lib/source/app/views/vue/bar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= vue_entry('bar') %>
1 change: 1 addition & 0 deletions lib/source/app/views/vue/foo.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= vue_entry('foo') %>
Loading

0 comments on commit 2a63904

Please sign in to comment.