Sha256: ef32b79a7c9c182548dc19b120bb8c1686105646aef7b639c505d95d2b74dabe

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

module Snake
  class ParseGenerator < Rails::Generators::Base
    require_relative '../../snake.rb'
    require 'rails/generators'

    def parse
      vars = Snake::Parser.parse(File.join(Rails.root, JSON_PATH))
      Snake::Writer.write(vars)

      gsub_file File.join(Rails.root, STYLES_PATH), "@import 'bootstrap-sprockets';", "@import \"bootstrap-sprockets\";"
      gsub_file File.join(Rails.root, STYLES_PATH), "@import \"snake_vars\";", ""
      inject_into_file File.join(Rails.root, STYLES_PATH), after: "@import \"bootstrap-sprockets\";\n" do
        <<-INSERT
@import "snake_vars";
        INSERT
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snake-1.0.4 lib/generators/snake/parse_generator.rb
snake-1.0.3 lib/generators/snake/parse_generator.rb
snake-1.0.2 lib/generators/snake/parse_generator.rb