mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-07 01:45:32 +00:00
Switch to json for samples db
This commit is contained in:
11
Rakefile
11
Rakefile
@@ -8,15 +8,16 @@ Rake::TestTask.new do |t|
|
||||
end
|
||||
|
||||
|
||||
file 'lib/linguist/samples.yml' => Dir['samples/**/*'] do |f|
|
||||
file 'lib/linguist/samples.json' => Dir['samples/**/*'] do |f|
|
||||
require 'linguist/samples'
|
||||
yaml = YAML.dump(Linguist::Samples.data)
|
||||
File.open(f.name, 'w') { |io| io.write yaml }
|
||||
require 'yajl'
|
||||
json = Yajl::Encoder.encode(Linguist::Samples.data, :pretty => true)
|
||||
File.open(f.name, 'w') { |io| io.write json }
|
||||
end
|
||||
|
||||
CLOBBER.include 'lib/linguist/samples.yml'
|
||||
CLOBBER.include 'lib/linguist/samples.json'
|
||||
|
||||
task :samples => [:clobber, 'lib/linguist/samples.yml']
|
||||
task :samples => [:clobber, 'lib/linguist/samples.json']
|
||||
|
||||
namespace :classifier do
|
||||
LIMIT = 1_000
|
||||
|
||||
@@ -14,4 +14,5 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'pygments.rb', '~> 0.2.13'
|
||||
s.add_development_dependency 'json'
|
||||
s.add_development_dependency 'rake'
|
||||
s.add_development_dependency 'yajl-ruby'
|
||||
end
|
||||
|
||||
20103
lib/linguist/samples.json
Normal file
20103
lib/linguist/samples.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ module Linguist
|
||||
ROOT = File.expand_path("../../../samples", __FILE__)
|
||||
|
||||
# Path for serialized samples db
|
||||
PATH = File.expand_path('../samples.yml', __FILE__)
|
||||
PATH = File.expand_path('../samples.json', __FILE__)
|
||||
|
||||
# Hash of serialized samples object
|
||||
if File.exist?(PATH)
|
||||
|
||||
19970
lib/linguist/samples.yml
19970
lib/linguist/samples.yml
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user