haute 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDdkYWMwMDQwOGU5ZjdjMTVhMTM0OGY4OGVmN2Y3NTdlMmUzYzM4Zg==
5
+ data.tar.gz: !binary |-
6
+ MGUwMjUzNDZkOTI3Zjk2YzE4YTAwZWJlYjE3ZDJiZTQzOGNhNzRhMw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzM4M2RmOGU0ZmNlMjg3NDQxMDU3ZDk1NjcwMGQ5ODA3ZjkzZjRiMTU3M2My
10
+ MWE1NWZhOGI2YTk5YTAyZTQyYWFmMTU0MzMxYjQ3MWFkMTI4MGZmZjE4NDQ2
11
+ NTZlOGY4YTE1ZDBiMmNmN2VhYWJjMjhlNzU1NWVhYjMzY2RmMzA=
12
+ data.tar.gz: !binary |-
13
+ MjdlZmQ1ZjdkMWM1Mjk0MDNlM2JkNjM0NGQ3Nzk0YjJiOTM0YzE4YjE2MGJm
14
+ ZDJhNjNkYmRlOTFmNDc3ZGQxNDE5ODQ1MWI2YzdhMWJlYmQ1YjVjNWE4YTZi
15
+ ZDdlZGY5OTA2NDVjNjNmNzNkNjhlYmY0Njg2MWQ4NjZlNTU1ZjU=
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .DS_Store
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in haute.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Andy Richardson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Haute
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'haute'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install haute
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/haute/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,90 @@
1
+ <div class="styleguide-variables">
2
+ <div class="styleguide-variables-inputs">
3
+ <% # .styleguide-row.row.relative.hidden %>
4
+ <% # .styleguide-delete-row.fa.fa-times-circle %>
5
+ <% # .col-md-5= text_field_tag "", "", class: "form-control" %>
6
+ <% # .col-md-5= text_field_tag "", "", class: "form-control" %>
7
+ <% # .styleguide-color-swatch.col-md-2.hidden %>
8
+ <% # - @styleguide_vars.each do |section| %>
9
+ <% # - current_section = section[0] %>
10
+ <% # - section[1].each do |row| %>
11
+ <% # - if current_section == "Colors" %>
12
+ <% # .styleguide-row.row.relative{data: {section: section}} %>
13
+ <% # -# .styleguide-delete-row.fa.fa-times-circle %>
14
+ <% # .col-md-5= text_field_tag "", row[:var], class: "form-control" %>
15
+ <% # -# .col-md-5= text_field_tag "", row[:val], class: "form-control" %>
16
+ <% # - if current_section == "Colors" %>
17
+ <% # .styleguide-color-swatch.col-md-2{style: "background-color: #{row[:val]};"} %>
18
+ <% # - elsif current_section == "Fonts" %>
19
+ <% # .styleguide-text-swatch.col-md-2{style: "font-family: #{row[:val]};"} %>
20
+ <% # Sample %>
21
+ <div class="styleguide-example">
22
+ <h3 class="styleguide-section-header">
23
+ Colors
24
+ <em>_variables.css.sass</em>
25
+ </h3>
26
+ <div class="styleguide-inner">
27
+ <% if primary_colors.present? %>
28
+ <div class="styleguide-color-row row">
29
+ <h4 class="styleguide-subheading">Primary Colors</h4>
30
+ <% primary_colors.each do |color| %>
31
+ <div class="col-sm-2 no-padding">
32
+ <div class="styleguide-color" style="background-color: <%= color[:val] %>"></div>
33
+ <pre>
34
+ <code>
35
+ <%= color[:var] %>
36
+ <br/>
37
+ <%= "hex #{color[:val]}" %>
38
+ </code>
39
+ </pre>
40
+ <span>
41
+ <%= color[:extra] %>
42
+ </span>
43
+ </div>
44
+ <% end %>
45
+ </div>
46
+ <% end %>
47
+ <% if secondary_colors.present? %>
48
+ <div class="styleguide-color-row row">
49
+ <h4 class="styleguide-subheading">Secondary Colors</h4>
50
+ <% secondary_colors.each do |color| %>
51
+ <div class="col-sm-2 no-padding">
52
+ <div class="styleguide-color" style="background-color: <%= color[:val] %>"></div>
53
+ <pre>
54
+ <code>
55
+ <%= color[:var] %>
56
+ <br/>
57
+ <%= "hex #{color[:val]}" %>
58
+ </code>
59
+ </pre>
60
+ <span>
61
+ <%= color[:extra] %>
62
+ </span>
63
+ </div>
64
+ <% end %>
65
+ </div>
66
+ <% end %>
67
+ <% if grayscale_colors.present? %>
68
+ <div class="styleguide-color-row row">
69
+ <h4 class="styleguide-subheading">Grayscale</h4>
70
+ <% grayscale_colors.each do |color| %>
71
+ <div class="col-sm-2 no-padding">
72
+ <div class="styleguide-color" style="background-color: <%= color[:val] %>"></div>
73
+ <pre>
74
+ <code>
75
+ <%= color[:var] %>
76
+ <br/>
77
+ <%= "hex #{color[:val]}" %>
78
+ </code>
79
+ </pre>
80
+ <span>
81
+ <%= color[:extra] %>
82
+ </span>
83
+ </div>
84
+ <% end %>
85
+ </div>
86
+ <% end %>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
@@ -0,0 +1,66 @@
1
+ .styleguide-variables
2
+ .styleguide-variables-inputs
3
+ -# .styleguide-row.row.relative.hidden
4
+ -# .styleguide-delete-row.fa.fa-times-circle
5
+ -# .col-md-5= text_field_tag "", "", class: "form-control"
6
+ -# .col-md-5= text_field_tag "", "", class: "form-control"
7
+ -# .styleguide-color-swatch.col-md-2.hidden
8
+
9
+ -# - @styleguide_vars.each do |section|
10
+ -# - current_section = section[0]
11
+ -# - section[1].each do |row|
12
+ -# - if current_section == "Colors"
13
+ -# .styleguide-row.row.relative{data: {section: section}}
14
+ -# -# .styleguide-delete-row.fa.fa-times-circle
15
+ -# .col-md-5= text_field_tag "", row[:var], class: "form-control"
16
+ -# -# .col-md-5= text_field_tag "", row[:val], class: "form-control"
17
+ -# - if current_section == "Colors"
18
+ -# .styleguide-color-swatch.col-md-2{style: "background-color: #{row[:val]};"}
19
+ -# - elsif current_section == "Fonts"
20
+ -# .styleguide-text-swatch.col-md-2{style: "font-family: #{row[:val]};"}
21
+ -# Sample
22
+
23
+ .styleguide-example
24
+ %h3.styleguide-section-header
25
+ Colors
26
+ %em _variables.css.sass
27
+
28
+ .styleguide-inner
29
+ - if primary_colors.present?
30
+ .styleguide-color-row.row
31
+ %h4.styleguide-subheading Primary Colors
32
+ - primary_colors.each do |color|
33
+ .col-sm-2.no-padding
34
+ .styleguide-color{style: "background-color: #{color[:val]}"}
35
+ %pre
36
+ %code
37
+ = color[:var]
38
+ %br
39
+ = "hex #{color[:val]}"
40
+ %span= color[:extra]
41
+
42
+ - if secondary_colors.present?
43
+ .styleguide-color-row.row
44
+ %h4.styleguide-subheading Secondary Colors
45
+ - secondary_colors.each do |color|
46
+ .col-sm-2.no-padding
47
+ .styleguide-color{style: "background-color: #{color[:val]}"}
48
+ %pre
49
+ %code
50
+ = color[:var]
51
+ %br
52
+ = "hex #{color[:val]}"
53
+ %span= color[:extra]
54
+
55
+ - if grayscale_colors.present?
56
+ .styleguide-color-row.row
57
+ %h4.styleguide-subheading Grayscale
58
+ - grayscale_colors.each do |color|
59
+ .col-sm-2.no-padding
60
+ .styleguide-color{style: "background-color: #{color[:val]}"}
61
+ %pre
62
+ %code
63
+ = color[:var]
64
+ %br
65
+ = "hex #{color[:val]}"
66
+ %span= color[:extra]
data/bin/haute ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "haute/cli"
3
+
4
+ Haute::Cli.run
data/config.rb ADDED
@@ -0,0 +1 @@
1
+ page "/styleguide.html", :layout => :haute
data/haute.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'haute/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "haute"
8
+ spec.version = Haute::VERSION
9
+ spec.authors = ["Andy Richardson"]
10
+ spec.email = ["andy@kohactive.com"]
11
+ spec.summary = "Generate styleguides."
12
+ spec.description = ""
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "kss", "~> 0.5.0"
22
+ spec.add_dependency "haml", "~> 4.0.0"
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ end
data/lib/haute/cli.rb ADDED
@@ -0,0 +1,50 @@
1
+ require 'optparse'
2
+ require 'haute'
3
+ module Haute
4
+ class Cli
5
+ class << self
6
+ def run
7
+ options = {}
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: haute [options]"
10
+ opts.on("-v", "--variables VARIABLES_PATH", "Path to variables") do |v|
11
+ options[:variables] = v
12
+ end
13
+ opts.on("-t", "--typography TYPOGRAPHY_PATH", "Path to typography") do |v|
14
+ options[:typography] = v
15
+ end
16
+ opts.on("-T", "--template TEMPLATE_PATH", "Path to html template") do |v|
17
+ options[:template] = v
18
+ end
19
+ opts.on("-O", "--outfile OUTFILE_PATH", "Path to output style guide to") do |v|
20
+ options[:outfile] = v
21
+ end
22
+ opts.on_tail("-h", "--help", "Show this message") do
23
+ puts opts
24
+ exit(1)
25
+ end
26
+
27
+ end.parse!
28
+ if !(path = options.fetch(:variables, nil)).nil?
29
+ begin
30
+ generated = Haute::Generator.generate(Parser.parse_file(path), options[:template])
31
+ if options[:outfile].nil?
32
+ puts generated
33
+ else
34
+ f = File.new(options[:outfile], "w+")
35
+ f.puts(generated)
36
+ f.close
37
+ end
38
+ rescue => e
39
+ puts e
40
+ exit(1)
41
+ end
42
+ else
43
+ puts "The variables flag [-v] is required."
44
+ exit(1)
45
+ end
46
+ exit(0)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,44 @@
1
+ require 'stringio'
2
+ module Haute
3
+ class ColorBlock
4
+ class << self
5
+ def parse(content)
6
+ section = ""
7
+ @styleguide_vars = {}
8
+
9
+ file = StringIO.new(content)
10
+ file.each do |line|
11
+ if line.present?
12
+ if line.split().first(3).first == "//+"
13
+ if section == ""
14
+ section = line.split().first(3).last
15
+ else
16
+ section = ""
17
+ end
18
+
19
+ else
20
+ if line.split().first(7).first != "//+ End"
21
+ line_split = line.split(/ : */, 2)
22
+ @styleguide_vars[section] = [] if @styleguide_vars[section].nil?
23
+ val = line_split.last
24
+ extra = ""
25
+ if val.include? "//+"
26
+ extra = val.split("//+").last()
27
+ val = val.split("//+").first()
28
+ end
29
+ @styleguide_vars[section].push( {var: line_split.first.strip!, val: val, extra: extra} )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ file.close
35
+
36
+ primary_colors = @styleguide_vars['Primary']
37
+ secondary_colors = @styleguide_vars['Secondary']
38
+ grayscale_colors = @styleguide_vars['Grayscale']
39
+
40
+ {primary_colors: primary_colors, secondary_colors: secondary_colors, grayscale_colors: grayscale_colors}
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,24 @@
1
+ require 'erb'
2
+ require 'haml'
3
+ require 'ostruct'
4
+
5
+ module Haute
6
+ class Generator
7
+ class << self
8
+ def generate(options, template=nil)
9
+ template = File.expand_path("../../../app/styleguide.html.haml", __FILE__) unless template.present?
10
+ template_string = File.read(template)
11
+ case File.extname(template)
12
+ when ".erb"
13
+ ERB.new(template_string).result(OpenStruct.new(options).instance_eval { binding })
14
+
15
+ when ".haml"
16
+ Haml::Engine.new(template_string).render(OpenStruct.new(options).instance_eval { binding })
17
+
18
+ else
19
+ raise "You must supply an ERB or HAML template path."
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ module Haute
2
+ class Parser
3
+ class << self
4
+ def parse_file(path)
5
+ if File.exists?(path)
6
+ parse(File.read(path))
7
+ else
8
+ raise "Unable to read file #{path}"
9
+ end
10
+ end
11
+
12
+ def parse(content)
13
+ Haute::ColorBlock.parse(content)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class Object
2
+ def present?
3
+ !nil?
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Haute
2
+ VERSION = "0.2.0"
3
+ end
data/lib/haute.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "haute/version"
2
+ require "haute/parser"
3
+ require "haute/colorblock"
4
+ require "haute/support"
5
+ require "haute/generator"
6
+ module Haute
7
+
8
+ end
@@ -0,0 +1 @@
1
+ %h1 test
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: haute
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Andy Richardson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: kss
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 4.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 4.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: ''
70
+ email:
71
+ - andy@kohactive.com
72
+ executables:
73
+ - haute
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - app/styleguide.html.erb
83
+ - app/styleguide.html.haml
84
+ - bin/haute
85
+ - config.rb
86
+ - haute.gemspec
87
+ - lib/haute.rb
88
+ - lib/haute/cli.rb
89
+ - lib/haute/colorblock.rb
90
+ - lib/haute/generator.rb
91
+ - lib/haute/parser.rb
92
+ - lib/haute/support.rb
93
+ - lib/haute/version.rb
94
+ - source/styleguide.html.haml
95
+ homepage: ''
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.4.1
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Generate styleguides.
119
+ test_files: []