hanoi-jane 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +2 -56
- data/LICENSE.md +2 -2
- data/README.md +9 -9
- data/Rakefile +2 -2
- data/bin/console +4 -4
- data/hanoi-jane.gemspec +2 -2
- data/lib/hanoi/jane/cli.rb +3 -3
- data/lib/hanoi/jane/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47d9df7d5b1ffc9aa528c0ba12d240f80cba1510
|
4
|
+
data.tar.gz: 81ff470bb63ad572dbf2ee7ab13153f525840f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da053bdfbc0609ecf648af02b3a0886eb41676048a0151698d89fb4454146498fd6364c385ce342c123e92802f991e12cab2de5021e4942da956fc2e52b3cbb
|
7
|
+
data.tar.gz: e06a740452bf824d5c861954bf55fca93850932cd1be40d8dbd0cd6effc53a18185129545a0afdb8b8fd7d7d4ce121d8dc77c93ca3d2141326d8ed12386e605c
|
data/Guardfile
CHANGED
@@ -1,31 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
## Uncomment and set this to only include directories you want to watch
|
5
|
-
# directories %w(app lib config test spec features) \
|
6
|
-
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
-
|
8
|
-
## Note: if you are using the `directories` clause above and you are not
|
9
|
-
## watching the project directory ('.'), then you will want to move
|
10
|
-
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
-
#
|
12
|
-
# $ mkdir config
|
13
|
-
# $ mv Guardfile config/
|
14
|
-
# $ ln -s config/Guardfile .
|
15
|
-
#
|
16
|
-
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
-
|
18
|
-
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
-
# rspec may be run, below are examples of the most common uses.
|
20
|
-
# * bundler: 'bundle exec rspec'
|
21
|
-
# * bundler binstubs: 'bin/rspec'
|
22
|
-
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
-
# installed the spring binstubs per the docs)
|
24
|
-
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
-
# * 'just' rspec: 'rspec'
|
26
|
-
|
27
|
-
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
-
require "guard/rspec/dsl"
|
1
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
2
|
+
require 'guard/rspec/dsl'
|
29
3
|
dsl = Guard::RSpec::Dsl.new(self)
|
30
4
|
|
31
5
|
# Feel free to open issues for suggestions and improvements
|
@@ -39,32 +13,4 @@ guard :rspec, cmd: "bundle exec rspec" do
|
|
39
13
|
# Ruby files
|
40
14
|
ruby = dsl.ruby
|
41
15
|
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
-
|
43
|
-
# Rails files
|
44
|
-
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
-
dsl.watch_spec_files_for(rails.app_files)
|
46
|
-
dsl.watch_spec_files_for(rails.views)
|
47
|
-
|
48
|
-
watch(rails.controllers) do |m|
|
49
|
-
[
|
50
|
-
rspec.spec.call("routing/#{m[1]}_routing"),
|
51
|
-
rspec.spec.call("controllers/#{m[1]}_controller"),
|
52
|
-
rspec.spec.call("acceptance/#{m[1]}")
|
53
|
-
]
|
54
|
-
end
|
55
|
-
|
56
|
-
# Rails config changes
|
57
|
-
watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
-
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
-
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
-
|
61
|
-
# Capybara features specs
|
62
|
-
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
63
|
-
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
64
|
-
|
65
|
-
# Turnip features and steps
|
66
|
-
watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
-
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
-
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
-
end
|
70
16
|
end
|
data/LICENSE.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
## Copyright (c) 2017 pikesley
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
7
7
|
in the Software without restriction, including without limitation the rights
|
8
8
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
@@ -12,7 +12,7 @@ furnished to do so, subject to the following conditions:
|
|
12
12
|
The above copyright notice and this permission notice shall be included in
|
13
13
|
all copies or substantial portions of the Software.
|
14
14
|
|
15
|
-
THE SOFTWARE IS PROVIDED
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
data/README.md
CHANGED
@@ -45,15 +45,15 @@ end
|
|
45
45
|
which will give you:
|
46
46
|
|
47
47
|
```ruby
|
48
|
-
{:stacks=>[[1, 0], [], []], :moves=>0, :flipped=>nil, :ternary=>
|
49
|
-
{:stacks=>[[1], [0], []], :moves=>1, :flipped=>0, :ternary=>
|
50
|
-
{:stacks=>[[1], [], [0]], :moves=>2, :flipped=>0, :ternary=>
|
51
|
-
{:stacks=>[[], [1], [0]], :moves=>3, :flipped=>1, :ternary=>
|
52
|
-
{:stacks=>[[], [1, 0], []], :moves=>4, :flipped=>0, :ternary=>
|
53
|
-
{:stacks=>[[0], [1], []], :moves=>5, :flipped=>0, :ternary=>
|
54
|
-
{:stacks=>[[0], [], [1]], :moves=>6, :flipped=>1, :ternary=>
|
55
|
-
{:stacks=>[[], [0], [1]], :moves=>7, :flipped=>0, :ternary=>
|
56
|
-
{:stacks=>[[], [], [1, 0]], :moves=>8, :flipped=>0, :ternary=>
|
48
|
+
{:stacks=>[[1, 0], [], []], :moves=>0, :flipped=>nil, :ternary=>'00'}
|
49
|
+
{:stacks=>[[1], [0], []], :moves=>1, :flipped=>0, :ternary=>'01'}
|
50
|
+
{:stacks=>[[1], [], [0]], :moves=>2, :flipped=>0, :ternary=>'02'}
|
51
|
+
{:stacks=>[[], [1], [0]], :moves=>3, :flipped=>1, :ternary=>'10'}
|
52
|
+
{:stacks=>[[], [1, 0], []], :moves=>4, :flipped=>0, :ternary=>'11'}
|
53
|
+
{:stacks=>[[0], [1], []], :moves=>5, :flipped=>0, :ternary=>'12'}
|
54
|
+
{:stacks=>[[0], [], [1]], :moves=>6, :flipped=>1, :ternary=>'20'}
|
55
|
+
{:stacks=>[[], [0], [1]], :moves=>7, :flipped=>0, :ternary=>'21'}
|
56
|
+
{:stacks=>[[], [], [1, 0]], :moves=>8, :flipped=>0, :ternary=>'22'}
|
57
57
|
```
|
58
58
|
where `flipped` is the disc that was moved last
|
59
59
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'hanoi/jane'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/hanoi-jane.gemspec
CHANGED
@@ -11,11 +11,11 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Solve the Towers of Hanoi}
|
13
13
|
spec.description = %q{by counting in base 2 or 3}
|
14
|
-
spec.homepage = 'http://pikesley.org'
|
14
|
+
spec.homepage = 'http://sam.pikesley.org/projects/hanoi-jane/'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
-
f.match(%r{^(
|
18
|
+
f.match(%r{^(spec)/})
|
19
19
|
end
|
20
20
|
spec.bindir = 'bin'
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/lib/hanoi/jane/cli.rb
CHANGED
@@ -5,7 +5,7 @@ module Hanoi
|
|
5
5
|
class CLI < ::Thor
|
6
6
|
desc 'version', 'Print hanoi version'
|
7
7
|
def version
|
8
|
-
puts
|
8
|
+
puts 'hanoi version #{VERSION}'
|
9
9
|
end
|
10
10
|
map %w(-v --version) => :version
|
11
11
|
|
@@ -26,7 +26,7 @@ module Hanoi
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
desc 'console',
|
29
|
+
desc 'console', 'Solve the towers one the console'
|
30
30
|
option :discs, type: :numeric, default: 3
|
31
31
|
option :constrained, type: :boolean
|
32
32
|
def console
|
@@ -39,7 +39,7 @@ module Hanoi
|
|
39
39
|
puts state
|
40
40
|
end
|
41
41
|
|
42
|
-
puts
|
42
|
+
puts '%d moves to solve for %d discs' % [towers.total, options[:discs]]
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/lib/hanoi/jane/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanoi-jane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pikesley
|
@@ -151,7 +151,7 @@ files:
|
|
151
151
|
- lib/hanoi/jane/matrix.rb
|
152
152
|
- lib/hanoi/jane/towers.rb
|
153
153
|
- lib/hanoi/jane/version.rb
|
154
|
-
homepage: http://pikesley.org
|
154
|
+
homepage: http://sam.pikesley.org/projects/hanoi-jane/
|
155
155
|
licenses:
|
156
156
|
- MIT
|
157
157
|
metadata: {}
|