bitcat 0.0.1 → 0.1.0

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: 3897c5335d1664970852cc1e6396e7e434ea77b0
4
- data.tar.gz: 3d4fbf418a8fa9b79348975e5e65a98867171dea
3
+ metadata.gz: eb4bbfbc8c988b0a34465d7eadb8c280798154b7
4
+ data.tar.gz: ac0405de5a5a71a094ec09623e5a3ced13f9a6db
5
5
  SHA512:
6
- metadata.gz: 90c00dc574dc1abe59647162a65202d36bd7b905fe08312aa24021fef4a763a0dc042781a33cd1c4694d2b4bae5a8fbc38a77b99aac3734bb9c193eadb150bd3
7
- data.tar.gz: 14048230792f6dbc58b13475ea00223187ed537c9302255298521dcf6e28b81c611af56c381349d43c5af19a7e7da44eb8de7d2886d22b4265979138020ccb01
6
+ metadata.gz: ade8e435c29b0a4c386fd105e569cbda1054ae348a3bd5691ffb60843488867c3a142c51046165833e215862ae1e3eaafcca4d889c207d3106d5431d271ffcc5
7
+ data.tar.gz: a2a826e1524d03dd48c7ff33ff6562c3fddb57943d06679ed53a3144681a9b3f9c050eae7251e0680490dd10dfdb017a99d9fdbc3e285ad1a2fd419b0ed33a47
@@ -0,0 +1,116 @@
1
+ CC0 1.0 Universal
2
+
3
+ Statement of Purpose
4
+
5
+ The laws of most jurisdictions throughout the world automatically confer
6
+ exclusive Copyright and Related Rights (defined below) upon the creator and
7
+ subsequent owner(s) (each and all, an "owner") of an original work of
8
+ authorship and/or a database (each, a "Work").
9
+
10
+ Certain owners wish to permanently relinquish those rights to a Work for the
11
+ purpose of contributing to a commons of creative, cultural and scientific
12
+ works ("Commons") that the public can reliably and without fear of later
13
+ claims of infringement build upon, modify, incorporate in other works, reuse
14
+ and redistribute as freely as possible in any form whatsoever and for any
15
+ purposes, including without limitation commercial purposes. These owners may
16
+ contribute to the Commons to promote the ideal of a free culture and the
17
+ further production of creative, cultural and scientific works, or to gain
18
+ reputation or greater distribution for their Work in part through the use and
19
+ efforts of others.
20
+
21
+ For these and/or other purposes and motivations, and without any expectation
22
+ of additional consideration or compensation, the person associating CC0 with a
23
+ Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24
+ and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25
+ and publicly distribute the Work under its terms, with knowledge of his or her
26
+ Copyright and Related Rights in the Work and the meaning and intended legal
27
+ effect of CC0 on those rights.
28
+
29
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
30
+ protected by copyright and related or neighboring rights ("Copyright and
31
+ Related Rights"). Copyright and Related Rights include, but are not limited
32
+ to, the following:
33
+
34
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
35
+ and translate a Work;
36
+
37
+ ii. moral rights retained by the original author(s) and/or performer(s);
38
+
39
+ iii. publicity and privacy rights pertaining to a person's image or likeness
40
+ depicted in a Work;
41
+
42
+ iv. rights protecting against unfair competition in regards to a Work,
43
+ subject to the limitations in paragraph 4(a), below;
44
+
45
+ v. rights protecting the extraction, dissemination, use and reuse of data in
46
+ a Work;
47
+
48
+ vi. database rights (such as those arising under Directive 96/9/EC of the
49
+ European Parliament and of the Council of 11 March 1996 on the legal
50
+ protection of databases, and under any national implementation thereof,
51
+ including any amended or successor version of such directive); and
52
+
53
+ vii. other similar, equivalent or corresponding rights throughout the world
54
+ based on applicable law or treaty, and any national implementations thereof.
55
+
56
+ 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57
+ applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58
+ unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59
+ and Related Rights and associated claims and causes of action, whether now
60
+ known or unknown (including existing as well as future claims and causes of
61
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum
62
+ duration provided by applicable law or treaty (including future time
63
+ extensions), (iii) in any current or future medium and for any number of
64
+ copies, and (iv) for any purpose whatsoever, including without limitation
65
+ commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66
+ the Waiver for the benefit of each member of the public at large and to the
67
+ detriment of Affirmer's heirs and successors, fully intending that such Waiver
68
+ shall not be subject to revocation, rescission, cancellation, termination, or
69
+ any other legal or equitable action to disrupt the quiet enjoyment of the Work
70
+ by the public as contemplated by Affirmer's express Statement of Purpose.
71
+
72
+ 3. Public License Fallback. Should any part of the Waiver for any reason be
73
+ judged legally invalid or ineffective under applicable law, then the Waiver
74
+ shall be preserved to the maximum extent permitted taking into account
75
+ Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76
+ is so judged Affirmer hereby grants to each affected person a royalty-free,
77
+ non transferable, non sublicensable, non exclusive, irrevocable and
78
+ unconditional license to exercise Affirmer's Copyright and Related Rights in
79
+ the Work (i) in all territories worldwide, (ii) for the maximum duration
80
+ provided by applicable law or treaty (including future time extensions), (iii)
81
+ in any current or future medium and for any number of copies, and (iv) for any
82
+ purpose whatsoever, including without limitation commercial, advertising or
83
+ promotional purposes (the "License"). The License shall be deemed effective as
84
+ of the date CC0 was applied by Affirmer to the Work. Should any part of the
85
+ License for any reason be judged legally invalid or ineffective under
86
+ applicable law, such partial invalidity or ineffectiveness shall not
87
+ invalidate the remainder of the License, and in such case Affirmer hereby
88
+ affirms that he or she will not (i) exercise any of his or her remaining
89
+ Copyright and Related Rights in the Work or (ii) assert any associated claims
90
+ and causes of action with respect to the Work, in either case contrary to
91
+ Affirmer's express Statement of Purpose.
92
+
93
+ 4. Limitations and Disclaimers.
94
+
95
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
96
+ surrendered, licensed or otherwise affected by this document.
97
+
98
+ b. Affirmer offers the Work as-is and makes no representations or warranties
99
+ of any kind concerning the Work, express, implied, statutory or otherwise,
100
+ including without limitation warranties of title, merchantability, fitness
101
+ for a particular purpose, non infringement, or the absence of latent or
102
+ other defects, accuracy, or the present or absence of errors, whether or not
103
+ discoverable, all to the greatest extent permissible under applicable law.
104
+
105
+ c. Affirmer disclaims responsibility for clearing rights of other persons
106
+ that may apply to the Work or any use thereof, including without limitation
107
+ any person's Copyright and Related Rights in the Work. Further, Affirmer
108
+ disclaims responsibility for obtaining any necessary consents, permissions
109
+ or other rights required for any use of the Work.
110
+
111
+ d. Affirmer understands and acknowledges that Creative Commons is not a
112
+ party to this document and has no duty or obligation with respect to this
113
+ CC0 or use of the Work.
114
+
115
+ For more information, please see
116
+ <http://creativecommons.org/publicdomain/zero/1.0/>
@@ -1,6 +1,13 @@
1
1
  HISTORY.md
2
+ LICENSE.md
2
3
  Manifest.txt
3
4
  README.md
4
5
  Rakefile
6
+ bin/bitcat
5
7
  lib/bitcat.rb
8
+ lib/bitcat/app.rb
9
+ lib/bitcat/public/style.css
6
10
  lib/bitcat/version.rb
11
+ lib/bitcat/views/index.erb
12
+ lib/bitcat/views/kitty.erb
13
+ lib/bitcat/views/layout.erb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # bitcat - Bit Catalog Browser
1
+ # bitcat - Bit Catalog Kitty Browser
2
2
 
3
3
  browse your (digital) bit(s) collections -
4
4
  browse your (crypto) kitties and more
@@ -10,11 +10,32 @@ browse your (crypto) kitties and more
10
10
  * rdoc :: [rubydoc.info/gems/bitcat](http://rubydoc.info/gems/bitcat)
11
11
 
12
12
 
13
-
14
13
  ## Usage
15
14
 
16
- to be done
17
15
 
16
+ ### Step 0 - Database Setup
17
+
18
+ Note: The bitcat server machinery requires a (local) single-file SQLite database,
19
+ that is, `kitties.db`, in your working folder.
20
+
21
+ See the [Copycats page on how to setup a (local) single-file SQLite database »](https://github.com/openblockchains/copycats#database-setup)
22
+
23
+
24
+
25
+ ### Step 1 - Start the Bitcat Server
26
+
27
+ Start up the bitcat server on the command line:
28
+
29
+ $ bitcat
30
+
31
+
32
+ ### Step 3 - Open Bitcat Page in Browser
33
+
34
+ Open up the browser at `localhost:4567`.
35
+
36
+ ![](bitcat.png)
37
+
38
+ That's it. Enjoy.
18
39
 
19
40
 
20
41
 
data/Rakefile CHANGED
@@ -18,6 +18,9 @@ Hoe.spec 'bitcat' do
18
18
  self.history_file = 'HISTORY.md'
19
19
 
20
20
  self.extra_deps = [
21
+ ['sinatra', '>=2.0'],
22
+ ['sass'], ## used for css style preprocessing (scss)
23
+ ['copycats', '>=0.6.1'],
21
24
  ]
22
25
 
23
26
  self.licenses = ['Public Domain']
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -I./lib bin/bitcat
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/bitcat
13
+ #
14
+
15
+ require 'bitcat'
16
+
17
+ Bitcat.main
@@ -2,10 +2,54 @@
2
2
 
3
3
  require 'pp'
4
4
 
5
+ ## 3rd party
6
+ require 'copycats'
7
+ require 'sinatra/base' ## note: use "modular" class sinatra style
8
+
9
+
5
10
 
6
11
  ## our own code
7
12
  require 'bitcat/version' # note: let version always go first
13
+ require 'bitcat/app'
14
+
15
+
16
+
17
+ module Bitcat
18
+
19
+ ## convenience method
20
+ def self.run!
21
+ app = App
22
+ port = 4567
23
+ Rack::Handler::WEBrick.run( app, Port:port ) do |server|
24
+ ## todo: add traps here - why, why not??
25
+ end
26
+ end
27
+
28
+ def self.main
29
+ p banner
30
+ ## p root #=> e.g. "C:/Sites/openblockchains/bitcat"
31
+
32
+ database = './kitties.db'
33
+
34
+ unless File.exist?( database )
35
+ puts "*** error - no SQLite database found - expected >#{database}<"
36
+ puts
37
+ puts " note: for how to setup a database,"
38
+ puts " see <https://github.com/openblockchains/copycats#database-setup>"
39
+ puts
40
+ exit 1
41
+ end
42
+
43
+
44
+ ## connect to local kitties.db database
45
+ connect( adapter: 'sqlite3',
46
+ database: database )
8
47
 
48
+ ## print some (record) stats
49
+ puts "kitties: #{Copycats::Model::Kitty.count}"
50
+ puts "genes: #{Copycats::Model::Gene.count}"
51
+ puts "traits: #{Copycats::Model::Trait.count}"
9
52
 
10
- pp Bitcat.banner
11
- pp Bitcat.root
53
+ run!
54
+ end
55
+ end # module Bitcat
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ module Bitcat
4
+
5
+ class App < Sinatra::Base
6
+
7
+ set :root, "#{Bitcat.root}/lib/bitcat"
8
+
9
+ get '/' do
10
+ erb :index
11
+ end
12
+
13
+ post '/' do
14
+ puts "post '/'"
15
+ pp params
16
+
17
+ id = params['kitty']['id']
18
+ if id.blank?
19
+ ## id required - todo: add flash message
20
+ redirect "/"
21
+ else
22
+ redirect "/kitty/#{id}"
23
+ end
24
+ end
25
+
26
+
27
+ get '/kitty/:id' do
28
+ puts "get '/kitty/:id'"
29
+ pp params
30
+
31
+ kitty = Copycats::Model::Kitty.find( params['id'] )
32
+ pp kitty
33
+
34
+ erb :kitty, :locals => { kitty: kitty }
35
+ end
36
+
37
+
38
+ ## helpers
39
+ def h(text)
40
+ Rack::Utils.escape_html(text)
41
+ end
42
+
43
+ end # class App
44
+ end # module Bitcat
@@ -0,0 +1,5 @@
1
+
2
+ body {
3
+ font-family: arial,sans-serif;
4
+ color: #222;
5
+ }
@@ -4,8 +4,8 @@
4
4
  module Bitcat
5
5
 
6
6
  MAJOR = 0
7
- MINOR = 0
8
- PATCH = 1
7
+ MINOR = 1
8
+ PATCH = 0
9
9
  VERSION = [MAJOR,MINOR,PATCH].join('.')
10
10
 
11
11
  def self.version
@@ -0,0 +1,16 @@
1
+ <h1>Bitcat - Bit Catalog Kitty Browser</h1>
2
+
3
+ <div>
4
+ <form action='/' method='post'>
5
+ <input type='text' name='kitty[id]' placeholder='1,2,3,...'>
6
+ <input type='submit' value='Show Kitty'>
7
+ </form>
8
+ </div>
9
+
10
+
11
+ <p>
12
+ Try
13
+ <% Copycats::Model::Kitty.limit(10).each do |kitty| %>
14
+ <a href="kitty/<%= kitty.id %>">#<%= kitty.id %></a>
15
+ <% end %>
16
+ </p>
@@ -0,0 +1,53 @@
1
+
2
+ <a href="/">« Index</a>
3
+
4
+ <h1>Kitty #<%= kitty.id %></h2>
5
+
6
+ Generation: <%= kitty.gen %>
7
+ <br>
8
+ Birthdate: <%= kitty.birthdate %> (<%= Date.today.jd - kitty.birthdate.to_date.jd %> days ago)
9
+ <br>
10
+ Day count: <%= kitty.day_count %>
11
+ <br>
12
+ Genes (Kai): <%= kitty.genes_kai %>
13
+
14
+
15
+ <ul>
16
+ <% kitty.genes.each do |gene|
17
+ trait = Copycats::Model::Trait.find( gene.trait_id )
18
+ trait_type = Copycats::Model::TraitType.find( trait.trait_type_id )
19
+ %>
20
+ <li>
21
+ <%= gene.n %> --
22
+ <%= gene.gene %> -
23
+ <%= trait.name %>
24
+ (<%= trait.kai %>) -
25
+ <%= trait_type.name %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
29
+
30
+
31
+ <p>
32
+ More Profile Pages:
33
+ </p>
34
+
35
+ <ul>
36
+ <li>CryptoKitty - <a href="https://www.cryptokitties.co/kitty/<%= kitty.id %>">#<%= kitty.id %></a>
37
+ (<a href="https://api.cryptokitties.co/kitties/<%= kitty.id %>">API</a>)
38
+ </li>
39
+ <li>CryptoKittydex - <a href="https://cryptokittydex.com/kitties/<%= kitty.id %>">#<%= kitty.id %></a>
40
+ </li>
41
+ <!-- check: needs "dummy" k2 para ? -->
42
+ <li>KittyCalc - <a href="https://kittycalc.co/read/?k1=<%= kitty.id %>&k2=461679">#<%= kitty.id %></a>
43
+ </li>
44
+ </ul>
45
+
46
+
47
+ <!--
48
+ <pre>
49
+ <%=h kitty.pretty_inspect %>
50
+
51
+ <%=h kitty.genes.pretty_inspect %>
52
+ </pre>
53
+ -->
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Bitcat - Bit Catalog Kitty Browser</title>
5
+ <link href='/style.css' rel='stylesheet'>
6
+ </head>
7
+ <body>
8
+
9
+ <%= yield %>
10
+
11
+ </body>
12
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
@@ -10,6 +10,48 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sass
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: copycats
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.6.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.6.1
13
55
  - !ruby/object:Gem::Dependency
14
56
  name: rdoc
15
57
  requirement: !ruby/object:Gem::Requirement
@@ -41,19 +83,28 @@ dependencies:
41
83
  description: bitcat - bit cat(alog) browser - browse your (digital) bit(s) collections;
42
84
  browse your (crypto) kitties and more
43
85
  email: wwwmake@googlegroups.com
44
- executables: []
86
+ executables:
87
+ - bitcat
45
88
  extensions: []
46
89
  extra_rdoc_files:
47
90
  - HISTORY.md
91
+ - LICENSE.md
48
92
  - Manifest.txt
49
93
  - README.md
50
94
  files:
51
95
  - HISTORY.md
96
+ - LICENSE.md
52
97
  - Manifest.txt
53
98
  - README.md
54
99
  - Rakefile
100
+ - bin/bitcat
55
101
  - lib/bitcat.rb
102
+ - lib/bitcat/app.rb
103
+ - lib/bitcat/public/style.css
56
104
  - lib/bitcat/version.rb
105
+ - lib/bitcat/views/index.erb
106
+ - lib/bitcat/views/kitty.erb
107
+ - lib/bitcat/views/layout.erb
57
108
  homepage: https://github.com/openblockchains/bitcat
58
109
  licenses:
59
110
  - Public Domain