clash 1.5.0 → 1.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39d92dbce4ec886753820de001ead65ecc70c7ab
4
- data.tar.gz: 5bf66afe83d476c95eb86698958e6433253b612c
3
+ metadata.gz: 5ad6ce60bb860188e99c74a0ee961fd7d878b44a
4
+ data.tar.gz: b865f8229a54faf93bf24c269c998ca54f1638d6
5
5
  SHA512:
6
- metadata.gz: 7997bbf948e49ec53adf60f533f123f53aca55e337fcfa6025f653901ea7a62c99694a0a629b541d1642a3a3facd706e999a54662b40fc6d25ac390e4ea1186e
7
- data.tar.gz: bc012514d2a41d416ee165f6eaea817ad0b624d8a89ff4eac74587b534f40ba62aa909b2c529e082568f6090af04969edf61c40951269a3046aca14c96a0d698
6
+ metadata.gz: f751c8e84d26366758b3c481b8519b736dd794ed5ebca0bb1a31c8177dac1122fc50591ece110a10ec142bd2b78514f6d387207588833bb26fb9a2bbf726e093
7
+ data.tar.gz: a5e2c48a11643a84a3f08ec0fd3b9223928c184a2f512f90a5eab51b68b603783de59eec343167d3b46b7507d47ca4d10d2e6c486316e683b4b4debd3e3c0550
data/lib/clash/helpers.rb CHANGED
@@ -63,12 +63,6 @@ module Clash
63
63
  end
64
64
  end
65
65
 
66
- def default_array(option)
67
- o = option || []
68
- o = [o] unless o.is_a?(Array)
69
- o
70
- end
71
-
72
66
  def colorize(str, color)
73
67
  if STDOUT.tty?
74
68
  str.send(color)
data/lib/clash/test.rb CHANGED
@@ -46,12 +46,24 @@ module Clash
46
46
  end
47
47
  end
48
48
 
49
- def config_octopress(file)
50
- copy_config(file, '_octopress.yml')
49
+ def config_plugin(name, file)
50
+ copy_config(file, "#{plugins_path}/#{name}/config.yml")
51
51
  end
52
52
 
53
- def config_plugin(name, file)
54
- copy_config(file, "_plugins/#{name}/config.yml")
53
+ def plugins_path
54
+ jekyll_site.plugin_manager.plugins_path.first
55
+ end
56
+
57
+ def jekyll_site
58
+ require 'jekyll'
59
+ config = {}
60
+ Array(@options['config']['jekyll'] || '_config.yml').each do |c|
61
+ config.merge!SafeYAML.load_file(c)
62
+ end
63
+ Jekyll.logger.log_level = :error
64
+ site = Jekyll::Site.new(Jekyll.configuration(config))
65
+ Jekyll.logger.log_level = :info
66
+ site
55
67
  end
56
68
 
57
69
  def copy_config(file, target)
@@ -75,15 +87,15 @@ module Clash
75
87
  def build
76
88
  options = "--trace"
77
89
 
78
- if jekyll_config = @options['config']['jekyll']
79
- options << " --config #{default_array(jekyll_config).join(',')}"
90
+ if config = @options['config']['jekyll']
91
+ options << " --config #{Array(config).join(',')}"
80
92
  end
81
93
 
82
94
  system "jekyll build #{options}"
83
95
  end
84
96
 
85
97
  def system_cmd(cmds)
86
- cmds = default_array(cmds)
98
+ cmds = Array(cmds)
87
99
  cmds.each {|cmd|
88
100
  if @options['tasks'].include?(cmd)
89
101
  system_cmd(@options['tasks'][cmd])
@@ -94,7 +106,7 @@ module Clash
94
106
  end
95
107
 
96
108
  def compare
97
- default_array(@options['compare']).each do |files|
109
+ Array(@options['compare']).each do |files|
98
110
  f = files.gsub(',',' ').split
99
111
 
100
112
  differ = Diff.new(f.first, f.last, context: @options['context'])
@@ -109,7 +121,7 @@ module Clash
109
121
  end
110
122
 
111
123
  def enforce_missing
112
- default_array(@options['enforce_missing']).each do |file|
124
+ Array(@options['enforce_missing']).each do |file|
113
125
  if File.exists?(file)
114
126
  message = yellowit("\nFile #{file} shouldn't exist.") + "\n But it does!"
115
127
  @test_failures << message
data/lib/clash/tests.rb CHANGED
@@ -77,7 +77,7 @@ module Clash
77
77
  delete_tests = []
78
78
  @options[:only] = expand_list_of_numbers(@options[:only])
79
79
 
80
- tests = default_array(@clashfile).map do |test|
80
+ tests = @clashfile.map do |test|
81
81
  if !test['tasks'].nil?
82
82
  @tasks.merge! test['tasks']
83
83
  delete_tests << test
@@ -104,7 +104,9 @@ module Clash
104
104
  # Find the config file (fall back to legacy filename)
105
105
  if path = config_path || config_path('.clash.yml')
106
106
  read_test_line_numbers(path)
107
- SafeYAML.load_file(path)
107
+ config = SafeYAML.load_file(path)
108
+ config = [config] unless config.is_a?(Array)
109
+ config
108
110
  else
109
111
  # If config file still not found, complain
110
112
  raise "Config file #{@options[:file]} not found."
data/lib/clash/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Clash
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy