geohash36 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS.md +29 -0
  3. data/CHANGELOG.md +0 -0
  4. data/COPYING.md +12 -0
  5. data/Gemfile +107 -0
  6. data/LICENSE.md +14 -0
  7. data/MAINTAINERS.md +40 -0
  8. data/README.md +78 -0
  9. data/Rakefile +52 -0
  10. data/bin/geohash36 +45 -0
  11. data/geohash36.gemspec +136 -0
  12. data/lib/demo.rb +25 -0
  13. data/lib/geohash36/interface/rake/cucumber.rb +36 -0
  14. data/lib/geohash36/interface/rake/default.rb +28 -0
  15. data/lib/geohash36/interface/rake/documentation.rb +46 -0
  16. data/lib/geohash36/interface/rake/guard.rb +13 -0
  17. data/lib/geohash36/interface/rake/helpers.rb +27 -0
  18. data/lib/geohash36/interface/rake/library.rb +126 -0
  19. data/lib/geohash36/interface/rake/metric.rb +13 -0
  20. data/lib/geohash36/interface/rake/rspec.rb +8 -0
  21. data/lib/geohash36/interface/thor/info.thor +292 -0
  22. data/lib/geohash36/interface/thor/mixin/config_choice.rb +27 -0
  23. data/lib/geohash36/interface/thor/mixin/configuration.rb +28 -0
  24. data/lib/geohash36/interface/thor/mixin/default.rb +30 -0
  25. data/lib/geohash36/interface/thor/mixin/default_config.rb +31 -0
  26. data/lib/geohash36/interface/thor/mixin/guess.rb +57 -0
  27. data/lib/geohash36/interface/thor/mixin/logger.rb +43 -0
  28. data/lib/geohash36/interface/thor/mixin/shell.rb +225 -0
  29. data/lib/geohash36/interface/thor/version.thor +33 -0
  30. data/lib/geohash36/library/interval.rb +130 -0
  31. data/lib/geohash36/version.rb +13 -0
  32. data/lib/geohash36.rb +164 -0
  33. data/spec/geohash36_spec.rb +52 -0
  34. data/spec/library/interval_spec.rb +55 -0
  35. data/spec/spec_helper.rb +55 -0
  36. metadata +281 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 432211005ee057c31a81fbf7367e43f425aecaf5
4
+ data.tar.gz: b10ff8a92d40cd22a10096998998cf7758742982
5
+ SHA512:
6
+ metadata.gz: 43366a468241e83d6ba28ca5e46aecc8d6f3d481635fb84f00af9b706e51906051cc6c68ec16aa7800f97aaa06822fcb11922c7c64dec5e57ae97d822852264a
7
+ data.tar.gz: a9ef919392973868982ff6c42421a222f4062f180bc78bed685ea042a1dac4b08824aa7e9fb3e415a811e272f998d7ca4960d518f6ef4b0a3f2a76b744fb03d8
data/AUTHORS.md ADDED
@@ -0,0 +1,29 @@
1
+ Please refer to the MAINTAINERS file for more information.
2
+
3
+ AUTHORS
4
+
5
+ The following list is a narration of persons who contributed to this project.
6
+
7
+ P: Person
8
+ M: Mail patches to
9
+ L: Mailing list that is relevant to this area
10
+ W: Web-page with status/info
11
+ S: Status, one of the following:
12
+
13
+ Creator: Original Developer and Maintainer of the code, please refer first to Maintainer.
14
+ Associated: Has some relevance to the project and is referable to specific parts of the project.
15
+
16
+ GEOHASH36
17
+ P: Oleg Orlov
18
+ M: orelcokolov AT gmail DOT com
19
+ L: -
20
+ W: https://github.com/OrelSokolov
21
+ S: Creator
22
+
23
+ GEOHASH36
24
+ P: Bjoern Rennhak
25
+ M: bjoern AT clothesnetwork DOT com
26
+ L: -
27
+ W: http://github.com/rennhak
28
+ S: Creator
29
+
data/CHANGELOG.md ADDED
File without changes
data/COPYING.md ADDED
@@ -0,0 +1,12 @@
1
+
2
+ These files are part of the GEOHASH36 solution.
3
+
4
+ Copyright 2014, Bjoern Rennhak, Oleg Orlov
5
+ Clothes Network Ltd.
6
+
7
+ This project is open source software under MIT license.
8
+
9
+ This software is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
data/Gemfile ADDED
@@ -0,0 +1,107 @@
1
+ # File: Gemfile
2
+
3
+ # Sources to draw gems from
4
+ source "https://rubygems.org"
5
+ # source 'http://gems.rubyforge.org'
6
+ # source 'http://gemcutter.org'
7
+
8
+
9
+ # Depend on a certain ruby version
10
+ ruby '2.1.2'
11
+
12
+
13
+ group :default do # {{{
14
+
15
+ # System
16
+ gem 'bundler'
17
+ gem 'rake'
18
+
19
+ end # }}}
20
+
21
+ group :development do # {{{
22
+
23
+ # Generate manuals
24
+ gem 'ronn', '<= 0.7.2'
25
+ gem 'rdiscount'
26
+
27
+ # REPL
28
+ gem 'racksh'
29
+ gem 'pry'
30
+
31
+ platforms :ruby_19, :ruby_20 do
32
+ gem 'pry-debugger'
33
+ gem 'pry-stack_explorer'
34
+ end
35
+
36
+ gem 'guard'
37
+ gem 'guard-rake'
38
+ gem 'guard-shell'
39
+
40
+ # Notifications from live-reload etc.
41
+ gem 'growl'
42
+ gem 'ruby-growl'
43
+ gem 'rb-inotify' unless RUBY_PLATFORM=~ /darwin/
44
+
45
+ end # }}}
46
+
47
+ group :test do # {{{
48
+
49
+ # Unit-tests
50
+ gem 'rspec', '~> 3.0.0'
51
+ gem 'rspec-its'
52
+ gem 'rspec-mocks'
53
+ gem 'guard-rspec', require: false
54
+
55
+ # Integration tests
56
+ gem 'aruba'
57
+ gem 'cucumber'
58
+
59
+ # Metrics
60
+ gem 'simplecov', '~> 0.9.0'
61
+ gem 'simplecov-rcov'
62
+ gem 'simplecov-rcov-text'
63
+ gem 'metric_fu', '>= 4.5.x'
64
+
65
+ # Fixture helper
66
+ gem 'randexp'
67
+
68
+ end # }}}
69
+
70
+ group :security do # {{{
71
+
72
+ # 0-days?
73
+ gem 'bundler-audit'
74
+
75
+ # Secure credentials
76
+ gem 'secure_yaml'
77
+
78
+ end # }}}
79
+
80
+ group :profiling do # {{{
81
+
82
+ gem 'stackprof'
83
+
84
+ end # }}}
85
+
86
+ group :docs do # {{{
87
+
88
+ gem 'yumlcmd'
89
+ gem 'coderay'
90
+ gem 'redcarpet'
91
+ gem 'github-markup'
92
+ gem 'htmlentities'
93
+
94
+ # Documentation
95
+ gem 'yard'
96
+ gem 'wicked_pdf'
97
+ gem 'wkhtmltopdf'
98
+
99
+ end # }}}
100
+
101
+
102
+ # Declare geohash36.gemspec
103
+ gemspec
104
+
105
+
106
+
107
+ # vim:ts=2:tw=100:wm=100
data/LICENSE.md ADDED
@@ -0,0 +1,14 @@
1
+
2
+ These files are part of the GEOHASH36 solution.
3
+
4
+ Copyright 2014, Bjoern Rennhak, Oleg Orlov
5
+ Clothes Network Ltd.
6
+
7
+ This project is open source software under MIT license.
8
+
9
+ This software is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
13
+
14
+
data/MAINTAINERS.md ADDED
@@ -0,0 +1,40 @@
1
+ ATTENTION
2
+
3
+ Please make sure before E-Mailing any of the person below that you have made sure
4
+ that the changes are tested and releasable as submitted by you. If you want to report
5
+ a bug please make sure that it is reproducable and be sure to include all necessary
6
+ information to fix it.
7
+
8
+ If you supply changes please prefer the Unix/Linux patch system (diff -u) as it will be least
9
+ problematic to test and modify the development code. Again please be sure to submit
10
+ your Hard-/Software configuration as patches will be rechecked by us and need to be
11
+ mergable into the tree.
12
+
13
+ Please do not forget to include credits or other acknowledgements in your submission.
14
+ Before submitting anything please make sure that you have the proper rights to submit them
15
+ and be prepared to submit all rights to Clothes Network Ltd.
16
+
17
+
18
+ MAINTAINERS
19
+
20
+ The following list is a narration of person currently in charge of this project.
21
+
22
+ P: Person
23
+ M: Mail patches to
24
+ L: Mailing list that is relevant to this area
25
+ W: Web-page with status/info
26
+ S: Status, one of the following:
27
+
28
+ Maintainer: Project Maintainer and general assistance for project coordination
29
+ Creator: Original Developer and Maintainer of the code, please refer first to Maintainer.
30
+ Associated: Has some relevance to the project and is referable to specific parts of the project.
31
+
32
+
33
+ GEOHASH36
34
+ P: Bjoern Rennhak
35
+ M: bjoern AT clothesnetwork DOT com
36
+ L: -
37
+ W: http://www.clothesnetwork.com
38
+ S: Creator, Maintainer
39
+
40
+
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Geohash36
2
+ Version 0.3.0-9-g34a816a
3
+
4
+ Geohash36 is a complete solution for geohashing coordinates. What is geohash?
5
+ For example, the coordinate pair 40.689167, -74.044444 (NY City) produces a slightly shorter hash 9LVB4BH89g, which can be used in the URL http://geo36.org/9LVB4BH89g
6
+
7
+ The main usages of Geohashes are
8
+ * as a unique identifier.
9
+ * represent point data e.g. in databases.
10
+
11
+ ## More about geohashing
12
+
13
+ In order to describe any location on the planet we normally use Longitude and Latitude geo
14
+ coordinates. While working with two variables like this is fine, it is prone to certain issues such
15
+ as how to control arbitrary precision, ease or querying, means of finding locations of proximity,
16
+ having just one unique identifier and so on.
17
+
18
+ Out of this reason Gustavo Niemeyer created the Geohash [1][2] algorithm. It is a hierarchical spatial
19
+ data structure which subdivides space into buckets of grid shape. The two coordinate variables are
20
+ turned into one local perceptual hash, in which similar spaces share more significant string
21
+ similarity (from left to right).
22
+
23
+ This allows very easily to query for similar regions by left to right character matching and the
24
+ calculation of promimity by for instance edit distance. One can also imagine a efficient data
25
+ structure which utilizes a TRIE to store such coordinates.
26
+
27
+ Original Geohash algorithm is based on radix 32 system which leaves us with certain problems.
28
+ Geohash 36 [2] [3], originally developed for compression of world coordinate data, utilizes radix 36
29
+ notation allowing for higher precision and leverages a character set designed for electronic storage
30
+ and communication rather than human memory and conversation.
31
+
32
+ It uses an case sensitive alphabet of the characters "23456789bBCdDFgGhHjJKlLMnNPqQrRtTVWX" where
33
+ characters were chosen to avoid vowels, vowel-like numbers, character confusion, and to use
34
+ lowercase characters, which are generally distinct from their uppercase equivalents in standard
35
+ typefaces.
36
+
37
+ Alphabet conversion table [2]
38
+
39
+ Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
40
+ Geohash-36 2 3 4 5 6 7 8 9 b B C d D F g G h H
41
+
42
+ Decimal 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
43
+ Geohash-36 j J K l L M n N P q Q r R t T V W X
44
+
45
+ Each character represents a further subdivision in a 6 by 6 grid - starting at the North-West
46
+ (top-left) coordinate and continuing, row by row, to the South-East (bottom-right) [4].
47
+
48
+ The Statue of Liberty, at coordinates 40.689167, -74.044444, is encoded as 9LVB4BH89g-m. The reverse
49
+ decoding equates to 40.689168,-74.044445.
50
+
51
+ [1] http://geohash.org/
52
+ [2] http://en.wikipedia.org/wiki/Geohash
53
+ [2] http://en.wikipedia.org/wiki/Geohash-36
54
+ [3] http://geo36.org/
55
+ [4] http://www.pubnub.com/blog/wp-content/uploads/2014/05/ProximityChat1.jpg
56
+
57
+
58
+ ## Installing
59
+
60
+ By running gem comand
61
+
62
+ ```
63
+ gem install geohash36
64
+ ```
65
+
66
+ or by adding to `Gemfile`
67
+
68
+ ```ruby
69
+ gem 'geohash36', git: 'https://github.com/clothesnetwork/geohash36'
70
+ ```
71
+
72
+ ## Usage
73
+
74
+ Basic usage can be found in demo.rb file
75
+
76
+ ## Copyright
77
+
78
+ Please refer to the COPYRIGHT file
data/Rakefile ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ # System
5
+ require 'bundler'
6
+ require 'bundler/gem_tasks'
7
+
8
+ require 'shellwords'
9
+ require 'fileutils'
10
+ require 'yaml'
11
+
12
+ require 'date'
13
+ require 'ostruct'
14
+
15
+ require 'ronn'
16
+ require 'rdiscount'
17
+
18
+ require 'benchmark'
19
+
20
+
21
+ ### Project Customization for Thor and Rake
22
+
23
+ project = YAML.load_file( '.project.yaml' )
24
+ project.each_pair { |name, value| self.instance_variable_set( "@#{name.to_s}", value ) }
25
+
26
+
27
+ ### General
28
+
29
+ desc "Generate proper README file from templates" # {{{
30
+ task :readme do |t|
31
+ source = "README.md.template"
32
+ target = "README.md"
33
+
34
+ content = File.readlines( source ).collect!{ |line| line.rstrip }
35
+ version = `git describe --tags`.strip
36
+
37
+ content[ content.index( "$Version$" ) ] = "Version " + version if( content.include?( "$Version$" ) )
38
+ File.write( target, content.join("\n") )
39
+ puts "(II) #{target.to_s} generated from #{source.to_s}"
40
+ end # }}}
41
+
42
+ ### Actions
43
+
44
+
45
+ ### Helper Functions
46
+
47
+
48
+ ### Load all Rake file tasks
49
+ Dir.glob( "{,lib/}#{@gem_name}/interface/rake/**/*.{rake,rb}" ) { |name| load name }
50
+
51
+
52
+ # vim:ts=2:tw=100:wm=100:syntax=ruby
data/bin/geohash36 ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Make sure load path contains local + global
4
+ $LOAD_PATH << '.'
5
+ $LOAD_PATH << File.dirname( File.join( __FILE__, '../lib/' ) )
6
+
7
+ # System includes
8
+ require 'bundler'
9
+ require 'thor' unless defined? Thor::Runner
10
+
11
+ # Custom includes
12
+ require_relative '../lib/geohash36'
13
+
14
+
15
+ # @class Geohash36 executable
16
+ # @brief Main entry point for commandline execution
17
+ class Default < Thor
18
+
19
+ desc 'hash LATITUDE LONGITUDE', 'Get geohash36 from coordinates' # {{{
20
+ def hash lat, lon
21
+ begin
22
+ puts Geohash36.to_geohash( { latitude: lat.to_f, longitude: lon.to_f } )
23
+ rescue ArgumentError => error
24
+ STDERR.puts "Error: #{error.message}"
25
+ end
26
+ end # }}}
27
+
28
+ desc 'coords GEOHASH [ACCURACY]', 'Get coordinates for geohash with specified accuracy' # {{{
29
+ option :accuracy
30
+ def coords hash, accuracy = 3
31
+ begin
32
+ raise ArgumentError, 'Too big accuracy' if( accuracy.to_i > 10 )
33
+ coords = Geohash36.to_coords( hash, accuracy.to_i.abs )
34
+ puts "Latitude: #{coords[:latitude]}"
35
+ puts "Longitude: #{coords[:longitude]}"
36
+ rescue ArgumentError => error
37
+ STDERR.puts "Error: #{error.message}"
38
+ end
39
+ end # }}}
40
+
41
+ end # of class Default
42
+
43
+ Default.start( ARGV )
44
+
45
+ # vim:ts=2:tw=100:wm=100:syntax=ruby
data/geohash36.gemspec ADDED
@@ -0,0 +1,136 @@
1
+ # File: geohash36.gemspec
2
+
3
+ # Make sure lib is in Load path
4
+ lib = File.expand_path( '../lib/', __FILE__ )
5
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?( lib )
6
+
7
+ # System includes
8
+ require 'date'
9
+
10
+ # Custom includes
11
+ require 'geohash36/version'
12
+
13
+ Gem::Specification.new do |spec|
14
+
15
+ spec.name = 'geohash36'
16
+
17
+ spec.description = %q(Commandline interface and library to the Geohash36 Algorithm)
18
+ spec.summary = spec.description
19
+
20
+ spec.authors = [ 'Bjoern Rennhak', 'Oleg Orlov' ]
21
+ spec.email = [ 'bjoern@clothesnetwork.com', 'orelcokolov@gmail.com' ]
22
+
23
+ spec.homepage = 'http://github.com/clothesnetwork/geohash36'
24
+
25
+ spec.licenses = %w[MIT]
26
+
27
+ spec.date = DateTime.now.to_s.split( 'T' ).first
28
+ spec.version = Geohash36::VERSION
29
+ spec.platform = Gem::Platform::RUBY
30
+
31
+ spec.metadata = {
32
+ "issue_tracker" => "http://github.com/clothesnetwork/geohash36"
33
+ }
34
+
35
+ spec.bindir = 'bin'
36
+ spec.executables = %w[geohash36]
37
+
38
+ spec.require_paths = %w[lib]
39
+
40
+ spec.files = %w[
41
+ AUTHORS.md
42
+ CHANGELOG.md
43
+ COPYING.md
44
+ LICENSE.md
45
+ MAINTAINERS.md
46
+ Gemfile
47
+ README.md
48
+ Rakefile
49
+ geohash36.gemspec
50
+ ]
51
+
52
+ spec.files += Dir.glob( 'bin/**/*' )
53
+
54
+ spec.files += Dir.glob( 'lib/**/*.rb' )
55
+ spec.files += Dir.glob( 'lib/**/*.thor' )
56
+
57
+ spec.files += Dir.glob( 'spec/**/*' )
58
+
59
+ spec.files += Dir.glob( 'thrift/**/*' )
60
+
61
+ spec.files += Dir.glob( 'data/**/*' )
62
+
63
+ spec.files += Dir.glob( 'documentation/**/*' )
64
+
65
+ spec.files += Dir.glob( 'examples/**/*' )
66
+
67
+ spec.files += Dir.glob( 'base/**/*' )
68
+
69
+ spec.test_files += Dir.glob( 'test/**/*' )
70
+ spec.test_files += Dir.glob( 'spec/**/*' )
71
+ spec.test_files += Dir.glob( 'features/**/*' )
72
+
73
+ ## Dependencies
74
+
75
+ # Ruby VM
76
+ spec.required_ruby_version = '~> 2.1'
77
+
78
+ # General
79
+ spec.add_runtime_dependency 'thor'
80
+ spec.add_runtime_dependency 'ruby-try', '~> 1.1.1'
81
+
82
+ # Package building
83
+ spec.add_runtime_dependency 'fpm'
84
+
85
+ # Shell
86
+ spec.add_runtime_dependency 'ptools'
87
+ spec.add_runtime_dependency 'os'
88
+
89
+ # Data RPCs and Messaging
90
+ spec.add_runtime_dependency 'msgpack'
91
+ # spec.add_runtime_dependency 'xmpp4r'
92
+ # spec.add_runtime_dependency 'xmpp4r-simple' # , :git => 'git://github.com/blaine/xmpp4r-simple.git'
93
+ spec.add_runtime_dependency 'amqp'
94
+
95
+ spec.add_runtime_dependency 'mime-types'
96
+
97
+ # l10n
98
+ spec.add_runtime_dependency 'gettext'
99
+
100
+ # Monadic/Functional
101
+ spec.add_runtime_dependency 'andand'
102
+ spec.add_runtime_dependency 'ick'
103
+
104
+ # Misc System
105
+ spec.add_runtime_dependency 'awesome_print'
106
+ spec.add_runtime_dependency 'uuid'
107
+
108
+ ## System libraries needed (info for the user)
109
+ # spec.requirements 'iconv zlib libmagic'
110
+
111
+ # spec.requirements 'redis-server'
112
+ # spec.requirements 'sqlite3 libsqlite3-dev'
113
+
114
+
115
+ ## Post Install
116
+ spec.post_install_message = <<-EOS
117
+ ____ _____ ___ _ _ _ ____ _ _ _____ __
118
+ / ___| ____/ _ \| | | | / \ / ___|| | | |___ / / /_
119
+ | | _| _|| | | | |_| | / _ \ \___ \| |_| | |_ \| '_ \
120
+ | |_| | |__| |_| | _ |/ ___ \ ___) | _ |___) | (_) |
121
+ \____|_____\___/|_| |_/_/ \_\____/|_| |_|____/ \___/
122
+
123
+ (c) #{spec.date.to_s}, All rights reserved
124
+ Clothes Network Ltd., Bjoern Rennhak
125
+
126
+ Don't forget to configure $HOME/.geohash36/config.
127
+ To generate config file under $HOME/.geohash36/ directory,
128
+ please run 'geohash36 config:generate' command
129
+
130
+ Thanks for installing Geohash36 !
131
+ EOS
132
+
133
+ end # of Gem::Specification.new do |s|
134
+
135
+
136
+ # vim:ts=2:tw=100:wm=100:syntax=ruby
data/lib/demo.rb ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Custom include
4
+ require_relative 'geohash36'
5
+
6
+ puts '-'*90
7
+ puts 'FROM COORDS TO GEOHASH'
8
+ puts '-'*90
9
+
10
+ [{latitude: 0, longitude: 0},
11
+ {latitude: 54, longitude: 32},
12
+ {latitude: 40.710489, longitude: -74.015612},
13
+ {latitude: 53.907095, longitude: 27.558915},
14
+ {latitude: 40.689167, longitude: -74.044444}].each do |coords|
15
+ puts "#{Geohash36.to_geohash(coords)} for coords: #{coords}"
16
+ end
17
+
18
+ puts '-'*90
19
+ puts "FROM HASH TO COORDS"
20
+ puts '-'*90
21
+
22
+ ["l222222222222", "BB99999999999", "9LV5V9V4CqbJh", "BbCBt9BQ7N4Wb"].each do |hash|
23
+ puts "#{Geohash36.to_coords(hash)} for geohash #{hash}"
24
+ end
25
+
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ ## Handle Cucumber # {{{
5
+
6
+ namespace :cucumber do
7
+
8
+ begin
9
+ require 'cucumber'
10
+ require 'cucumber/rake/task'
11
+
12
+ desc "Cucumber Core Tasks" # {{{
13
+ Cucumber::Rake::Task.new(:pretty) do |t|
14
+ t.cucumber_opts = "--format pretty -S"
15
+ end # }}}
16
+
17
+ desc "Cucumber Core Tasks" # {{{
18
+ Cucumber::Rake::Task.new(:progress) do |t|
19
+ t.cucumber_opts = "--format progress -S"
20
+ end # }}}
21
+
22
+ rescue LoadError
23
+ desc 'Cucumber rake task not available'
24
+ task :pretty do
25
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
26
+ end
27
+
28
+ task :progress do
29
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
30
+ end
31
+ end
32
+
33
+ end # pf namespace }}}
34
+
35
+
36
+ # vim:ts=2:tw=100:wm=100:syntax=ruby
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ # System
5
+ require 'bundler'
6
+ require 'bundler/gem_tasks'
7
+
8
+ require 'shellwords'
9
+ require 'fileutils'
10
+
11
+ require 'date'
12
+ require 'ostruct'
13
+
14
+
15
+
16
+ ### General
17
+
18
+ desc "Show the default task when executing rake without arguments" # {{{
19
+ task :default => :help # }}}
20
+
21
+ desc "Shows the usage help screen" # {{{
22
+ task :help do |t|
23
+ `rake -T`
24
+ end # }}}
25
+
26
+
27
+
28
+ # vim:ts=2:tw=100:wm=100:syntax=ruby
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ namespace :docs do
5
+
6
+ desc "Generate Yardoc documentation for this project" # {{{
7
+ task :generate do |t|
8
+
9
+ # Define new tags for yardoc to detect
10
+ tags = {}
11
+ tags[ "module" ] = "Module"
12
+ tags[ "class" ] = "Class"
13
+ tags[ "fn" ] = "Function"
14
+ tags[ "brief" ] = "Description"
15
+
16
+ # Hide tags we don't want in yardoc output
17
+ hidden = %w[module class fn]
18
+ files = %w|lib/*.rb lib/**/*.rb lib/**/**/*.rb - COPYING.md AUTHORS.md|.join " "
19
+
20
+ # Construct tag string for CLI command
21
+ tags_line = ""
22
+ tags.each_pair { |n,v| tags_line += " --tag #{n.to_s}:\"#{v.to_s}\"" }
23
+ hidden.each { |h| tags_line += " --hide-tag #{h.to_s}" }
24
+
25
+ puts "(II) Generating multi-file yardoc output written to doc/yardoc"
26
+ system "yard --markup-provider=redcarpet --markup=markdown #{tags_line.to_s} -o doc/yardoc #{files}"
27
+
28
+ puts "(II) Generating one-file yardoc output written to doc/yardoc_pdf"
29
+ system "yard --markup-provider=redcarpet --markup=markdown --one-file #{tags_line.to_s} -o doc/yardoc_pdf #{files}"
30
+
31
+ # puts "(II) HTML to PDF written to doc/yardoc_pdf"
32
+ # pdf = WickedPdf.new.pdf_from_string( File.read( "doc/yardoc_pdf/index.html" ) )
33
+ # File.write( "doc/yardoc_pdf/index.pdf", pdf )
34
+ end # }}}
35
+
36
+ desc "Generate Yard Graphs for this project" # {{{
37
+ task :graph do |t|
38
+ basedir = "doc/yard-graph"
39
+ FileUtils.mkdir_p( basedir )
40
+ system "yard graph --dependencies --empty-mixins --full > #{basedir.to_s}/graph.dot"
41
+ system "dot -Tpng #{basedir.to_s}/graph.dot > #{basedir.to_s}/graph.png"
42
+ end # }}}
43
+
44
+ end # of namespace :docs
45
+
46
+ # vim:ts=2:tw=100:wm=100:syntax=ruby
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ namespace :guard do
5
+
6
+ desc "Execute Ruby Guard" # {{{
7
+ task :default do |g|
8
+ sh "bundle exec guard start -G Guardfile"
9
+ end # }}}
10
+
11
+ end
12
+
13
+ # vim:ts=2:tw=100:wm=100:syntax=ruby