vue 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d32b30b1f2abec8e5f6ad2ae9f554e9317f52b345dc24a83e16607c4d51c1a7c
4
- data.tar.gz: 414f3d67ae2a860ebf23983188e6273a8f646fd2970f16a86c228472cf1292cc
3
+ metadata.gz: 22b1d148ac59ff7d62b9708e9e23de1457ae8b4edde705aa22f970e6042d0bf3
4
+ data.tar.gz: 4e82e991d58f54e1cc3fb4001b33f3f60dbbac51f8ee8f4be094cb777ed14583
5
5
  SHA512:
6
- metadata.gz: a6120c4d553d70ff66323ce3027fb498c6666a94f74762ac7bc911784ad5ae37b799540d68702b0d2bb10037db3f0a5999d09ca65af1387349812f1084051a83
7
- data.tar.gz: 8bc5cbd55af4cba7b8ef23a16e039deaf87f9a6afffd7e2087ef8c4700c6eb495f6f6565660813fb015b5da9ff97431ccc767f909253d6f331e3a4529a4ce027
6
+ metadata.gz: 49a8a8995bd33675f275de949e6d3221260895a2035d1c179c71ffe7b8610115a43bbe7027527ca12a3fadfd1dba0d2b63afb775f0ef700b586e1ee5e5c10d1a
7
+ data.tar.gz: 40833171a2ad137b335f6da469eaf67da6beb31d1e99ee53bd71137e70d9f11ba4794365b42c9cff51615bad4dd31841ad20b022a21152f32c557a2fdbb2011e
File without changes
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Vue
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vue`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This gem is a Vue integration for Rails Webpacker. Rails Sprockets integration is planned. Currently a lot of features are missing and it's not production-ready yet. It allows you to automatically generate Vue components and packs from command line, render your Vue components from either Rails view or controller, prerender components on server and pass props directly to them either for components pre-rendered on server or rendered on client with big degree of customization to fit your application conventions and development workflow.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,18 +20,65 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ To install run:
24
+
25
+ ```
26
+ rails g vue:install
27
+ ```
28
+
29
+ This will create an initializer file in `config/initializers/vue.rb` and initialize components folder. You will be able to customize generators there, no other configuration is available at the moment but is planned.
30
+
31
+ ### Generating component
32
+
33
+ ```
34
+ rails g vue:component ComponentName
35
+ ```
36
+
37
+ This will generate Vue component in `app/javascripts/components`, which you can customize however you want.
38
+
39
+ ### Server rendering support
26
40
 
27
- ## Development
41
+ For server rendering support you need to install `vue-server-renderer` npm package manually for now.
42
+
43
+ ```
44
+ yarn add vue-server-renderer
45
+ ```
28
46
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+ We're planning to automate that in future development releases.
30
48
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ ### Rendering Vue Component from Rails view
51
+
52
+ ```ruby
53
+ <%= vue_component('ComponentName', { message: 'Hello World' }, prerender: true) %>
54
+ ```
55
+
56
+ This will render your component in the view with server-side pre-rendering (`prerender: true` (default `false`)).
57
+
58
+ ## Rendering Vue Component from Rails controller
59
+
60
+ ```ruby
61
+ render vue_component: 'ComponentName', props: { message: 'Hello World' }, prerender: true
62
+ ```
63
+
64
+ This will render your component from controller with server-side pre-rendering, which defaults to false.
65
+
66
+ ## TODO
67
+ 1. Proper gem configuration through initializer.
68
+ 2. Integration with Rails Sprockets.
69
+ 3. Provide more options for rendering Vue components using custom provided helpers.
70
+ 4. Converting component names to different cases based on application conventions.
71
+ 5. Add support for older versions of Rails and Webpacker.
72
+ 6. ...
32
73
 
33
74
  ## Contributing
34
75
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vue.
76
+ Bug reports and pull requests are welcome on GitHub at https://github.com/codeblocs/vue. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
77
 
37
78
  ## License
38
79
 
39
80
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
81
+
82
+ ## Code of Conduct
83
+
84
+ Everyone interacting in the Vue project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/codeblocs/vue/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,124 @@
1
+ module Vue
2
+ module Generators
3
+ class ComponentGenerator < ::Rails::Generators::NamedBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ desc <<-DESC.strip_heredoc
7
+ Description:
8
+ Scaffold a Vue component into `components/` of your Webpacker source or asset pipeline.
9
+ The generated component will include a basic layout to help with development.
10
+
11
+ Examples:
12
+ rails g vue:component form
13
+ DESC
14
+
15
+ class_option :single_file_component,
16
+ type: :boolean,
17
+ default: true,
18
+ desc: 'Output single-file component'
19
+
20
+ class_option :styles_lang,
21
+ type: :string,
22
+ default: 'scss',
23
+ desc: 'Use custom css syntax, e.g. css, sass, scss'
24
+
25
+ class_option :styles_scoped,
26
+ type: :boolean,
27
+ default: true,
28
+ desc: 'Scope styles to generated component'
29
+
30
+ class_option :coffee,
31
+ type: :boolean,
32
+ default: false,
33
+ desc: 'Output coffeescript based component'
34
+
35
+ class_option :pack,
36
+ type: :boolean,
37
+ default: true,
38
+ desc: 'Generate pack for the component'
39
+
40
+ class_option :vuex,
41
+ type: :boolean,
42
+ default: false,
43
+ desc: 'Add vuex support for component pack'
44
+
45
+ def call
46
+ component_file_path = File.join(
47
+ component_target_dir,
48
+ "#{component_name}.vue"
49
+ )
50
+
51
+ template("component.vue", component_file_path)
52
+
53
+ if options[:pack]
54
+ pack_file_path = File.join(
55
+ pack_target_dir,
56
+ "#{file_name.dasherize}.js"
57
+ )
58
+
59
+ template("pack.js", pack_file_path)
60
+ end
61
+ end
62
+
63
+ private
64
+
65
+ def component_name
66
+ file_name.camelize
67
+ end
68
+
69
+ def webpacker?
70
+ defined?(Webpacker)
71
+ end
72
+
73
+ def webpack_config
74
+ if Webpacker.respond_to?(:config)
75
+ Webpacker.config
76
+ else
77
+ Webpacker::Configuration
78
+ end
79
+ end
80
+
81
+ def component_target_dir
82
+ if webpacker?
83
+ webpack_config.source_path
84
+ .join('components')
85
+ .relative_path_from(::Rails.root)
86
+ .to_s
87
+ else
88
+ 'app/assets/javascripts/components'
89
+ end
90
+ end
91
+
92
+ def pack_target_dir
93
+ if webpacker?
94
+ webpack_config.source_path
95
+ .join('packs')
96
+ .relative_path_from(::Rails.root)
97
+ .to_s
98
+ else
99
+ 'app/assets/javascripts/packs'
100
+ end
101
+ end
102
+
103
+ def file_extension
104
+ 'vue'
105
+ end
106
+
107
+ def styles_lang
108
+ options[:styles_lang] || vue_configuration.generators.styles.lang
109
+ end
110
+
111
+ def styles_scoped
112
+ options[:styles_scope] || vue_configuration.generators.styles.scoped
113
+ end
114
+
115
+ def pack
116
+ options[:pack] || vue_configuration.generators.packs
117
+ end
118
+
119
+ def vue_configuration
120
+ ::Vue.configuration
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,101 @@
1
+ module Vue
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ desc 'Initialize Vue gem in Rails application'
7
+
8
+ class_option :skip_git,
9
+ type: :boolean,
10
+ aliases: '-g',
11
+ default: false,
12
+ desc: 'Skip Git keeps'
13
+
14
+ class_option :skip_server_rendering,
15
+ type: :boolean,
16
+ default: true,
17
+ desc: 'Don\'t generate files required for server rendering'
18
+
19
+ class_option :skip_vuex
20
+ type: :boolean,
21
+ default: false,
22
+ desc: 'Don\'t generate vuex store files'
23
+
24
+ def create_components_dir
25
+ empty_directory File.join(components_dir, 'components')
26
+
27
+ unless options[:skip_git]
28
+ create_file File.join(components_dir, 'components/.gitkeep')
29
+ end
30
+ end
31
+
32
+ def create_server_rendering_file
33
+ unless options[:skip_server_rendering]
34
+ server_rendering_path = File.join(components_dir, 'packs')
35
+
36
+ template('server_rendering.js', server_rendering_path)
37
+ end
38
+ end
39
+
40
+ def create_stores_dir
41
+ empty_directory File.join(components_dir, 'stores')
42
+
43
+ unless options[:skip_git]
44
+ create_file File.join(components_dir, 'stores/.gitkeep')
45
+ end
46
+ end
47
+
48
+ def create_vue_initializer
49
+ initializer_path = 'config/initializers/vue.rb'
50
+
51
+ template('vue.rb', initializer_path)
52
+ end
53
+
54
+ def setup_vue
55
+ if webpacker?
56
+ setup_vue_webpacker
57
+ else
58
+ setup_vue_sprockets
59
+ end
60
+ end
61
+
62
+ private
63
+
64
+ def setup_vue_webpacker
65
+
66
+ end
67
+
68
+ def setup_vue_sprockets
69
+
70
+ end
71
+
72
+ def webpacker?
73
+ defined?(Webpacker)
74
+ end
75
+
76
+ def webpack_source_path
77
+ if Webpacker.respond_to?(:config)
78
+ Webpacker.config.source_entry_path
79
+ else
80
+ Webpacker::Configuration.source_path.join(Webpacker::Configuration.entry_path)
81
+ end
82
+ end
83
+
84
+ def javascript_dir
85
+ if webpacker?
86
+ webpack_source_path.relative_path_from(::Rails.root).to_s
87
+ else
88
+ 'app/assets/javascripts'
89
+ end
90
+ end
91
+
92
+ def components_dir
93
+ if webpacker?
94
+ Pathname.new(javascript_dir).parent.to_s
95
+ else
96
+ javascript_dir
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,27 @@
1
+ <template>
2
+
3
+ </template>
4
+
5
+ <script>
6
+ import Vue from 'vue'
7
+
8
+ export default {
9
+ name: '<%= component_name %>',
10
+
11
+ props: [],
12
+
13
+ data () {
14
+ return {
15
+
16
+ }
17
+ },
18
+
19
+ methods: {
20
+
21
+ }
22
+ }
23
+ </script>
24
+
25
+ <style lang="<%= styles_lang %>">
26
+
27
+ </style>
@@ -0,0 +1,11 @@
1
+ import Vue from 'vue'
2
+ import <%= component_name %> from 'components/<%= component_name %>'
3
+
4
+ document.addEventListener('DOMContentLoaded', () => {
5
+ const node = document.getElementsByTagName('<%= file_name.dasherize %>')[0]
6
+ const props = JSON.parse(node.getAttribute('data-props'))
7
+
8
+ new Vue({
9
+ render: h => h(<%= component_name %>, { props })
10
+ }).$mount(node)
11
+ })
@@ -0,0 +1,13 @@
1
+ Vue.configure do |config|
2
+ # Set default styles syntax for generators
3
+ # Available options: :css, :scss, :sass
4
+ # config.generators.styles.syntax = :scss
5
+
6
+ # Generate scoped styles for components
7
+ # Available options: true, false
8
+ # config.generators.styles.scoped = true
9
+
10
+ # Generate pack file for components
11
+ # Available options: true, false
12
+ # config.generators.pack = true
13
+ end
data/lib/vue.rb CHANGED
@@ -1,10 +1,7 @@
1
- # frozen_string_literal: true
2
-
1
+ require 'vue/configuration'
2
+ require 'vue/controller_helper'
3
3
  require 'vue/version'
4
- require 'vue/base_renderer'
5
- require 'vue/bundle_renderer'
4
+ require 'vue/railtie'
5
+ require 'vue/view_helper'
6
+ require 'vue/controller_renderer'
6
7
  require 'vue/server_renderer'
7
-
8
- module Vue
9
-
10
- end
@@ -0,0 +1,45 @@
1
+ module Vue
2
+ class << self
3
+ attr_accessor :configuration
4
+ end
5
+
6
+ def self.configure
7
+ yield configuration
8
+ end
9
+
10
+ def self.configuration
11
+ @configuration ||= Configuration.new
12
+ end
13
+
14
+ def self.configuration=(config)
15
+ @configuration = config
16
+ end
17
+
18
+ class Configuration
19
+ def initialize
20
+ @generators = Generators.new
21
+ end
22
+
23
+ def generators(&block)
24
+ if block_given?
25
+ @generators = Generators.new(&block)
26
+ else
27
+ @generators
28
+ end
29
+ end
30
+
31
+ class Generators
32
+ attr_accessor :styles, :syntax, :packs, :single_file_component
33
+
34
+ def initialize
35
+ @styles = ActiveSupport::OrderedOptions.new
36
+ @styles.lang = :scss
37
+ @styles.scoped = true
38
+ @syntax = :es2015
39
+ @packs = true
40
+ @single_file_component = true
41
+ yield self if block_given?
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,11 @@
1
+ module Vue
2
+ module ControllerHelper
3
+ extend ActiveSupport::Concern
4
+
5
+ class_methods do
6
+ def pack_tag_for(pack = nil)
7
+ before_action { @pack = pack.nil? ? params[:controller] : pack.to_s }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ module Vue
2
+ class ControllerRenderer
3
+ include Vue::ViewHelper
4
+ include ActionView::Helpers::TagHelper
5
+ include ActionView::Helpers::TextHelper
6
+
7
+ attr_accessor :output_buffer
8
+
9
+ def initialize(options = {})
10
+ controller = options[:controller]
11
+ end
12
+
13
+ def call(component_name, options, &block)
14
+ props = options.fetch(:props, {})
15
+ options = default_options.merge(options)
16
+
17
+ vue_component(component_name, props, options, &block)
18
+ end
19
+
20
+ private
21
+
22
+ def default_options
23
+ {
24
+ prerender: false
25
+ }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ require 'rails'
2
+
3
+ module Vue
4
+ class Railtie < ::Rails::Railtie
5
+ initializer 'vue.setup_controller_helpers', after: :load_config_initializers, group: :all do
6
+ ActiveSupport.on_load(:action_controller) do
7
+ include ::Vue::ControllerHelper
8
+ end
9
+ end
10
+
11
+ initializer 'vue.setup_view_helpers', after: :load_config_initializers, group: :all do
12
+ ActiveSupport.on_load(:action_view) do
13
+ include ::Vue::ViewHelper
14
+ end
15
+ end
16
+
17
+ initializer 'vue.add_component_renderer', group: :all do
18
+ ActionController::Renderers.add :vue_component do |component_name, options|
19
+ renderer = ::Vue::ControllerRenderer.new(controller: self)
20
+ html = renderer.call(component_name, options)
21
+ render_options = options.merge(inline: html)
22
+ render(render_options)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,7 +1,42 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Vue
4
- class ServerRenderer < BaseRenderer
2
+ class ServerRenderer
3
+ def initialize
4
+ vue_source = File.read(Rails.root.join('node_modules', 'vue', 'dist', 'vue.js'))
5
+ vue_renderer_source = File.read(Rails.root.join('node_modules', 'vue-server-renderer', 'basic.js'))
6
+ server_rendering_pack = File.read(Rails.root.join(File.join(Webpacker.config.public_path, Webpacker.manifest.lookup('server_rendering.js'))))
7
+
8
+ @context = ExecJS.compile(vue_source + vue_renderer_source + server_rendering_pack)
9
+ end
10
+
11
+ def render(component_name, props)
12
+ vue_component_string(component_name, props)
13
+ end
14
+
15
+ private
16
+
17
+ def vue_component_string(component_name, props)
18
+ js_string = <<-JS
19
+ (function () {
20
+ var component = new Vue({
21
+ render: h => {
22
+ console.log(h)
23
+ return h(#{component_name}, { attrs: { 'data-props': JSON.stringify(#{props.to_json}) }, props: #{props.to_json} })
24
+ }
25
+ })
26
+
27
+ var html = null
28
+
29
+ renderVueComponentToString(component, (err, res) => {
30
+ html = res
31
+ })
32
+
33
+ return html
34
+ })()
35
+ JS
5
36
 
37
+ @context.eval(js_string).html_safe
38
+ rescue ExecJS::ProgramError => e
39
+ Rails.logger.debug(e.message)
40
+ end
6
41
  end
7
42
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Vue
4
- VERSION = '0.1.0'
2
+ VERSION = "0.2.0"
5
3
  end
@@ -0,0 +1,20 @@
1
+ module Vue
2
+ module ViewHelper
3
+ def vue_component(component_name, props, options = {}, &block)
4
+ render_name = component_name.dasherize
5
+ render_props = props.transform_keys { |key| key.to_s.dasherize }
6
+
7
+ if options[:prerender]
8
+ renderer = ::Vue::ServerRenderer.new
9
+ renderer.render(render_name, render_props)
10
+ else
11
+ content_tag(
12
+ render_name,
13
+ 'data-props': render_props.to_json
14
+ ) do
15
+ yield if block_given?
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Preston
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-01 00:00:00.000000000 Z
11
+ date: 2018-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,48 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webpacker
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.5'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: execjs
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.4'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.4'
55
97
  description:
56
98
  email:
57
99
  - igorpreston@gmail.com
@@ -59,22 +101,23 @@ executables: []
59
101
  extensions: []
60
102
  extra_rdoc_files: []
61
103
  files:
62
- - ".gitignore"
63
- - ".rspec"
64
- - ".travis.yml"
65
- - Gemfile
66
- - LICENSE.txt
104
+ - LICENSE
67
105
  - README.md
68
- - Rakefile
69
- - bin/console
70
- - bin/setup
106
+ - lib/generators/vue/component_generator.rb
107
+ - lib/generators/vue/install_generator.rb
108
+ - lib/generators/vue/templates/component.vue
109
+ - lib/generators/vue/templates/pack.js
110
+ - lib/generators/vue/templates/server_rendering.js
111
+ - lib/generators/vue/templates/vue.rb
71
112
  - lib/vue.rb
72
- - lib/vue/base_renderer.rb
73
- - lib/vue/bundle_renderer.rb
113
+ - lib/vue/configuration.rb
114
+ - lib/vue/controller_helper.rb
115
+ - lib/vue/controller_renderer.rb
116
+ - lib/vue/railtie.rb
74
117
  - lib/vue/server_renderer.rb
75
118
  - lib/vue/version.rb
76
- - vue.gemspec
77
- homepage: https://rubygems.org/gems/vue
119
+ - lib/vue/view_helper.rb
120
+ homepage: https://github.com/codeblocs/vue
78
121
  licenses:
79
122
  - MIT
80
123
  metadata:
@@ -95,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
138
  version: '0'
96
139
  requirements: []
97
140
  rubyforge_project:
98
- rubygems_version: 2.7.3
141
+ rubygems_version: 2.7.6
99
142
  signing_key:
100
143
  specification_version: 4
101
- summary: Vue server-side rendering for Rails
144
+ summary: Vue gem for Rails
102
145
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
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
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
data/Gemfile DELETED
@@ -1,6 +0,0 @@
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.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "vue"
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 "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
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
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vue
4
- class BaseRenderer
5
- def self.render
6
- raise NoMethodError
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Vue
4
- class BundleRenderer < BaseRenderer
5
-
6
- end
7
- end
@@ -1,32 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "vue/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "vue"
7
- spec.version = Vue::VERSION
8
- spec.authors = ["Igor Preston"]
9
- spec.email = ["igorpreston@gmail.com"]
10
-
11
- spec.summary = "Vue server-side rendering for Rails"
12
- spec.homepage = "https://rubygems.org/gems/vue"
13
- spec.license = "MIT"
14
-
15
- if spec.respond_to?(:metadata)
16
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
- else
18
- raise "RubyGems 2.0 or newer is required to protect against " \
19
- "public gem pushes."
20
- end
21
-
22
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
- f.match(%r{^(test|spec|features)/})
24
- end
25
- spec.bindir = "exe"
26
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
- spec.require_paths = ["lib"]
28
-
29
- spec.add_development_dependency "bundler", "~> 1.16"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "rspec", "~> 3.0"
32
- end