lib/reality/zapwhite.rb in zapwhite-2.6.0 vs lib/reality/zapwhite.rb in zapwhite-2.7.0
- old
+ new
@@ -11,18 +11,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'reality/gitattributes'
+require 'json'
module Reality
class Zapwhite
def initialize(base_directory)
@base_directory = base_directory
@attributes = Reality::Git::Attributes.parse(@base_directory)
- @exclude_patterns = %w(vendor/.* node_modules/.*)
+ @exclude_patterns = %w(vendor/.* node_modules/.*) + load_braid_mirrors
@check_only = false
@additional_gitattribute_rules = []
end
def exclude_patterns
@@ -99,9 +100,14 @@
normalize_count
end
private
+
+ def load_braid_mirrors
+ braid_file = "#{@base_directory}/.braids.json"
+ File.exist?(braid_file) ? JSON.parse(IO.read(braid_file)).keys : []
+ end
def generate_gitattributes!
attributes = Reality::Git::Attributes.new(@base_directory)
template = create_template_gitattributes
each_git_filename do |f|