rspec and memory_profiler
This commit is contained in:
		
							parent
							
								
									639e200a83
								
							
						
					
					
						commit
						d09d968915
					
				
					 7 changed files with 18 additions and 22 deletions
				
			
		
							
								
								
									
										2
									
								
								Gemfile
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								Gemfile
									
										
									
									
									
								
							| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
source 'https://rubygems.org'
 | 
					source 'https://rubygems.org'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Specify your gem's dependencies in libtcod.gemspec
 | 
					# Specify your gem's dependencies in twitter_ebooks.gemspec
 | 
				
			||||||
gemspec
 | 
					gemspec
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ module Ebooks
 | 
				
			||||||
      lines.each do |l|
 | 
					      lines.each do |l|
 | 
				
			||||||
        next if l.start_with?('#') # Remove commented lines
 | 
					        next if l.start_with?('#') # Remove commented lines
 | 
				
			||||||
        next if l.include?('RT') || l.include?('MT') # Remove soft retweets
 | 
					        next if l.include?('RT') || l.include?('MT') # Remove soft retweets
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
        if l.include?('@')
 | 
					        if l.include?('@')
 | 
				
			||||||
          mentions << l
 | 
					          mentions << l
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,19 +0,0 @@
 | 
				
			||||||
#!/usr/bin/env ruby
 | 
					 | 
				
			||||||
# encoding: utf-8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
require 'json'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
freqmap = {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
data = File.read("data/ANC-all-count.txt")
 | 
					 | 
				
			||||||
data = data.unpack("C*").pack("U*")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
data.lines.each do |l|
 | 
					 | 
				
			||||||
  vals = l.split("\t")
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  freqmap[vals[0]] = vals[-1].to_i
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
File.open("data/wordfreq.json", 'w') do |f|
 | 
					 | 
				
			||||||
  f.write(JSON.dump(freqmap))
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								spec/data/0xabad1dea.model
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								spec/data/0xabad1dea.model
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										8
									
								
								spec/model_spec.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								spec/model_spec.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					require 'spec_helper'
 | 
				
			||||||
 | 
					require 'objspace'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe Ebooks::Model do
 | 
				
			||||||
 | 
					  it "does stuff" do
 | 
				
			||||||
 | 
					    model = Ebooks::Model.load(path("data/0xabad1dea.model"))
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										5
									
								
								spec/spec_helper.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								spec/spec_helper.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					require 'twitter_ebooks'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def path(relpath)
 | 
				
			||||||
 | 
					  File.join(File.dirname(__FILE__), relpath)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,9 @@ Gem::Specification.new do |gem|
 | 
				
			||||||
  gem.require_paths = ["lib"]
 | 
					  gem.require_paths = ["lib"]
 | 
				
			||||||
  gem.version       = Ebooks::VERSION
 | 
					  gem.version       = Ebooks::VERSION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  gem.add_runtime_dependency 'minitest'
 | 
					  gem.add_development_dependency 'rspec'
 | 
				
			||||||
 | 
					  gem.add_development_dependency 'memory_profiler'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  gem.add_runtime_dependency 'twitter', '~> 4.5'
 | 
					  gem.add_runtime_dependency 'twitter', '~> 4.5'
 | 
				
			||||||
  gem.add_runtime_dependency 'tweetstream', '= 2.5'
 | 
					  gem.add_runtime_dependency 'tweetstream', '= 2.5'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue