LoginSignup
0
0

More than 5 years have passed since last update.

Fastfileのafter_allにちゃんとif文書こうと思った

Posted at

Fastfileの話、

Fastfile
  after_all do
    reset_modified_files
  end

とかやっていると思います。

laneを増やしていく過程で、reset_modified_filesをしたくないlaneを追加したい時は

Fastfile
  after_all do |lane|
    if lane.include?(:generate_task) do
    else
      reset_modified_files
    end
  end

とかしていくと思いますが、違和感があります。
というのも、after_allしたくないのにわざわざafter_allしないというのを記述しないといけないという点。

これはafter_allのデフォルトの挙動をreset_modified_filesにしたことにあります。
なので、after_allを使いたいlaneがafter_allを記述するのが正しく本来after_allは

Fastfile
  after_all do |lane|
    lanes_to_say_foo = [:test, :build, :other]
    if lanes_to_say_foo.include?(lane)
      reset_modified_files
    end
  end

のような感じで常にif文が存在するべきなのでは、と思った次第です。1


  1. discordで突っ込んで頂いた気づきです 

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0