primetable 1.1.0 → 1.1.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: f529942f1f2d716e11f9609269616f35df535a74
4
- data.tar.gz: 7edabbe0d6900024c84ea305916e1f0febab1631
3
+ metadata.gz: ae2aa3d6779044cdd1d19943acdd0a3e6e01ff9a
4
+ data.tar.gz: 182c03f1034484cb7e763f72a9f42ec674544847
5
5
  SHA512:
6
- metadata.gz: 00104a159da8a03925648e49f8ef36ab92d00e1eb76cded4d178c1b2847f26bc00ae00e2650a5c6aa1b8050c229213f6953268a6521ecbef23c558e96588093a
7
- data.tar.gz: bb899a0aa5e6d5d646e23604b07b8dae355f2f440e385041caf602ba859175546349a64ecc4c4e337b339e25f0c65abf9fc95028599349d11b54601ede89355f
6
+ metadata.gz: a9223cd8283e1595f9f7ee75ccaeb0dcad8908879cb083df062667898793634bee90ec736ea48d3bd6f34b73f5f418922ce8f6579441ccf3febafe9afd839632
7
+ data.tar.gz: e9f6e1c7575be3ad6d7e0515d2b2cb687337cb892c5e80a2da49485cbbeeee903b0145d8964b7ce1965b8be71987faad56aeb9b8d0a39e00ba1681e0ec4e8a01
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- primetable (1.0.0)
4
+ primetable (1.1.0)
5
5
  formatador (~> 0.2, >= 0.2.5)
6
6
  therubyracer (~> 0.12, >= 0.12.2)
7
7
 
@@ -43,7 +43,7 @@ PLATFORMS
43
43
  DEPENDENCIES
44
44
  bundler (~> 1.6)
45
45
  primetable!
46
- pry
46
+ pry (~> 0.10, >= 0.10.2)
47
47
  rake (~> 10.4, >= 10.4.2)
48
48
  rspec (~> 3.4, >= 3.4.0)
49
49
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # PrimeTable
1
+ # PrimeTable v1.1.0
2
2
 
3
3
  **Prints a multiplication table of N primes to STDOUT**
4
4
 
@@ -15,13 +15,15 @@
15
15
  Specific options:
16
16
  -f F First prime (default is 2, limit is 2000003 w/ -m load|fast, 9007199254740727 w/ -m calc)
17
17
  -n N Number of primes for which you wish to generate a table
18
- -m, --method METHOD Select method of generating primes (fast|load|calc) (default is 'calc')
18
+ -m, --method METHOD Select method of generating primes (fast|load|calc)** (default is 'calc')
19
19
  -t, --time Display run time
20
20
 
21
21
  Common options:
22
22
  -h, --help Show this message
23
23
  -v, --version Show version
24
24
 
25
+ ** NOTE: The (so-called) 'fast' and 'load' prime methods are DEPRECATED. Use the default or -m 'calc'.
26
+
25
27
  ## Status
26
28
 
27
29
  [![Build Status](https://travis-ci.org/day/primetable.svg?branch=master)](https://travis-ci.org/day/primetable)
@@ -4,7 +4,6 @@ require 'primetable'
4
4
  require 'timer'
5
5
  require 'optparse'
6
6
  require 'ostruct'
7
- require 'pry'
8
7
 
9
8
  class OptParse
10
9
 
@@ -160,6 +159,11 @@ if options.flags.version
160
159
  messages.push("PrimeTable v#{PrimeTable::VERSION}")
161
160
  end
162
161
 
162
+ # Deprecating the 'fast' and 'load' prime_methods
163
+ if options.flags.prime_method != :calc
164
+ messages.push("Warning! The (so-called) 'fast' and 'load' prime_methods are DEPRECATED. Use the default or -m 'calc'.")
165
+ end
166
+
163
167
  # TODO: DRY this up! I'm repeating myself a lot right here.
164
168
  if ARGS != ["-h"]
165
169
  if options.flags.time
@@ -1,9 +1,9 @@
1
- # Require modules from the lib/primetable directory...right now it's just our VERSION constant
2
- Dir["#{File.dirname(__FILE__)}/primetable/**/*.rb"].each { |f| require(f) }
1
+ # Require modules from the lib/primetable directory...a PRIMES constant, and a VERSION constant
2
+ ROOT_DIR = "#{File.dirname(File.expand_path('..', __FILE__))}"
3
+ Dir["#{ROOT_DIR}/lib/primetable/**/*.rb"].each { |f| require(f) }
3
4
 
4
5
  # This is needed for load_primes method, which loads data from a file.
5
6
  require "yaml"
6
- require "pry"
7
7
 
8
8
  # This is used in the display_table method to...um, display the table ;-)
9
9
  require "formatador"
@@ -114,7 +114,7 @@ class PrimeTable
114
114
 
115
115
  grep_result = []
116
116
  while grep_result == []
117
- grep_result = `grep -n -e "#{wb_before}#{first}#{wb_after}" data/prime.dat`.split(":")
117
+ grep_result = `grep -n -e "#{wb_before}#{first}#{wb_after}" #{ROOT_DIR}/data/prime.dat`.split(":")
118
118
  if grep_result == []
119
119
  first = first + 1
120
120
  end
@@ -153,7 +153,7 @@ class PrimeTable
153
153
  # some astronomical prime, we won't seize up the CPU forever. 7000ms is arbitrary.
154
154
  calc_primes_js = V8::Context.new timeout: 7000
155
155
  File.open("js/prime.js") do |file|
156
- calc_primes_js.eval(file, "js/prime.js")
156
+ calc_primes_js.eval(file, "#{ROOT_DIR}/js/prime.js")
157
157
  end
158
158
  primes_js = calc_primes_js.eval("generatePrimes(#{first},#{count})")
159
159
  YAML::load("[#{primes_js}]")
@@ -1,3 +1,3 @@
1
1
  class PrimeTable
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -73,6 +73,10 @@ Common options:
73
73
 
74
74
  end
75
75
 
76
+ it 'knows where it is (has a root dir)' do
77
+ expect(ROOT_DIR.split("/")[-1]).to eq "primetable"
78
+ end
79
+
76
80
  it 'has a version number' do
77
81
  expect(PrimeTable::VERSION).not_to be nil
78
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primetable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Day Davis Waterbury