ffi-yajl 2.2.3 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Lamont Granquist
2
- # Copyright (c) 2015 Chef Software, Inc.
2
+ # Copyright (c) 2015-2017, Chef Software Inc.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -20,8 +20,8 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
- require 'date'
24
- require 'stringio'
23
+ require "date"
24
+ require "stringio" unless defined?(StringIO)
25
25
 
26
26
  module FFI_Yajl
27
27
  module FFI
@@ -73,7 +73,7 @@ class Hash
73
73
  end
74
74
  else
75
75
  if ( status = FFI_Yajl.yajl_gen_map_open(yajl_gen) ) != 0
76
- FFI_Yajl::Encoder.raise_error_for_status(status, '{')
76
+ FFI_Yajl::Encoder.raise_error_for_status(status, "{")
77
77
  end
78
78
  each do |key, value|
79
79
  # Perf Fix: mutate state hash rather than creating new copy
@@ -83,7 +83,7 @@ class Hash
83
83
  value.ffi_yajl(yajl_gen, state)
84
84
  end
85
85
  if ( status = FFI_Yajl.yajl_gen_map_close(yajl_gen) ) != 0
86
- FFI_Yajl::Encoder.raise_error_for_status(status, '}')
86
+ FFI_Yajl::Encoder.raise_error_for_status(status, "}")
87
87
  end
88
88
  end
89
89
  end
@@ -98,13 +98,13 @@ class Array
98
98
  end
99
99
  else
100
100
  if ( status = FFI_Yajl.yajl_gen_array_open(yajl_gen) ) != 0
101
- FFI_Yajl::Encoder.raise_error_for_status(status, '[')
101
+ FFI_Yajl::Encoder.raise_error_for_status(status, "[")
102
102
  end
103
103
  each do |value|
104
104
  value.ffi_yajl(yajl_gen, state)
105
105
  end
106
106
  if ( status = FFI_Yajl.yajl_gen_array_close(yajl_gen) ) != 0
107
- FFI_Yajl::Encoder.raise_error_for_status(status, ']')
107
+ FFI_Yajl::Encoder.raise_error_for_status(status, "]")
108
108
  end
109
109
  end
110
110
  end
@@ -155,30 +155,13 @@ class FalseClass
155
155
  end
156
156
  end
157
157
 
158
- class Fixnum
158
+ class Integer
159
159
  def ffi_yajl(yajl_gen, state)
160
160
  str = to_s
161
161
  if str == "NaN" || str == "Infinity" || str == "-Infinity"
162
162
  raise ::FFI_Yajl::EncodeError, "'#{str}' is an invalid number"
163
163
  end
164
- if state[:processing_key]
165
- if ( status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize) ) != 0
166
- FFI_Yajl::Encoder.raise_error_for_status(status, str)
167
- end
168
- else
169
- if ( status = FFI_Yajl.yajl_gen_integer(yajl_gen, self) ) != 0
170
- FFI_Yajl::Encoder.raise_error_for_status(status, str)
171
- end
172
- end
173
- end
174
- end
175
164
 
176
- class Bignum
177
- def ffi_yajl(yajl_gen, state)
178
- str = to_s
179
- if str == "NaN" || str == "Infinity" || str == "-Infinity"
180
- raise ::FFI_Yajl::EncodeError, "'#{str}' is an invalid number"
181
- end
182
165
  if state[:processing_key]
183
166
  if ( status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize) ) != 0
184
167
  FFI_Yajl::Encoder.raise_error_for_status(status, str)
@@ -197,6 +180,7 @@ class Float
197
180
  if str == "NaN" || str == "Infinity" || str == "-Infinity"
198
181
  raise ::FFI_Yajl::EncodeError, "'#{str}' is an invalid number"
199
182
  end
183
+
200
184
  if state[:processing_key]
201
185
  if ( status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize) ) != 0
202
186
  FFI_Yajl::Encoder.raise_error_for_status(status, str)
@@ -265,7 +249,7 @@ end
265
249
  # I feel dirty
266
250
  class Object
267
251
  def ffi_yajl(yajl_gen, state)
268
- if !state[:processing_key] && self.respond_to?(:to_json)
252
+ if !state[:processing_key] && respond_to?(:to_json)
269
253
  str = to_json(state[:json_opts])
270
254
  # #yajl_gen_number outputs a string without quotes around it
271
255
  status = FFI_Yajl.yajl_gen_number(yajl_gen, str, str.bytesize)
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Lamont Granquist
2
- # Copyright (c) 2015 Chef Software, Inc.
2
+ # Copyright (c) 2015-2018, Chef Software Inc.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -23,13 +23,14 @@
23
23
  module FFI_Yajl
24
24
  module FFI
25
25
  module Parser
26
- def set_value(val) # rubocop:disable Style/AccessorMethodName
26
+ def set_value(val) # rubocop:disable Naming/AccessorMethodName
27
27
  case stack.last
28
28
  when Hash
29
29
  raise FFI_Yajl::ParseError, "internal error: missing key in parse" if key.nil?
30
30
  if @opts[:unique_key_checking] && stack.last.key?(key)
31
31
  raise FFI_Yajl::ParseError, "repeated key: #{key}"
32
32
  end
33
+
33
34
  stack.last[key] = val
34
35
  when Array
35
36
  stack.last.push(val)
@@ -55,29 +56,29 @@ module FFI_Yajl
55
56
  set_value(nil)
56
57
  1
57
58
  end
58
- @boolean_callback = ::FFI::Function.new(:int, [:pointer, :int]) do |ctx, boolval|
59
+ @boolean_callback = ::FFI::Function.new(:int, %i{pointer int}) do |ctx, boolval|
59
60
  set_value(boolval == 1 ? true : false)
60
61
  1
61
62
  end
62
- @integer_callback = ::FFI::Function.new(:int, [:pointer, :long_long]) do |ctx, intval|
63
+ @integer_callback = ::FFI::Function.new(:int, %i{pointer long_long}) do |ctx, intval|
63
64
  set_value(intval)
64
65
  1
65
66
  end
66
- @number_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t ]) do |ctx, stringval, stringlen|
67
+ @number_callback = ::FFI::Function.new(:int, %i{pointer string size_t}) do |ctx, stringval, stringlen|
67
68
  s = stringval.slice(0, stringlen)
68
- s.force_encoding('UTF-8') if defined? Encoding
69
+ s.force_encoding("UTF-8") if defined? Encoding
69
70
  # XXX: I can't think of a better way to do this right now. need to call to_f if and only if its a float.
70
71
  v = ( s =~ /[\.eE]/ ) ? s.to_f : s.to_i
71
72
  set_value(v)
72
73
  1
73
74
  end
74
- @double_callback = ::FFI::Function.new(:int, [:pointer, :double]) do |ctx, doubleval|
75
+ @double_callback = ::FFI::Function.new(:int, %i{pointer double}) do |ctx, doubleval|
75
76
  set_value(doubleval)
76
77
  1
77
78
  end
78
- @string_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t]) do |ctx, stringval, stringlen|
79
+ @string_callback = ::FFI::Function.new(:int, %i{pointer string size_t}) do |ctx, stringval, stringlen|
79
80
  s = stringval.slice(0, stringlen)
80
- s.force_encoding('UTF-8') if defined? Encoding
81
+ s.force_encoding("UTF-8") if defined? Encoding
81
82
  set_value(s)
82
83
  1
83
84
  end
@@ -86,9 +87,9 @@ module FFI_Yajl
86
87
  stack.push({})
87
88
  1
88
89
  end
89
- @map_key_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t]) do |ctx, key, keylen|
90
+ @map_key_callback = ::FFI::Function.new(:int, %i{pointer string size_t}) do |ctx, key, keylen|
90
91
  s = key.slice(0, keylen)
91
- s.force_encoding('UTF-8') if defined? Encoding
92
+ s.force_encoding("UTF-8") if defined? Encoding
92
93
  self.key = @opts[:symbolize_keys] ? s.to_sym : s
93
94
  1
94
95
  end
@@ -143,12 +144,12 @@ module FFI_Yajl
143
144
  ::FFI_Yajl.yajl_config(yajl_handle, :yajl_allow_partial_values, :int, 1)
144
145
  end
145
146
 
146
- if ( ::FFI_Yajl.yajl_parse(yajl_handle, str, str.bytesize) != :yajl_status_ok )
147
+ if ::FFI_Yajl.yajl_parse(yajl_handle, str, str.bytesize) != :yajl_status_ok
147
148
  # FIXME: dup the error and call yajl_free_error?
148
149
  error = ::FFI_Yajl.yajl_get_error(yajl_handle, 1, str, str.bytesize)
149
150
  raise ::FFI_Yajl::ParseError, error
150
151
  end
151
- if ( ::FFI_Yajl.yajl_complete_parse(yajl_handle) != :yajl_status_ok )
152
+ if ::FFI_Yajl.yajl_complete_parse(yajl_handle) != :yajl_status_ok
152
153
  # FIXME: dup the error and call yajl_free_error?
153
154
  error = ::FFI_Yajl.yajl_get_error(yajl_handle, 1, str, str.bytesize)
154
155
  raise ::FFI_Yajl::ParseError, error
@@ -20,7 +20,7 @@
20
20
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
- require 'libyajl2'
23
+ require "libyajl2"
24
24
 
25
25
  # Mixin for use in finding the right yajl library on the system. The 'caller'
26
26
  # needs to also mixin either the FFI module or the DLopen module. Those are
@@ -34,16 +34,16 @@ module FFI_Yajl
34
34
  # Stub for tests to override the host_os
35
35
  #
36
36
  # @api private
37
- # @return Array<String> lower case ruby host_os string
37
+ # @return [Array<String>] lower case ruby host_os string
38
38
  def host_os
39
- RbConfig::CONFIG['host_os'].downcase
39
+ RbConfig::CONFIG["host_os"].downcase
40
40
  end
41
41
 
42
42
  # Array of yajl library names on the platform. Some platforms like Windows
43
43
  # and Mac may have different names/extensions.
44
44
  #
45
45
  # @api private
46
- # @return Array<String> Array of yajl library names for platform
46
+ # @return [Array<String>] Array of yajl library names for platform
47
47
  def library_names
48
48
  case host_os
49
49
  when /mingw|mswin/
@@ -63,7 +63,7 @@ module FFI_Yajl
63
63
  # the filesystem. May return an empty array.
64
64
  #
65
65
  # @api private
66
- # @return Array<String> Array of full paths to libyajl2 gem libraries
66
+ # @return [Array<String>] Array of full paths to libyajl2 gem libraries
67
67
  def expanded_library_names
68
68
  library_names.map do |libname|
69
69
  pathname = File.expand_path(File.join(Libyajl2.opt_path, libname))
@@ -103,7 +103,7 @@ module FFI_Yajl
103
103
  rescue LoadError
104
104
  end
105
105
  end
106
- ffi_lib 'yajl' unless found
106
+ ffi_lib "yajl" unless found
107
107
  end
108
108
  end
109
109
  end
@@ -65,10 +65,10 @@ module FFI_Yajl
65
65
  raise ArgumentError, "options check_utf8 and dont_validate_strings are both true which conflict"
66
66
  end
67
67
 
68
- yajl_opts[:yajl_allow_comments] = true
68
+ yajl_opts[:yajl_allow_comments] = true
69
69
 
70
70
  if @opts.key?(:allow_comments)
71
- yajl_opts[:yajl_allow_comments] = @opts[:allow_comments]
71
+ yajl_opts[:yajl_allow_comments] = @opts[:allow_comments]
72
72
  end
73
73
 
74
74
  yajl_opts[:yajl_dont_validate_strings] = (@opts[:check_utf8] == false || @opts[:dont_validate_strings])
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Lamont Granquist
2
- # Copyright (c) 2015 Chef Software, Inc.
2
+ # Copyright:: Copyright (c) Chef Software Inc.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -21,5 +21,5 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
23
  module FFI_Yajl
24
- VERSION = "2.2.3"
24
+ VERSION = "2.4.0".freeze
25
25
  end
metadata CHANGED
@@ -1,115 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-yajl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lamont Granquist
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '10.1'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '10.1'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.99'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.99'
41
- - !ruby/object:Gem::Dependency
42
- name: pry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0.9'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0.9'
55
- - !ruby/object:Gem::Dependency
56
- name: rake-compiler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.8.3
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.8.3
69
- - !ruby/object:Gem::Dependency
70
- name: mime-types
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.16'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.16'
83
13
  - !ruby/object:Gem::Dependency
84
14
  name: libyajl2
85
15
  requirement: !ruby/object:Gem::Requirement
86
16
  requirements:
87
- - - "~>"
17
+ - - ">="
88
18
  - !ruby/object:Gem::Version
89
19
  version: '1.2'
90
20
  type: :runtime
91
21
  prerelease: false
92
22
  version_requirements: !ruby/object:Gem::Requirement
93
23
  requirements:
94
- - - "~>"
24
+ - - ">="
95
25
  - !ruby/object:Gem::Version
96
26
  version: '1.2'
97
- - !ruby/object:Gem::Dependency
98
- name: ffi
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.5'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.5'
111
27
  description: Ruby FFI wrapper around YAJL 2.x
112
- email: lamont@getchef.com
28
+ email: lamont@chef.io
113
29
  executables:
114
30
  - ffi-yajl-bench
115
31
  extensions:
@@ -122,7 +38,6 @@ extra_rdoc_files:
122
38
  files:
123
39
  - LICENSE
124
40
  - README.md
125
- - Rakefile
126
41
  - bin/ffi-yajl-bench
127
42
  - ext/ffi_yajl/ext/dlopen/dlopen.c
128
43
  - ext/ffi_yajl/ext/dlopen/extconf.rb
@@ -161,15 +76,11 @@ files:
161
76
  - lib/ffi_yajl/parser.rb
162
77
  - lib/ffi_yajl/platform.rb
163
78
  - lib/ffi_yajl/version.rb
164
- - spec/ffi_yajl/encoder_spec.rb
165
- - spec/ffi_yajl/map_library_name_spec.rb
166
- - spec/ffi_yajl/parser_spec.rb
167
- - spec/spec_helper.rb
168
79
  homepage: http://github.com/chef/ffi-yajl
169
80
  licenses:
170
- - Apache-2.0
81
+ - MIT
171
82
  metadata: {}
172
- post_install_message:
83
+ post_install_message:
173
84
  rdoc_options: []
174
85
  require_paths:
175
86
  - lib
@@ -177,16 +88,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
88
  requirements:
178
89
  - - ">="
179
90
  - !ruby/object:Gem::Version
180
- version: 1.9.3
91
+ version: '2.2'
181
92
  required_rubygems_version: !ruby/object:Gem::Requirement
182
93
  requirements:
183
94
  - - ">="
184
95
  - !ruby/object:Gem::Version
185
96
  version: '0'
186
97
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.4.8
189
- signing_key:
98
+ rubygems_version: 3.2.3
99
+ signing_key:
190
100
  specification_version: 4
191
101
  summary: Ruby FFI wrapper around YAJL 2.x
192
102
  test_files: []
data/Rakefile DELETED
@@ -1,179 +0,0 @@
1
- $LOAD_PATH << File.expand_path(File.join(File.dirname( __FILE__ ), "lib"))
2
-
3
- require 'rspec/core/rake_task'
4
- require 'rubygems/package_task'
5
- require 'rake/extensiontask'
6
- require 'ffi_yajl/version'
7
- require 'github_changelog_generator/task'
8
-
9
- Dir[File.expand_path("../*gemspec", __FILE__)].reverse_each do |gemspec_path|
10
- gemspec = eval(IO.read(gemspec_path))
11
- Gem::PackageTask.new(gemspec).define
12
- end
13
-
14
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
15
- config.since_tag = '1.0.1'
16
- config.exclude_labels = %w{duplicate question invalid wontfix changelog_skip}
17
- end
18
-
19
- desc "Build it and ship it"
20
- task ship: [:clean, :gem] do
21
- sh("git tag #{FFI_Yajl::VERSION}")
22
- sh("git push --tags")
23
- Dir[File.expand_path("../pkg/*.gem", __FILE__)].reverse_each do |built_gem|
24
- sh("gem push #{built_gem}")
25
- end
26
- end
27
-
28
- unix_gemspec = eval(File.read("ffi-yajl.gemspec"))
29
-
30
- task :clean do
31
- sh "rm -f Gemfile.lock"
32
- sh "rm -rf pkg/* tmp/* .bundle lib/ffi_yajl/ext/*"
33
- end
34
-
35
- desc "install the gem locally"
36
- task install: [:package] do
37
- if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
38
- sh %{gem install pkg/#{unix_gemspec.name}-#{unix_gemspec.version}-universal-java.gem}
39
- else
40
- sh %{gem install pkg/#{unix_gemspec.name}-#{unix_gemspec.version}.gem}
41
- end
42
- end
43
-
44
- spec = Gem::Specification.load('ffi-yajl.gemspec')
45
-
46
- Rake::ExtensionTask.new do |ext|
47
- ext.name = 'encoder'
48
- ext.lib_dir = 'lib/ffi_yajl/ext'
49
- ext.ext_dir = 'ext/ffi_yajl/ext/encoder'
50
- ext.gem_spec = spec
51
- end
52
-
53
- Rake::ExtensionTask.new do |ext|
54
- ext.name = 'parser'
55
- ext.lib_dir = 'lib/ffi_yajl/ext'
56
- ext.ext_dir = 'ext/ffi_yajl/ext/parser'
57
- ext.gem_spec = spec
58
- end
59
-
60
- Rake::ExtensionTask.new do |ext|
61
- ext.name = 'dlopen'
62
- ext.lib_dir = 'lib/ffi_yajl/ext'
63
- ext.ext_dir = 'ext/ffi_yajl/ext/dlopen'
64
- ext.gem_spec = spec
65
- end
66
-
67
- #
68
- # test tasks
69
- #
70
-
71
- desc "Run all specs against both extensions"
72
- task :spec do
73
- Rake::Task["spec:ffi"].invoke
74
- if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
75
- Rake::Task["spec:ext"].invoke
76
- end
77
- end
78
-
79
- namespace :spec do
80
- desc "Run all specs against ffi extension"
81
- RSpec::Core::RakeTask.new(:ffi) do |t|
82
- ENV['FORCE_FFI_YAJL'] = "ffi"
83
- t.pattern = FileList['spec/**/*_spec.rb']
84
- end
85
- if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
86
- desc "Run all specs again c extension"
87
- RSpec::Core::RakeTask.new(:ext) do |t|
88
- ENV['FORCE_FFI_YAJL'] = "ext"
89
- t.pattern = FileList['spec/**/*_spec.rb']
90
- end
91
- end
92
- end
93
-
94
- if RUBY_VERSION.to_f >= 1.9
95
- namespace :integration do
96
- begin
97
- require 'kitchen'
98
- rescue LoadError
99
- task :vagrant do
100
- puts "test-kitchen gem is not installed"
101
- end
102
- task :cloud do
103
- puts "test-kitchen gem is not installed"
104
- end
105
- else
106
- desc 'Run Test Kitchen with Vagrant'
107
- task :vagrant do
108
- Kitchen.logger = Kitchen.default_file_logger
109
- Kitchen::Config.new.instances.each do |instance|
110
- instance.test(:always)
111
- end
112
- end
113
-
114
- desc 'Run Test Kitchen with cloud plugins'
115
- task :cloud do
116
- if ENV['TRAVIS_PULL_REQUEST'] != 'true'
117
- ENV['KITCHEN_YAML'] = '.kitchen.cloud.yml'
118
- sh "kitchen test --concurrency 4"
119
- end
120
- end
121
- end
122
- end
123
- namespace :style do
124
- desc 'Run Ruby style checks'
125
- begin
126
- require 'rubocop/rake_task'
127
- rescue LoadError
128
- task :rubocop do
129
- puts "rubocop gem is not installed"
130
- end
131
- else
132
- RuboCop::RakeTask.new(:rubocop) do |t|
133
- t.fail_on_error = false
134
- end
135
- end
136
-
137
- desc 'Run Ruby smell checks'
138
- begin
139
- require 'reek/rake/task'
140
- rescue LoadError
141
- task :reek do
142
- puts "reek gem is not installed"
143
- end
144
- else
145
- Reek::Rake::Task.new(:reek) do |t|
146
- t.fail_on_error = false
147
- # t.config_files = '.reek.yml'
148
- end
149
- end
150
- end
151
- else
152
- namespace :integration do
153
- task :vagrant do
154
- puts "test-kitchen unsupported on ruby 1.8"
155
- end
156
- task :cloud do
157
- puts "test-kitchen unsupported on ruby 1.8"
158
- end
159
- end
160
- namespace :style do
161
- task :rubocop do
162
- puts "rubocop unsupported on ruby 1.8"
163
- end
164
- task :reek do
165
- puts "reek unsupported on ruby 1.8"
166
- end
167
- end
168
- end
169
-
170
- desc 'Run all style checks'
171
- task style: ['style:rubocop', 'style:reek']
172
-
173
- desc 'Run style + spec tests by default on travis'
174
- task travis: %w{style spec}
175
-
176
- desc 'Run style, spec and test kichen on travis'
177
- task travis_all: ['style', 'spec', 'integration:cloud']
178
-
179
- task default: ['style', 'spec', 'integration:vagrant']