Sha256: 78141d4039103cfc2899e09701a4b23f6f21d800d09d5af554b99a896ab0f643

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 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

1 entries across 1 versions & 1 rubygems

Version Path
snake-1.0.1 lib/generators/snake/parse_generator.rb