Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method add_local_file_paths to config class #347

Merged
merged 1 commit into from
Jul 6, 2017

Conversation

PikachuEXE
Copy link
Member

@PikachuEXE PikachuEXE commented Jun 2, 2017

Alternative to #346
Allows multiple list of local file paths to be added

Usage: (in Ruby code)

AssetSync.configure do |config|
  # The block should return an array of file paths
  config.add_local_file_paths do
    # Any code that returns paths of local asset files to be uploaded
    # Like Webpacker
    Dir[File.join(Webpacker::Configuration.fetch(:public_output_path), '/**/**')]
  end
end

This new method does not affect existing options
The existing list of local files generated is still the same
Using this new method only add new file paths

Also replaces

Fixes #344

@cawabunga
Copy link

cawabunga commented Jun 2, 2017

I'm not very familiar with ruby, but what is the difference from #346? Can't we do the same stuff?

@PikachuEXE
Copy link
Member Author

In #346 you can do this:

AssetSync.configure do |config|
  # The block should return an array of file paths
  config.additional_local_file_paths_proc = proc do
    # Any code that returns paths of local asset files to be uploaded
    # Like Webpacker
    Dir[File.join(Webpacker::Configuration.fetch(:public_output_path), '/**/**')]
  end
end

Problem is if there are other gems trying to integrate with this gem
#346 does not allow adding new procs (it's singular)
This PR allows it

@cawabunga
Copy link

Thanks for explanation, great work!

@razvvan
Copy link

razvvan commented Jun 9, 2017

since my packs were in public I had to do a:

Dir.chdir("public") do
  Dir[File.join(Webpacker::Configuration.fetch(:public_output_path), '/**/**')]
end

@PikachuEXE
Copy link
Member Author

That's just an example
The point is you can put whatever you want

@PikachuEXE
Copy link
Member Author

Let me know if this works or not
Can't merge a non-tested/working code :P

@razvvan
Copy link

razvvan commented Jul 3, 2017

Works for me

@hara-y-u
Copy link

hara-y-u commented Jul 3, 2017

This works for me too.

@y-yagi
Copy link

y-yagi commented Jul 3, 2017

Works for me too.

@PikachuEXE PikachuEXE merged commit a4aaf59 into master Jul 6, 2017
@PikachuEXE PikachuEXE deleted the feature/add-local-file-paths branch July 6, 2017 03:35
@PikachuEXE
Copy link
Member Author

I will release this within next week, if no other major issues

@PikachuEXE
Copy link
Member Author

2.2.0 released, please have a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants