react_on_rails 6.0.0.beta.1 → 6.0.0.beta.2

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: eccbfc7edbe4d39c8b80673c50d25c2c3e21ab9c
4
- data.tar.gz: 2eb9f721f5b67a58e7d3c392614042c6a4a3b8c4
3
+ metadata.gz: bcc4a03b77263a8492274ed04f2aea8fedfdd151
4
+ data.tar.gz: 54179a432dfc85cc1f69387b9e69fc27a96e4058
5
5
  SHA512:
6
- metadata.gz: 55115761bd37dc567a886ed5092b4d7101f166d5ec2741c816f26e59248a979fb378373a0189c6cb0fb31c1be98d553b188ea2145bb6b30afc0c844a2ba178da
7
- data.tar.gz: b63c6519d7f9b75a8fa71ff7e73ff354ecc13afa6aa206952ff96719cd9736ea8e511137d48f96f98e558031ed89a0c0754fd5843a10459d08b889b85bd09a1d
6
+ metadata.gz: 2e74c3ee062e6766b5b9a0db851978dd38fc936ae99387deeb1ad2d93a8f43bdc95c7997e8d85ea277f0f17cd848bb6b611a4d58d50f0e6b6692529ed5b3cc43
7
+ data.tar.gz: 50fa6532ad2f6df651dfb8fed5d1f5b21dcea3fcb7619c3fe8f6ab24be2de31075165f76748f6a9ea1da8c005974542fa17d392d3e1cbb3abbc050f9b1a03511
@@ -3,7 +3,7 @@ sudo: required
3
3
  language: ruby
4
4
 
5
5
  rvm:
6
- - 2.2.4
6
+ - 2.3.0
7
7
 
8
8
  services:
9
9
  - docker
@@ -64,8 +64,7 @@ module ReactOnRails
64
64
  webpack_assets_status_checker ||=
65
65
  WebpackAssetsStatusChecker.new(client_dir: client_dir,
66
66
  generated_assets_dir: generated_assets_dir,
67
- webpack_generated_files: webpack_generated_files
68
- )
67
+ webpack_generated_files: webpack_generated_files)
69
68
 
70
69
  unless @printed_once
71
70
  puts
@@ -35,7 +35,7 @@ module ReactOnRails
35
35
  # Inform the developer that we're ensuring gen assets are ready.
36
36
  puts_start_compile_check_message(stale_gen_files)
37
37
 
38
- webpack_assets_compiler.compile_assets
38
+ webpack_assets_compiler.compile_asseta
39
39
  end
40
40
 
41
41
  def puts_start_compile_check_message(stale_files)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ReactOnRails
3
- VERSION = "6.0.0.beta.1".freeze
3
+ VERSION = "6.0.0.beta.2".freeze
4
4
  end
@@ -21,10 +21,9 @@ end
21
21
 
22
22
  namespace :react_on_rails do
23
23
  namespace :assets do
24
-
25
- if ReactOnRails.configuration.symlink_non_digested_assets_regex
26
- desc "Creates non-digested symlinks for the assets in the public asset dir"
27
- task symlink_non_digested_assets: :"assets:environment" do
24
+ desc "Creates non-digested symlinks for the assets in the public asset dir"
25
+ task symlink_non_digested_assets: :"assets:environment" do
26
+ if ReactOnRails.configuration.symlink_non_digested_assets_regex
28
27
  manifest_path = Dir.glob(ReactOnRails::assets_path.join(".sprockets-manifest-*.json"))
29
28
  .first
30
29
  manifest_data = JSON.load(File.new(manifest_path))
@@ -42,74 +41,66 @@ namespace :react_on_rails do
42
41
  end
43
42
  end
44
43
  end
44
+ end
45
45
 
46
- desc "Cleans all broken symlinks for the assets in the public asset dir"
47
- task delete_broken_symlinks: :"assets:environment" do
48
- Dir.glob(ReactOnRails::assets_path.join("*")).each do |filename|
49
- if File.lstat(filename).symlink?
50
- begin
51
- target = File.readlink(filename)
52
- rescue
53
- puts "React on Rails: Warning: your platform doesn't support File::readlink method."/
54
- "Skipping broken link check."
55
- return
56
- end
57
- path = Pathname.new(File.dirname(filename))
58
- target_path = path.join(target)
59
- unless File.exist?(target_path)
60
- puts "React on Rails: Deleting broken link: #{filename}"
61
- File.delete(filename)
62
- end
46
+ desc "Cleans all broken symlinks for the assets in the public asset dir"
47
+ task delete_broken_symlinks: :"assets:environment" do
48
+ Dir.glob(ReactOnRails::assets_path.join("*")).each do |filename|
49
+ if File.lstat(filename).symlink?
50
+ begin
51
+ target = File.readlink(filename)
52
+ rescue
53
+ puts "React on Rails: Warning: your platform doesn't support File::readlink method."/
54
+ "Skipping broken link check."
55
+ return
56
+ end
57
+ path = Pathname.new(File.dirname(filename))
58
+ target_path = path.join(target)
59
+ unless File.exist?(target_path)
60
+ puts "React on Rails: Deleting broken link: #{filename}"
61
+ File.delete(filename)
63
62
  end
64
63
  end
65
64
  end
66
65
  end
67
66
 
68
-
69
- # We might need the clear_prerequisites (delete after testing without)
70
- # Rake::Task["assets:precompile"]
71
- # .clear_prerequisites
72
- # .enhance(["assets:compile_environment"])
73
-
74
- if ReactOnRails.configuration.npm_build_production_command.present?
75
- # In this task, set prerequisites for the assets:precompile task
76
- desc <<-DESC
67
+ # In this task, set prerequisites for the assets:precompile task
68
+ desc <<-DESC
77
69
  Create webpack assets before calling assets:environment
78
70
  The webpack task must run before assets:environment task.
79
71
  Otherwise Sprockets cannot find the files that webpack produces.
80
72
  This is the secret sauce for how a Heroku deployment knows to create the webpack generated JavaScript files.
81
- DESC
82
- task compile_environment: :webpack do
83
- Rake::Task["assets:environment"].invoke
84
- end
73
+ DESC
74
+ task compile_environment: :webpack do
75
+ Rake::Task["assets:environment"].invoke
76
+ end
85
77
 
86
- desc <<-DESC
78
+ desc <<-DESC
87
79
  Compile assets with webpack
88
80
  Uses command defined with ReactOnRails.configuration.npm_build_production_command
89
- sh "cd client && #{ReactOnRails.configuration.npm_build_production_command}"
90
- DESC
91
- task :webpack do
81
+ sh "cd client && `ReactOnRails.configuration.npm_build_production_command`"
82
+ DESC
83
+ task webpack: :environment do
84
+ if ReactOnRails.configuration.npm_build_production_command.present?
92
85
  sh "cd client && #{ReactOnRails.configuration.npm_build_production_command}"
93
86
  end
87
+ end
94
88
 
95
- desc "Delete assets created with webpack, in #{ReactOnRails.configuration.generated_assets_dir}"
96
- task :clobber do
89
+ desc "Delete assets created with webpack, in the generated assetst directory (/app/assets/webpack)"
90
+ task clobber: :environment do
91
+ dir = Rails.root.join(ReactOnRails.configuration.generated_assets_dir)
92
+ if dir.present? && File.directory?(dir)
93
+ puts "Deleting files in directory #{dir}"
97
94
  rm_r Dir.glob(Rails.root.join("#{ReactOnRails.configuration.generated_assets_dir}/*"))
95
+ else
96
+ puts "Could not find dir #{dir}"
98
97
  end
99
98
  end
100
99
  end
101
100
  end
102
101
 
103
- if ReactOnRails.configuration.symlink_non_digested_assets_regex
104
- Rake::Task["assets:precompile"].enhance do
105
- Rake::Task["react_on_rails:assets:symlink_non_digested_assets"].invoke
106
- Rake::Task["react_on_rails:assets:delete_broken_symlinks"].invoke
107
- end
108
- end
109
-
110
- if ReactOnRails.configuration.npm_build_production_command.present?
111
- Rake::Task["assets:precompile"].enhance do
112
- Rake::Task["react_on_rails:assets:compile_environment"].invoke
113
- end
114
- end
115
-
102
+ # These tasks run as pre-requisites of assets:precompile.
103
+ # Note, it's not possible to refer to ReactOnRails configuration values at this point.
104
+ Rake::Task["assets:precompile"].enhance(["react_on_rails:assets:compile_environment",
105
+ "react_on_rails:assets:symlink_non_digested_assets",
106
+ "react_on_rails:assets:delete_broken_symlinks"])
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "6.0.0-beta.1",
3
+ "version": "6.0.0-beta.2",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.beta.1
4
+ version: 6.0.0.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon