vue_cli-rails 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 0a44cb706df2f61b2e5101a4a9573404f02675c9
4
- data.tar.gz: a79ae21785870da2ccfed2d6d5a3531eb6e8d311
3
+ metadata.gz: 229220b60eb603bb590ec48c196daf668f226d2e
4
+ data.tar.gz: efbf67738dd8b19dcc324333db7a7c874af4dfb7
5
5
  SHA512:
6
- metadata.gz: 9818770c03f196e790c7958ae97275078132863e47c2984d8ae55b1015b2fb220856094a8a11d0d9eba23e6a0a1e70a54deec63d30aff022adbabe6d481281e4
7
- data.tar.gz: 490f5bc397ce60f69302a2272bcf516ecdcff0fa639c312d49ce3827bcc6481d930bdd2f10def1e1f21421608899572c8f9e9047eb8d06118640e4ccfcd62627
6
+ metadata.gz: 89a63db2149ee2708663ba361ad5501f6109f30b78a3e5e0411a1e1ba1b41de406eb65eb6a51e1a6ec38bfc3cb79b08c419bfabcdd104aef0998362cb2f2b200
7
+ data.tar.gz: dbd023aee57fcadb5ec46433dba84dbe451dda18acb72f60c6279159fc8267c27afe0815d330a72e3347e205407a2a99420a4fbfa30261d03c27ed9f90d4f573
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/.travis.yml CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/Gemfile.lock CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/source/vue.yml CHANGED
File without changes
data/lib/tasks/vue.rake CHANGED
@@ -36,6 +36,12 @@ namespace :vue do
36
36
  end
37
37
  puts "Using package manager: #{pm.package_manager}"
38
38
 
39
+ # install vue-cli
40
+ unless pm.vue?
41
+ puts "@vue/cli haven't been installed"
42
+ pm.global_add('@vue/cli')
43
+ end
44
+
39
45
  src_dir = Pathname.new(__FILE__).dirname.join('..', 'source')
40
46
  root = ::Rails.root
41
47
  FileUtils.chdir root
@@ -62,7 +68,7 @@ namespace :vue do
62
68
  if src.exist? && src.directory?
63
69
  puts 'Detected `src` folder (should be generated by vue-cli)'
64
70
  input = get_input.call(' Do you want to delete src folder?')
65
- FileUtils.rm_rf root.join('src') if input == 'y'
71
+ FileUtils.rm_rf src if input == 'y'
66
72
  end
67
73
 
68
74
  # 5. copy sample codes
@@ -109,6 +115,8 @@ namespace :vue do
109
115
  end
110
116
  end
111
117
  throw(StandardError, '') if pkgs.empty?
118
+
119
+ pm = VueCli::Rails::Configuration.instance.node_env
112
120
  pm.add "-D #{pkgs.join(' ')}"
113
121
  end
114
122
 
@@ -117,4 +125,10 @@ namespace :vue do
117
125
  config = VueCli::Rails::Configuration.new
118
126
  puts config.to_json
119
127
  end
128
+
129
+ desc 'Bundle assets for production'
130
+ task :compile => :environment do
131
+ pm = VueCli::Rails::Configuration.instance.node_env
132
+ pm.exec('vue-cli-service build', env: { 'RAILS_ENV' => 'production' })
133
+ end
120
134
  end
File without changes
data/lib/vue_cli/rails.rb CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -5,7 +5,7 @@ module VueCli
5
5
  @config ||= VueCli::Rails::Configuration.instance
6
6
 
7
7
  entry = (@config.manifest_data['entrypoints'] || {})[name]
8
- return nil if entry.blank?
8
+ return raise(VueCli::Rails::Error, "Not found vue entry point: #{name}") if entry.blank?
9
9
 
10
10
  assets = []
11
11
  (entry['css'] || []).each do |css|
@@ -28,7 +28,7 @@ module VueCli
28
28
  @pm
29
29
  end
30
30
 
31
- def exec(command, args = nil, extra = nil)
31
+ def exec(command, args = nil, extra = nil, env: {})
32
32
  cmd = COMMAND_LINE[command.to_sym] || {}
33
33
  if @pm == :yarn && cmd[:yarn]
34
34
  cmd = cmd[:yarn]
@@ -43,14 +43,18 @@ module VueCli
43
43
  cmd = "#{cmd} #{args}" if args.present?
44
44
  cmd = "#{cmd} #{@pm == :yarn ? '-- ' : ''}#{extra}" if extra.present?
45
45
  puts "run: #{cmd}"
46
- system(cmd)
46
+ system(env, cmd)
47
47
  end
48
48
 
49
49
  COMMAND_LINE = {
50
50
  add: {
51
51
  yarn: 'yarn add',
52
52
  npm: 'npm i -S',
53
- }
53
+ },
54
+ global_add: {
55
+ yarn: 'yarn global add',
56
+ npm: 'npm i -g'
57
+ },
54
58
  }.freeze
55
59
 
56
60
  def method_missing(cmd, *args)
@@ -62,7 +66,7 @@ module VueCli
62
66
  def get_version_of(bin)
63
67
  return @versions[bin] if @versions.key?(bin)
64
68
 
65
- r = `#{bin} --version`.strip.presence
69
+ r = `#{bin} --version`.strip.presence rescue nil
66
70
  @versions[bin] = r && r.start_with?('v') ? r[1..-1] : r
67
71
  @versions[bin]
68
72
  end
@@ -1,5 +1,5 @@
1
1
  module VueCli
2
2
  module Rails
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vue_cli-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-25 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport