staple 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdae37d53047398c261f9f1ce6e67b6090812fe3
4
- data.tar.gz: fd6a7bb935dd778e853f7b745ddd57ef8c84e92d
3
+ metadata.gz: 37dd82594a55d207062a5af33d61fb567c71fbfe
4
+ data.tar.gz: 7202ea9aa3e87dc080eb76a04395e7074cc049d6
5
5
  SHA512:
6
- metadata.gz: ead6d5cf343270544f9dd8c4fbdbc6b62a0a30b87d402953550d68bcea0fb37648345458e873f12171dbeda8f1c4bb326880c073967e11f9a72debb0f20bab89
7
- data.tar.gz: db4f288e2da1be547392f25652f457dbb3b90a4638b13e0c659e58d785e4e132f6601f04a036ac286387e9509a77c562083cb8439a5b7e1b44a3d7ff28bef91b
6
+ metadata.gz: dfc0a4c443f5af11b4dbd00872f0d3deef55dc60648bb6387d4a572472ab60ef20bf6fe764b15e621b74f5c8b6c8eb8d37facc956e6b7c14e540e1a0cd52de0d
7
+ data.tar.gz: 61db24a5db834c7e375c9f39be0013d5e0821d18413082e7e61d11b864264879a13614e783641b02f18a8a1c5dbab909c55e7adc4db5c987ca4792b02eda8016
data/README.md CHANGED
@@ -9,23 +9,29 @@ a modular ui framework for rails built on top of foundation and sass.
9
9
  * keep it simple
10
10
 
11
11
  ##todo
12
-
13
- * component based generators
14
- * fix plastic, flat theme selectors. Focus color.
12
+ * expand library and integration tests
13
+ * import web components
15
14
 
16
15
  ##lower priority todo
17
16
  * don't require other gems
18
17
  * integration with existing projects
19
18
  * reinstall places foundation again then does replace, separate generator for update?
20
- * variables generator:
19
+ * create executables
20
+ * Demarcate each pattern in scss (atom) with comment
21
+ * add colors to accent, buttons? gen?
22
+ * seperate if file contains into method.
23
+ * check before import if already there (import font)
24
+ * integrate:
25
+ * background, paragraph, etc vars
26
+ * append into generators
27
+ * generator for form colors from button list
28
+ * on sizes?:
21
29
  * radius
22
30
  * font
23
31
  * primary-color
24
32
  * border-size
25
33
  * change amount (color dif, hover dif)
26
- * create executables
27
- * Demarcate each pattern in scss (atom) with comment
28
- * Make errors verbose. Print full command on low level.
34
+ * refactor generator code from low priority
29
35
 
30
36
  ##Install
31
37
 
@@ -67,9 +73,9 @@ rails g staple:install
67
73
  * rails g staple:forms amputate inverse
68
74
 
69
75
  ###colors*
70
- * rails g staple:colors import secondary:blue
71
- * rails g staple:colors append fave:aqua //adds new color and generate class: button, accent?
76
+ * rails g staple:colors import primary:blue//adds if doesn't exist
72
77
  * rails g staple:colors remove fave // removes color declaration
78
+ * rails g staple:colors import primary-color:'rgba(22,23,0,0.9)' //explicit declaration
73
79
 
74
80
  ###typography*
75
81
  * rails g staple:typography import typeface-primary:Roboto
data/lib/staple.rb CHANGED
@@ -1,4 +1,8 @@
1
1
  require 'staple/buttons_generator'
2
2
  require 'staple/forms_generator'
3
+ require 'staple/colors_generator'
4
+ require 'staple/typography_generator'
5
+ require 'staple/tables_generator'
3
6
  require 'staple/theme_generator'
4
7
  require 'staple/install_generator'
8
+ require 'staple/reset_generator'
@@ -0,0 +1,85 @@
1
+ require 'rails/generators'
2
+
3
+ module Staple
4
+ class ColorsGenerator < Rails::Generators::Base
5
+ desc 'pending'
6
+ source_root File.join(File.dirname(__FILE__), '..', '..')
7
+ argument :actions, :type => :array, :default => []
8
+
9
+ def delegate
10
+ case "#{action}"
11
+ when "import"
12
+ import
13
+ when "remove"
14
+ remove
15
+ else
16
+ puts "unknown command"
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ #ACTIONS
23
+
24
+ def import
25
+ puts "#{component} import #{variable} -> #{color}"
26
+ if File.readlines(filename).any?{ |l| l["$#{variable}:"] }
27
+ #replace line w/ new
28
+ gsub_file(filename, /\$#{variable}:.*$/, "$#{variable}: #{contents};") if contents
29
+ gsub_file(filename, /\$#{variable}:.*$/, "$#{variable}: #{color};") if !contents
30
+ else
31
+ #create variable w/color
32
+ gsub_file(filename, "//&*append", "$#{variable}: #{contents};\n//&*append") if contents
33
+ gsub_file(filename, "//&*append", "$#{variable}: #{color};\n//&*append") if !contents
34
+ end
35
+ #check for variable, if yes: replace line, if no, create
36
+ end
37
+
38
+ def remove
39
+ #check for variable, and remove line
40
+ gsub_file(filename, /\$#{variable}:.*$/, "")
41
+ end
42
+
43
+ #HELPER METHODS
44
+
45
+ def contents
46
+ file = File.join(self.class.source_root, 'source', 'styles', "#{component}", "#{color.dasherize}.color")
47
+ get_file(file)
48
+ end
49
+
50
+ def get_file(file)
51
+ if File.file?(file)
52
+ return File.read(file)
53
+ else
54
+ return false
55
+ end
56
+ end
57
+
58
+ def filename
59
+ "app/assets/stylesheets/staple/#{component}.scss"
60
+ end
61
+
62
+ def not_valid
63
+ !contents
64
+ end
65
+
66
+ #DEFINE
67
+
68
+ def action
69
+ actions[0]
70
+ end
71
+
72
+ def variable
73
+ actions[1].split(":").first
74
+ end
75
+
76
+ def color
77
+ actions[1].split(":").last
78
+ end
79
+
80
+ def component
81
+ "colors"
82
+ end
83
+
84
+ end
85
+ end
@@ -62,8 +62,8 @@ module Staple
62
62
  end
63
63
  end
64
64
 
65
- def not_valid
66
- !contents || !focus || !error
65
+ def not_valid?
66
+ !contents && !focus && !error
67
67
  end
68
68
 
69
69
  #DEFINE
@@ -0,0 +1,18 @@
1
+ require 'rails/generators'
2
+
3
+ module Staple
4
+ class ResetGenerator < Rails::Generators::Base
5
+ desc 'bring in the staple'
6
+ source_root File.join(File.dirname(__FILE__), '..', '..')
7
+ argument :actions, :type => :array, :default => []
8
+
9
+ def reset
10
+ components = %w(buttons colors forms tables typography sizes)
11
+ components.each do |c|
12
+ copy_file "source/styles/staple/#{c}.scss", "app/assets/stylesheets/staple/#{c}.scss", :force => true
13
+ copy_file "source/styles/staple/builders/build_#{c}.scss", "app/assets/stylesheets/staple/builders/build_#{c}.scss", :force => true
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,66 @@
1
+ require 'rails/generators'
2
+
3
+ module Staple
4
+ class TablesGenerator < Rails::Generators::Base
5
+ desc 'pending'
6
+ source_root File.join(File.dirname(__FILE__), '..', '..')
7
+ argument :actions, :type => :array, :default => []
8
+
9
+ def delegate
10
+ case "#{action}"
11
+ when "import"
12
+ import
13
+ when "remove"
14
+ remove
15
+ else
16
+ puts "unknown command"
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ #ACTIONS
23
+
24
+ def import
25
+ puts "#{component} import #{pattern}"
26
+ gsub_file "app/assets/stylesheets/staple/#{component}.scss", "//&*default", "\n\t#{contents}//&*default" if contents
27
+
28
+ puts "invalid operation: #{component} import #{pattern}. for available actions: rails g staple:list [option]" if !contents
29
+ end
30
+
31
+ def remove
32
+ puts "#{component} remove #{pattern}"
33
+ gsub_file "app/assets/stylesheets/staple/#{component}.scss", "\n\t#{contents}", "" if contents
34
+ end
35
+
36
+ #HELPER METHODS
37
+
38
+ def contents
39
+ file = File.join(self.class.source_root, 'source', 'styles', "#{component}", "#{pattern.dasherize}.scss")
40
+ get_file(file)
41
+ end
42
+
43
+ def get_file(file)
44
+ if File.file?(file)
45
+ return File.read(file)
46
+ else
47
+ return false
48
+ end
49
+ end
50
+
51
+ #DEFINE
52
+
53
+ def action
54
+ actions[0]
55
+ end
56
+
57
+ def pattern
58
+ actions[1]
59
+ end
60
+
61
+ def component
62
+ "tables"
63
+ end
64
+
65
+ end
66
+ end
@@ -9,7 +9,7 @@ module Staple
9
9
  def call_generators
10
10
  if global?
11
11
  #call self with each
12
- components = %w(buttons colors forms sizes tables typography)
12
+ components = %w(buttons colors forms tables typography)
13
13
  components.each do |c|
14
14
  generate "staple:theme", "#{c}", "#{theme}"
15
15
  end
@@ -0,0 +1,88 @@
1
+ require 'rails/generators'
2
+
3
+ module Staple
4
+ class TypographyGenerator < Rails::Generators::Base
5
+ desc 'pending'
6
+ source_root File.join(File.dirname(__FILE__), '..', '..')
7
+ argument :actions, :type => :array, :default => []
8
+
9
+ def delegate
10
+ case "#{action}"
11
+ when "import"
12
+ import
13
+ when "remove"
14
+ remove
15
+ else
16
+ puts "unknown command"
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ #ACTIONS
23
+
24
+ def import
25
+ puts "#{component} import #{variable} -> #{typeface}"
26
+ if File.readlines(filename).any?{ |l| l["$#{variable}:"] }
27
+ #replace line w/ new
28
+ gsub_file(filename, /\$#{variable}:.*$/, "$#{variable}: #{contents};") if contents
29
+ gsub_file(filename, "//&*import", "\n#{import_type}//&*import") if import_type
30
+ gsub_file(filename, /\$#{variable}:.*$/, "$#{variable}: #{typeface};") if !contents
31
+ else
32
+ #create variable w/color
33
+ gsub_file(filename, "//&*append", "$#{variable}: #{contents};\n//&*append") if contents
34
+ gsub_file(filename, "//&*append", "$#{variable}: #{typeface};\n//&*append") if !contents
35
+ end
36
+ #check for variable, if yes: replace line, if no, create
37
+ end
38
+
39
+ def remove
40
+ #check for variable, and remove line
41
+ gsub_file(filename, /\$#{variable}:.*$/, "")
42
+ gsub_file(filename, "\n#{import_type}", "") if import_type
43
+ end
44
+
45
+ #HELPER METHODS
46
+
47
+ def contents
48
+ file = File.join(self.class.source_root, 'source', 'styles', "#{component}", "#{typeface.dasherize}.typeface")
49
+ get_file(file)
50
+ end
51
+
52
+ def import_type
53
+ file = File.join(self.class.source_root, 'source', 'styles', "#{component}", "#{typeface.dasherize}-import.scss")
54
+ get_file(file)
55
+ end
56
+
57
+ def get_file(file)
58
+ if File.file?(file)
59
+ return File.read(file)
60
+ else
61
+ return false
62
+ end
63
+ end
64
+
65
+ def filename
66
+ "app/assets/stylesheets/staple/#{component}.scss"
67
+ end
68
+
69
+ #DEFINE
70
+
71
+ def action
72
+ actions[0]
73
+ end
74
+
75
+ def variable
76
+ actions[1].split(":").first
77
+ end
78
+
79
+ def typeface
80
+ actions[1].split(":").last
81
+ end
82
+
83
+ def component
84
+ "typography"
85
+ end
86
+
87
+ end
88
+ end
File without changes
@@ -1,5 +1,2 @@
1
1
  secondary:green
2
- tertiary:yellow
3
- background:rgba(25,228,20,0.5) //set more vars than just primary
4
- primary:#477
5
- paragraph:red//if available, import file, else, use explicit declaration
2
+ tertiary:yellow
@@ -1,3 +1,3 @@
1
- background:rgba(25,228,20,0.5) //set more vars than just primary
2
- primary:#477
3
- paragraph:red//if available, import file, else, use explicit declaration
1
+ background:'rgba(25,228,20,0.5)'
2
+ primary:'#477'
3
+ paragraph:blue
@@ -1 +1 @@
1
- margin-bottom: 15px;
1
+ margin-bottom: 12px;
@@ -1,10 +1,10 @@
1
1
  div.error{
2
- *{
2
+ input{
3
3
  background: lighten($alert-color, 40%);
4
4
  border: 2px solid lighten($alert-color, 40%);
5
5
  border-top: 2px solid $alert-color;
6
6
  }
7
- *:focus{
7
+ input:focus{
8
8
  background: white;
9
9
  border-color: 2px solid $alert-color;
10
10
  }
@@ -1,2 +1 @@
1
- background: #fff;
2
- border: 2px solid $primary-color;
1
+ background: #fff;
@@ -1,9 +1,9 @@
1
1
  div.error{
2
- *{
2
+ input{
3
3
  background-color: lighten($alert-color, 40%);
4
4
  border-color: lighten($alert-color, 40%);
5
5
  }
6
- *:focus{
6
+ input:focus{
7
7
  background: white;
8
8
  border-color: $alert-color;
9
9
  }
@@ -2,6 +2,7 @@ $primary-color: #3389dd;
2
2
  $complement-color: adjust_hue($primary-color, 180);
3
3
  $secondary-color: adjust_hue($primary-color, 135);
4
4
  $tertiary-color: adjust_hue($primary-color, 200);
5
+ //&*append
5
6
 
6
7
  //AUTO GENERATE FOUNDATION COLORS: (CAN OVERRIDE)
7
8
  @import 'helpers/color_functions';
@@ -5,19 +5,7 @@ table{
5
5
  //FIX SPACING
6
6
  -webkit-border-horizontal-spacing: 0px;
7
7
  -webkit-border-vertical-spacing: 0px;
8
- //LINES
9
- td, th{
10
- padding: 8px;
11
- border-bottom: 1px solid rgba($black, 0.1);
12
- }
13
- //STRIPE
14
- tr:nth-child(even) {
15
- background-color: rgba($black, 0.03);
16
- }
17
- //HIGHLIGHT
18
- tbody tr:hover{
19
- background-color: rgba($black, 0.07);
20
- }
8
+ //&*default
21
9
  }
22
10
 
23
11
  //BUILDERS
@@ -1,7 +1,7 @@
1
1
  //IMPORT FONTS HERE Typekit and Google Fonts
2
2
  @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,700);
3
3
  @import url(http://fonts.googleapis.com/css?family=Roboto+Slab:400,300,700);
4
- @import url(http://fonts.googleapis.com/css?family=Inconsolata);
4
+ @import url(http://fonts.googleapis.com/css?family=Inconsolata);//&*import
5
5
 
6
6
  //DEFAULTS
7
7
  $typeface-primary: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
@@ -10,6 +10,7 @@ $typeface-tertiary: "Inconsolata", monospace;
10
10
  $normal-font-weight: 400;
11
11
  $header-font-weight: 300;
12
12
  $subheader-font-weight: 400;
13
+ //&*append
13
14
 
14
15
  //FOUNDATION STYLES: CAN BE OVERRIDDEN BUT NEEDED
15
16
  $font-family-sans-serif: $typeface-primary;
@@ -0,0 +1,3 @@
1
+ tbody tr:hover{
2
+ background-color: rgba($black, 0.07);
3
+ }
@@ -0,0 +1,4 @@
1
+ td, th{
2
+ padding: 8px;
3
+ border-bottom: 1px solid rgba($black, 0.1);
4
+ }
@@ -0,0 +1,3 @@
1
+ tr:nth-child(even) {
2
+ background-color: rgba($black, 0.03);
3
+ }
@@ -0,0 +1,3 @@
1
+ hilight
2
+ horizontal-lines
3
+ stripe
@@ -0,0 +1 @@
1
+ "Helvetica Neue", Helvetica, Arial, sans-serif
@@ -0,0 +1 @@
1
+ @import url(http://fonts.googleapis.com/css?family=Roboto+Slab:400,300,700);
@@ -0,0 +1 @@
1
+ "Roboto Slab", serif
@@ -0,0 +1,5 @@
1
+ typeface-primary:roboto
2
+ typeface-secondary:'"Inconsolata", monospace'
3
+ typeface-tertiary:helvetica-neue
4
+ normal-font-weight:200
5
+ header-font-weight:600
data/staple.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "staple"
7
- spec.version = "0.4.1"
7
+ spec.version = "0.4.2"
8
8
  spec.summary = "Modular UI framework for rails built on top of foundation and sass"
9
9
  spec.description = "a modular ui framework for rails built on top of foundation and sass."
10
10
  spec.authors = ["Ryan Helsing"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Helsing
@@ -80,9 +80,13 @@ files:
80
80
  - Rakefile
81
81
  - lib/staple.rb
82
82
  - lib/staple/buttons_generator.rb
83
+ - lib/staple/colors_generator.rb
83
84
  - lib/staple/forms_generator.rb
84
85
  - lib/staple/install_generator.rb
86
+ - lib/staple/reset_generator.rb
87
+ - lib/staple/tables_generator.rb
85
88
  - lib/staple/theme_generator.rb
89
+ - lib/staple/typography_generator.rb
86
90
  - source/simple_form/_form.html.slim
87
91
  - source/styles/buttons/big-bottom-border.scss
88
92
  - source/styles/buttons/border.scss
@@ -98,7 +102,7 @@ files:
98
102
  - source/styles/buttons/text-shadow.scss
99
103
  - source/styles/buttons/themes/plastic.theme
100
104
  - source/styles/buttons/transparent.scss
101
- - source/styles/colors/blue.scss
105
+ - source/styles/colors/blue.color
102
106
  - source/styles/colors/themes/flatland.theme
103
107
  - source/styles/colors/themes/plastic.theme
104
108
  - source/styles/forms/2px-border-focus.scss
@@ -138,7 +142,14 @@ files:
138
142
  - source/styles/staple/tables.scss
139
143
  - source/styles/staple/typography.scss
140
144
  - source/styles/staple/utilities.scss
141
- - source/styles/typography/roboto.scss
145
+ - source/styles/tables/hilight.scss
146
+ - source/styles/tables/horizontal-lines.scss
147
+ - source/styles/tables/stripe.scss
148
+ - source/styles/tables/themes/plastic.theme
149
+ - source/styles/typography/helvetica-neue.typeface
150
+ - source/styles/typography/roboto-import.scss
151
+ - source/styles/typography/roboto.typeface
152
+ - source/styles/typography/themes/plastic.theme
142
153
  - staple.gemspec
143
154
  homepage: https://github.com/rhelsing/staple
144
155
  licenses:
@@ -1,2 +0,0 @@
1
- //@import
2
- //font