archetype 0.0.1.pre.3.6ed259b → 0.0.1.pre.3.55c4182
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.
- data/CHANGELOG.md +0 -15
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/VERSION.yml +1 -1
- data/lib/archetype.rb +0 -4
- data/lib/archetype/functions/hash.rb +12 -28
- data/lib/archetype/functions/helpers.rb +2 -3
- data/lib/archetype/sass_extensions/functions/lists.rb +33 -27
- data/lib/archetype/sass_extensions/functions/locale.rb +16 -32
- data/lib/archetype/sass_extensions/functions/styleguide.rb +11 -12
- data/lib/archetype/sass_extensions/functions/ui.rb +1 -2
- data/lib/archetype/sass_extensions/functions/version.rb +2 -2
- data/lib/archetype/version.rb +2 -2
- data/stylesheets/archetype/_config.scss +5 -18
- data/stylesheets/archetype/_hacks.scss +18 -39
- data/stylesheets/archetype/_ui.scss +8 -23
- data/stylesheets/archetype/styleguide/components/_buttons.scss +0 -1
- data/stylesheets/archetype/util/_styles.scss +2 -25
- data/test/fixtures/stylesheets/archetype/config.rb +0 -2
- data/test/fixtures/stylesheets/archetype/expected/hacks/ie_pseudo.css +3 -3
- data/test/fixtures/stylesheets/archetype/expected/styleguide/buttons.css +0 -28
- data/test/fixtures/stylesheets/archetype/expected/styleguide/selective_state.css +0 -3
- data/test/fixtures/stylesheets/archetype/expected/ui/glyph_icon.css +5 -52
- data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-browser.css +0 -5
- data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +0 -12
- data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +1 -8
- data/test/helpers/test_case.rb +2 -2
- data/test/integrations/archetype_test.rb +1 -3
- data/test/units/sass_extensions_test.rb +25 -18
- metadata +21 -60
- checksums.yaml +0 -7
- data/bin/archetype +0 -3
- data/lib/archetype/actions/help.rb +0 -16
- data/lib/archetype/actions/theme.rb +0 -73
- data/lib/archetype/executor.rb +0 -27
- data/templates/_theme/_components.scss +0 -3
- data/templates/_theme/_config.scss +0 -1
- data/templates/_theme/_core.scss +0 -13
- data/templates/_theme/_helpers.scss +0 -1
- data/templates/_theme/_primitives.scss +0 -3
- data/templates/_theme/components/README +0 -1
- data/templates/_theme/primitives/README +0 -1
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
- data/test/fixtures/stylesheets/archetype/expected/base.css +0 -349
- data/test/fixtures/stylesheets/archetype/expected/hacks/transparent_focusable.css +0 -4
- data/test/fixtures/stylesheets/archetype/expected/locale.css +0 -23
- data/test/fixtures/stylesheets/archetype/expected/styleguide/extend.css +0 -7
- data/test/fixtures/stylesheets/archetype/expected/utilities/custom_output_styler.css +0 -8
- data/test/fixtures/stylesheets/archetype/source/base.scss +0 -3
- data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +0 -5
- data/test/fixtures/stylesheets/archetype/source/locale.scss +0 -43
- data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +0 -23
- data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +0 -21
data/CHANGELOG.md
CHANGED
@@ -11,29 +11,14 @@
|
|
11
11
|
- added `styleguide-component-exists()` method to check if a component/extension has already been registered in the theme
|
12
12
|
- added `memoize` compiler configuration to allow enabling/disabling the internal styleguide memoizer
|
13
13
|
- `glyph-icon()` can now take `false` as an icon name and not output anything
|
14
|
-
- added `unstyled-button()` method to remove default styling from a `<button>` element
|
15
|
-
- added `prefixed-tag()` method for consistency when generating tag names
|
16
|
-
- added Chinese font stacks
|
17
|
-
- added wildcard support to `locale()` function (e.g. `locale(en_ ja_JP _DE)`)
|
18
|
-
- added `transparent-focusable()` mixin for transparent background support in older IE
|
19
|
-
- added ability to customize `output-style()` with `custom-output-styler()` mixin and `has-custom-output-styler()` function (NEEDS DOCUMENTATION)
|
20
|
-
- added better support for targeting IE6/7 glyphs and `ie-pseudo()` generated elements (NEEDS DOCUMENTATION)
|
21
|
-
- making `unique()` generated IDs genuinely unique
|
22
|
-
- adding support for a `testing` config flag
|
23
|
-
- adding support for `@extend` from a styleguide component
|
24
14
|
|
25
15
|
### Resolved Issues:
|
26
16
|
|
27
17
|
- quotes on strings passed to `associative()` weren't being stripped correctly
|
28
|
-
- fixed some minor glyph issues
|
29
|
-
- out-of-order CSS issues in Ruby 1.8.7 are fixed using `Hashery::OrderedHash`
|
30
|
-
- fixed issue with `archetype-version()` incorrectly matching comparators
|
31
18
|
|
32
19
|
### Tests:
|
33
20
|
|
34
21
|
- added test case for fallback CSS properties
|
35
|
-
- added test case for generating loading spinner keyframe animations
|
36
|
-
- updated test cases for minor changes
|
37
22
|
|
38
23
|
## 0.0.1.pre.2 (unreleased)
|
39
24
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Archetype
|
2
2
|
|
3
|
-
[](https://travis-ci.org/eoneill/archetype)
|
4
4
|
|
5
5
|
Archetype is a UI pattern and component library for quickly iterating on and maintaining scalable web interfaces.
|
6
6
|
|
data/VERSION.yml
CHANGED
data/lib/archetype.rb
CHANGED
@@ -33,10 +33,6 @@ module Archetype
|
|
33
33
|
Compass::Configuration.add_configuration_property(:memoize, "should the memoizer be used to improve compilation speed") do
|
34
34
|
not (Compass.configuration.environment || :development).to_s.include?('dev')
|
35
35
|
end
|
36
|
-
# testing (for running unit tests)
|
37
|
-
Compass::Configuration.add_configuration_property(:testing, "is this a testing environment") do
|
38
|
-
ENV['CI']
|
39
|
-
end
|
40
36
|
end
|
41
37
|
end
|
42
38
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# :stopdoc:
|
2
2
|
# This module extends the native Ruby Hash class to support deep merging
|
3
3
|
# and comparing the difference between hashes.
|
4
|
-
# This functionality mimics that found in ActiveSupport
|
5
|
-
# @see https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
|
6
4
|
#
|
7
5
|
module Archetype::Functions::Hash
|
8
6
|
#
|
@@ -13,10 +11,13 @@ module Archetype::Functions::Hash
|
|
13
11
|
# *Returns*:
|
14
12
|
# - {Hash} a new hash containing the contents of other_hash and the contents of hsh, deep merged
|
15
13
|
#
|
16
|
-
def rmerge(other_hash
|
17
|
-
|
14
|
+
def rmerge(other_hash)
|
15
|
+
new_hash = {}
|
16
|
+
merge(other_hash) do |key, oldval, newval|
|
17
|
+
new_hash[key] = oldval.class == self.class ? oldval.rmerge(newval) : newval
|
18
|
+
end
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
#
|
21
22
|
# adds the contents of other_hash to hsh, deep merged
|
22
23
|
#
|
@@ -25,16 +26,10 @@ module Archetype::Functions::Hash
|
|
25
26
|
# *Returns*:
|
26
27
|
# - {Hash} the original hash with the addition of the contents of other_hash
|
27
28
|
#
|
28
|
-
def rmerge!(other_hash
|
29
|
-
other_hash
|
30
|
-
|
31
|
-
if tv.is_a?(Hash) && v.is_a?(Hash)
|
32
|
-
self[k] = tv.rmerge(v, &block)
|
33
|
-
else
|
34
|
-
self[k] = block && tv ? block.call(k, tv, v) : v
|
35
|
-
end
|
29
|
+
def rmerge!(other_hash)
|
30
|
+
merge!(other_hash) do |key, oldval, newval|
|
31
|
+
oldval.class == self.class ? oldval.rmerge!(newval) : newval
|
36
32
|
end
|
37
|
-
return self
|
38
33
|
end
|
39
34
|
|
40
35
|
#
|
@@ -46,7 +41,7 @@ module Archetype::Functions::Hash
|
|
46
41
|
# - {Hash} a representation of the difference between the two hashes
|
47
42
|
#
|
48
43
|
def diff(other_hash)
|
49
|
-
(self.keys + other_hash.keys).uniq.inject(
|
44
|
+
(self.keys + other_hash.keys).uniq.inject({}) do |tmp, key|
|
50
45
|
# special comparison for gradients
|
51
46
|
are_gradients = self[key].is_a?(Compass::SassExtensions::Functions::GradientSupport::LinearGradient) and other_hash[key].is_a?(Compass::SassExtensions::Functions::GradientSupport::LinearGradient)
|
52
47
|
eq_gradients = are_gradients ? (self[key].to_s == other_hash[key].to_s) : true
|
@@ -133,17 +128,6 @@ private
|
|
133
128
|
end
|
134
129
|
end
|
135
130
|
|
136
|
-
|
137
|
-
|
138
|
-
if RUBY_VERSION < '1.9'
|
139
|
-
require 'hashery/ordered_hash'
|
140
|
-
class Hash < Hashery::OrderedHash
|
141
|
-
include Archetype::Functions::Hash
|
142
|
-
end
|
143
|
-
else
|
144
|
-
class Hash < ::Hash
|
145
|
-
include Archetype::Functions::Hash
|
146
|
-
end
|
147
|
-
end
|
131
|
+
class Hash
|
132
|
+
include Archetype::Functions::Hash
|
148
133
|
end
|
149
|
-
|
@@ -24,8 +24,7 @@ private
|
|
24
24
|
def self.hash_to_list(hsh, depth = 0, separator = :comma)
|
25
25
|
if hsh.is_a? Hash
|
26
26
|
list = []
|
27
|
-
hsh.each do |
|
28
|
-
item = [key, item]
|
27
|
+
hsh.each do |item|
|
29
28
|
# if its a hash, convert it to a List
|
30
29
|
if item.is_a? Hash or item.is_a? Array
|
31
30
|
tmp = []
|
@@ -55,7 +54,7 @@ private
|
|
55
54
|
#
|
56
55
|
def self.list_to_hash(list, depth = 0, nest = [], additives = [])
|
57
56
|
list = list.to_a
|
58
|
-
hsh =
|
57
|
+
hsh = {}
|
59
58
|
list.each do |item|
|
60
59
|
item = item.to_a
|
61
60
|
# convert the key to a string and strip off quotes
|
@@ -6,7 +6,7 @@ require 'archetype/functions/helpers'
|
|
6
6
|
module Archetype::SassExtensions::Lists
|
7
7
|
#
|
8
8
|
# replace an index in a list
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# *Parameters*:
|
11
11
|
# - <tt>$list</tt> {List} the list to replace from
|
12
12
|
# - <tt>$value</tt> {\*} the value to replace (if nil, it's a removal)
|
@@ -71,6 +71,38 @@ module Archetype::SassExtensions::Lists
|
|
71
71
|
Sass::Script::Functions.declare :list_insert, [:list, :idx, :value]
|
72
72
|
Sass::Script::Functions.declare :list_insert, [:list, :idx, :value, :separator]
|
73
73
|
|
74
|
+
#
|
75
|
+
# sort a list
|
76
|
+
#
|
77
|
+
# *Parameters*:
|
78
|
+
# - <tt>$list</tt> {List} the list to sort
|
79
|
+
# - <tt>$reverse</tt> {Boolean} sort the list in reverse order
|
80
|
+
# *Returns*:
|
81
|
+
# - {List} the sorted list
|
82
|
+
#
|
83
|
+
# TODO - this is failing, fix this
|
84
|
+
#def list_sort(list, reverse = false)
|
85
|
+
# separator = list.separator if list.is_a?(Sass::Script::List)
|
86
|
+
# list = list.to_a.sort
|
87
|
+
# list = list.reverse if (reverse == Sass::Script::Bool.new(true))
|
88
|
+
# return Sass::Script::List.new(list, separator)
|
89
|
+
#end
|
90
|
+
|
91
|
+
#
|
92
|
+
# reverse order a list
|
93
|
+
#
|
94
|
+
# *Parameters*:
|
95
|
+
# - <tt>$list</tt> {List} the list to reverse
|
96
|
+
# *Returns*:
|
97
|
+
# - {List} the reversed list
|
98
|
+
#
|
99
|
+
# TODO - this is failing, fix this
|
100
|
+
#def list_reverse(list)
|
101
|
+
# separator = list.separator if list.is_a?(Sass::Script::List)
|
102
|
+
# list = list.to_a.reverse
|
103
|
+
# return Sass::Script::List.new(list, separator)
|
104
|
+
#end
|
105
|
+
|
74
106
|
#
|
75
107
|
# add values(s) to a list
|
76
108
|
#
|
@@ -213,32 +245,6 @@ module Archetype::SassExtensions::Lists
|
|
213
245
|
end
|
214
246
|
Sass::Script::Functions.declare :associative_merge, [:list, :extender]
|
215
247
|
|
216
|
-
#
|
217
|
-
# given a string of styles, convert it into a key-value pair list
|
218
|
-
#
|
219
|
-
# *Parameters*:
|
220
|
-
# - <tt>$string</tt> {String} the string to convert
|
221
|
-
# *Returns*:
|
222
|
-
# - <tt>$list</tt> {List} the converted list of styles
|
223
|
-
#
|
224
|
-
def _style_string_to_list(string = '')
|
225
|
-
# convert to string and strip all comments
|
226
|
-
string = helpers.to_str(string, ' ').gsub(/\/\*[^\*\/]*\*\//, '')
|
227
|
-
# then split it on each rule
|
228
|
-
tmp = string.split(';')
|
229
|
-
styles = []
|
230
|
-
# and for each rule break it into it's key-value pairs
|
231
|
-
tmp.each do |rule|
|
232
|
-
kvp = []
|
233
|
-
rule.split(':').each do |str|
|
234
|
-
kvp.push Sass::Script::String.new(str)
|
235
|
-
end
|
236
|
-
styles.push Sass::Script::List.new(kvp, :comma)
|
237
|
-
end
|
238
|
-
# the recompose the list
|
239
|
-
return Sass::Script::List.new(styles, :comma)
|
240
|
-
end
|
241
|
-
|
242
248
|
private
|
243
249
|
def helpers
|
244
250
|
@helpers ||= Archetype::Functions::Helpers
|
@@ -3,36 +3,17 @@
|
|
3
3
|
#
|
4
4
|
module Archetype::SassExtensions::Locale
|
5
5
|
#
|
6
|
-
# get the current locale specified in config
|
6
|
+
# get the current locale specified in config
|
7
7
|
#
|
8
|
-
# *Parameters*:
|
9
|
-
# - <tt>$locales</tt> {List} the list of locales to test
|
10
8
|
# *Returns*:
|
11
|
-
# - {String
|
9
|
+
# - {String} the current locale
|
12
10
|
#
|
13
|
-
def locale
|
14
|
-
|
15
|
-
# if the locales are nil, just return the current locale
|
16
|
-
return Sass::Script::String.new(locale) if locales.nil?
|
17
|
-
locales = locales.to_a.collect{|i| i.to_s}
|
18
|
-
# add wild card support for language or territory
|
19
|
-
match = locale.match(LOCALE_PATTERN)
|
20
|
-
# language with wildcard territory
|
21
|
-
language = match[1] + '_'
|
22
|
-
# territory with wildcard language
|
23
|
-
territory = '_' + match[2]
|
24
|
-
# for each item, look it up in the alias list
|
25
|
-
locales.each do |key|
|
26
|
-
if a = locale_aliases[key]
|
27
|
-
locales.delete(key)
|
28
|
-
locales.concat(a)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
return Sass::Script::Bool.new(locales.include?(locale) || locales.include?(language) || locales.include?(territory))
|
11
|
+
def locale
|
12
|
+
return Sass::Script::String.new(Compass.configuration.locale || 'en_US')
|
32
13
|
end
|
33
14
|
|
34
15
|
#
|
35
|
-
# test a list of locales against the current locale (
|
16
|
+
# test a list of locales against the current locale (supports an alias map)
|
36
17
|
#
|
37
18
|
# *Parameters*:
|
38
19
|
# - <tt>$locales</tt> {List} the list of locales to test
|
@@ -40,9 +21,16 @@ module Archetype::SassExtensions::Locale
|
|
40
21
|
# - {Boolean} is the current locale in the list or not
|
41
22
|
#
|
42
23
|
def lang(locales)
|
43
|
-
|
24
|
+
locales = locales.to_a.collect{|i| i.to_s}
|
25
|
+
locales.each do |key|
|
26
|
+
if a = locale_aliases[key]
|
27
|
+
locales.delete(key)
|
28
|
+
locales.concat(a)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
return Sass::Script::Bool.new(locales.include?(locale.to_s))
|
44
32
|
end
|
45
|
-
|
33
|
+
|
46
34
|
#
|
47
35
|
# get the current reading direction
|
48
36
|
#
|
@@ -55,9 +43,6 @@ module Archetype::SassExtensions::Locale
|
|
55
43
|
end
|
56
44
|
|
57
45
|
private
|
58
|
-
|
59
|
-
LOCALE_PATTERN = /([a-z]{2})[-_]?([a-z]{2}?)/i
|
60
|
-
|
61
46
|
#
|
62
47
|
# provides an alias mapping for locale names
|
63
48
|
#
|
@@ -67,9 +52,8 @@ private
|
|
67
52
|
# TODO - make this easily extensible
|
68
53
|
def locale_aliases
|
69
54
|
if @locale_aliases.nil?
|
70
|
-
a = {
|
71
|
-
|
72
|
-
}
|
55
|
+
a = {}
|
56
|
+
a['CJK'] = ['ja_JP', 'ko_KR', 'zh_TW', 'zh_CN']
|
73
57
|
@locale_aliases = a
|
74
58
|
end
|
75
59
|
return @locale_aliases
|
@@ -17,7 +17,7 @@ module Archetype::SassExtensions::Styleguide
|
|
17
17
|
SPECIAL = %w(states selectors)
|
18
18
|
# these are unique CSS keys that can be exploited to provide fallback functionality by providing a second value
|
19
19
|
# e.g color: red; color: rgba(255,0,0, 0.8);
|
20
|
-
FALLBACKS = %w(background background-image background-color border border-bottom border-bottom-color border-color border-left border-left-color border-right border-right-color border-top border-top-color clip color layer-background-color outline outline-color white-space
|
20
|
+
FALLBACKS = %w(background background-image background-color border border-bottom border-bottom-color border-color border-left border-left-color border-right border-right-color border-top border-top-color clip color layer-background-color outline outline-color white-space)
|
21
21
|
ADDITIVES = FALLBACKS + [DROP, INHERIT, STYLEGUIDE]
|
22
22
|
@@archetype_styleguide_mutex = Mutex.new
|
23
23
|
# :startdoc:
|
@@ -76,7 +76,7 @@ module Archetype::SassExtensions::Styleguide
|
|
76
76
|
extensions = theme[:extensions]
|
77
77
|
return Sass::Script::Bool.new(false) if component_exists(id, theme, extension, force)
|
78
78
|
extensions.push(extension)
|
79
|
-
components[id] = (components[id] ||=
|
79
|
+
components[id] = (components[id] ||= {}).rmerge(helpers.list_to_hash(data, 1, SPECIAL, ADDITIVES))
|
80
80
|
return Sass::Script::Bool.new(true)
|
81
81
|
end
|
82
82
|
end
|
@@ -223,17 +223,16 @@ private
|
|
223
223
|
#
|
224
224
|
def extract_styles(id, modifiers, strict = false, theme = nil, context = nil)
|
225
225
|
theme = get_theme(theme)
|
226
|
-
context ||= theme[:components][id] ||
|
226
|
+
context ||= theme[:components][id] || {}
|
227
227
|
modifiers = helpers.to_str(modifiers)
|
228
|
-
return
|
228
|
+
return {} if context.nil? or context.empty?
|
229
229
|
# push on the defaults first
|
230
|
-
out = (strict ? resolve_dependents(id, context[modifiers], theme[:name], context) : context[DEFAULT]) ||
|
230
|
+
out = (strict ? resolve_dependents(id, context[modifiers], theme[:name], context) : context[DEFAULT]) || {}
|
231
231
|
out = out.clone
|
232
232
|
# if it's not strict, find anything that matched
|
233
233
|
if not strict
|
234
234
|
modifiers = modifiers.split
|
235
|
-
context.each do |
|
236
|
-
definition = [key, definition]
|
235
|
+
context.each do |definition|
|
237
236
|
modifier = definition[0]
|
238
237
|
if modifier != DEFAULT
|
239
238
|
match = true
|
@@ -255,8 +254,8 @@ private
|
|
255
254
|
SPECIAL.each do |special_key|
|
256
255
|
if out.is_a? Hash
|
257
256
|
special = out[special_key]
|
258
|
-
tmp =
|
259
|
-
(special ||
|
257
|
+
tmp = {}
|
258
|
+
(special || {}).each { |key, value| tmp[key] = extract_styles(key, key, true, theme[:name], special) }
|
260
259
|
out[special_key] = tmp if not tmp.empty?
|
261
260
|
end
|
262
261
|
end
|
@@ -290,7 +289,7 @@ private
|
|
290
289
|
# check for dropped styles
|
291
290
|
drop = value[DROP]
|
292
291
|
if not drop.nil?
|
293
|
-
tmp =
|
292
|
+
tmp = {}
|
294
293
|
if %w(all true).include?(helpers.to_str(drop)) and not keys.nil? and not keys.empty?
|
295
294
|
keys.each do |key|
|
296
295
|
tmp[key] = 'nil'
|
@@ -308,7 +307,7 @@ private
|
|
308
307
|
inherit = value[INHERIT]
|
309
308
|
if inherit and not inherit.empty?
|
310
309
|
# create a temporary object and extract the nested styles
|
311
|
-
tmp =
|
310
|
+
tmp = {}
|
312
311
|
inherit.each { |related| tmp = tmp.rmerge(extract_styles(id, related, true, theme, context)) }
|
313
312
|
# remove the inheritance key and update the styles
|
314
313
|
value.delete(INHERIT)
|
@@ -350,7 +349,7 @@ private
|
|
350
349
|
def get_styles(description, theme = nil, state = 'false')
|
351
350
|
state = helpers.to_str(state)
|
352
351
|
description = description.to_a
|
353
|
-
styles =
|
352
|
+
styles = {}
|
354
353
|
description.each do |sentence|
|
355
354
|
# get the grammar from the sentence
|
356
355
|
id, modifiers, token = grammar(sentence, theme, state)
|
@@ -21,8 +21,7 @@ module Archetype::SassExtensions::UI
|
|
21
21
|
prefix = helpers.to_str(prefix, ' ', :quotes)
|
22
22
|
prefix = '.' if prefix == 'class'
|
23
23
|
prefix = '#' if prefix == 'id'
|
24
|
-
|
25
|
-
return Sass::Script::String.new("#{prefix}archetype-uid-#{suffix}")
|
24
|
+
return Sass::Script::String.new("#{prefix}archetype-uid-#{uid}")
|
26
25
|
end
|
27
26
|
|
28
27
|
#
|
@@ -8,7 +8,7 @@ require 'sass/version'
|
|
8
8
|
#
|
9
9
|
module Archetype::SassExtensions::Version
|
10
10
|
# :stopdoc:
|
11
|
-
COMPARATOR_PATTERN = /(
|
11
|
+
COMPARATOR_PATTERN = /([neglt]+|[><=!]+)/
|
12
12
|
VERSION_PATTERN = /\d+(\.\d+)*(\.[x|\*])?/
|
13
13
|
# :startdoc:
|
14
14
|
|
@@ -60,7 +60,7 @@ private
|
|
60
60
|
# check for wild cards
|
61
61
|
wild = version.index('x')
|
62
62
|
# check the comparison
|
63
|
-
comparator = (
|
63
|
+
comparator = (comparator || [])[0] || 'eq'
|
64
64
|
eq = comparator =~ /(e|=)/
|
65
65
|
lt = comparator =~ /(l|<)/
|
66
66
|
gt = comparator =~ /(g|>)/
|
data/lib/archetype/version.rb
CHANGED
@@ -10,7 +10,7 @@ module Archetype
|
|
10
10
|
# Method borrowed from Compass. All credit goes to Chris Eppstein and other contributors
|
11
11
|
# https://github.com/chriseppstein/compass/blob/stable/lib/compass/version.rb
|
12
12
|
# \(This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum\)
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# *Returns*:
|
15
15
|
# - {String} the version of Archetype
|
16
16
|
#
|
@@ -30,7 +30,7 @@ module Archetype
|
|
30
30
|
def read_version
|
31
31
|
require 'yaml'
|
32
32
|
begin
|
33
|
-
@version = YAML
|
33
|
+
@version = YAML::load(File.read(scope('VERSION.yml')))
|
34
34
|
@version[:teeny] = @version[:patch]
|
35
35
|
@version[:string] = "#{@version[:major]}.#{@version[:minor]}"
|
36
36
|
@version[:string] << ".#{@version[:patch]}" if @version[:patch]
|