fox 0.0.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +196 -14
  3. data/bin/fox +28 -8
  4. data/fox.gemspec +41 -3
  5. data/lib/fox.rb +23 -10
  6. data/lib/fox/cli.rb +17 -0
  7. data/lib/fox/configuration.rb +48 -0
  8. data/lib/fox/core_ext.rb +8 -0
  9. data/lib/fox/core_ext/array.rb +51 -0
  10. data/lib/fox/core_ext/hash.rb +17 -0
  11. data/lib/fox/core_ext/io_binary_read.rb +20 -0
  12. data/lib/fox/error.rb +8 -0
  13. data/lib/fox/error/errors.rb +232 -0
  14. data/lib/fox/interface/thor/all.rb +34 -0
  15. data/lib/fox/interface/thor/configuration.rb +71 -0
  16. data/lib/fox/interface/thor/create.rb +49 -0
  17. data/lib/fox/interface/thor/default.rb +67 -0
  18. data/lib/fox/interface/thor/init.rb +57 -0
  19. data/lib/fox/interface/thor/mixin/config_choice.rb +3 -3
  20. data/lib/fox/interface/thor/mixin/configuration.rb +1 -1
  21. data/lib/fox/interface/thor/mixin/database.rb +129 -0
  22. data/lib/fox/interface/thor/mixin/default.rb +6 -0
  23. data/lib/fox/interface/thor/mixin/default_model.rb +13 -0
  24. data/lib/fox/interface/thor/mixin/generators/base_generator.rb +35 -0
  25. data/lib/fox/interface/thor/mixin/generators/structure.rb +41 -0
  26. data/lib/fox/interface/thor/mixin/generators/template_loader.rb +48 -0
  27. data/lib/fox/interface/thor/mixin/history.rb +12 -0
  28. data/lib/fox/interface/thor/mixin/logger.rb +2 -2
  29. data/lib/fox/interface/thor/mixin/model.rb +19 -0
  30. data/lib/fox/interface/thor/new.thor +74 -0
  31. data/lib/fox/interface/thor/version.rb +59 -0
  32. data/lib/fox/library/choice.rb +160 -0
  33. data/lib/fox/library/logger.rb +175 -0
  34. data/lib/fox/library/project_builder.rb +83 -0
  35. data/lib/fox/library/secure_config.rb +114 -0
  36. metadata +298 -7
  37. data/lib/fox/interface/thor/version.thor +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 814f5a6e5abc6ffd2eef794ba91812a6643294b4
4
- data.tar.gz: 686b3443f7a26d29d11ca2fdec87aadc94c45045
3
+ metadata.gz: 958a7a559e25d833355bdf0fffd38dac5a54d6d6
4
+ data.tar.gz: af8ee1fde1f1f28701dce0549736b9e6f536f15d
5
5
  SHA512:
6
- metadata.gz: b77d62f2e1b0027dd7b2c79c7cf64a81b5ad5cf9365c69149142c6c545a50e1887983df30d7470fdfa2c0d76b359f60282607e86fc1875c9f0d05422f352d547
7
- data.tar.gz: 84c95f63f6867e0c6467a6b298210b4980d5d1dfd89b1cffd25013d543b0ffc759ad9b3f4ad2a0231cc30728b518697583f8eb633e74287033c6ac84751c6f71
6
+ metadata.gz: 587e812e9e989e5e936a3503af624fe4d4848b7243c679d23034076cbb9807a9b5f82f9b9e27f140c651f47bf50cbcc6a878949378826d4c038966c41498d2fd
7
+ data.tar.gz: de4e187eb5304bac91fffd4475ed344af4f05ea7305fa31eb0ea564d528d4baaa4136959f748db5e265ec5772750b00b60626e542fd435f0338acae6a6670328
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  # Fox
2
- Version 0.0.1-1-g385406b
2
+ Version 0.0.2-2-g78e0147
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/fox.svg)](http://badge.fury.io/rb/fox)
5
5
  [![License](http://img.shields.io/badge/license-GPLv3-brightgreen.svg)](http://img.shields.io/badge/license-GPLv3-brightgreen.svg)
6
6
 
7
+
8
+ ## WHAT IS THE FOX PROJECT?
9
+
7
10
  Fox [1] is a complete solution for scientific paper scaffolding, tooling and author support. It
8
11
  allows the bootstrapping or generation of dummy default paper with a rails scaffold like commandline
9
12
  tool.
@@ -11,39 +14,63 @@ tool.
11
14
  Fox supports the configuration of various methods of pdf push to remote locations to allow for
12
15
  efficient file sharing with co-authors.
13
16
 
17
+ Fox, currently supports only IEEE Robotics & Automation Society (ICRA) [2].
18
+
19
+ [1] Paper Fox, named after an in similar spirit deviation from the german "papier tiger"
20
+ [2] IEEE Robotics and Automation Society's flagship conference, IEEE Robotics & Automation Society, http://icra2015.org/
14
21
 
15
- Fox, supports currently the following international journals:
16
22
 
17
- - None, TBD
23
+ ## FEATURES
18
24
 
19
- Fox, supports currently the following international conferences:
25
+ - Application
26
+ - Ruby VM (2.1 or better)
27
+ - Feature Providing Base Libraries
28
+ - RVM
29
+ - Bundler
30
+ - Datamapper ORM with SQLite3/MySQL
31
+ - Slim
32
+ - Various Gems (see Gemfile)
33
+ - Development
34
+ - Development Base Libraries
35
+ - Rake
36
+ - Thor
37
+ - Code Quality
38
+ - Code review
39
+ - Yard & related (gem install yard --no-ri --no-rdoc ; gem install rdiscount --no-ri --no-rdoc)
40
+ - Minimal controllers, delegated to proper Ruby classes
41
+ - Logic free view templates
42
+ - Proper Ruby OOP for base functionality
43
+ - MetricFu/RSpec/Cucumber/DBC/Vagrant/Docker/i18n
20
44
 
21
- - IEEE Robotics & Automation Society (ICRA) [2]
22
45
 
23
- Fox, supports currently the following domestic conferences:
46
+ ## ON WHAT HARDWARE DOES IT RUN?
24
47
 
25
- - None, TBD
48
+ This Software was originally developed and tested on 32-bit x86 / SMP based PCs running on
49
+ Gentoo GNU/Linux 3.12.x. Other direct Linux and Unix derivates should be viable too as
50
+ long as all dynamical linking dependencys are met.
26
51
 
27
52
 
28
- [1] Paper Fox, named after an in similar spirit deviation from the german "papier tiger"
29
- [2] IEEE Robotics and Automation Society's flagship conference, IEEE Robotics & Automation Society, http://icra2015.org/
53
+ ## DOCUMENTATION
30
54
 
55
+ A general developers API guide can be extracted from the Yardoc subdirectory which is able to
56
+ generate HTML as well as PDF docs. Please refer to the [Rake|Make]file for additional information
57
+ how to generate this documentation.
31
58
 
32
- ## Installing
59
+ ## INSTALLING
33
60
 
34
- By running gem comand
61
+ By running gem comand (stable version)
35
62
 
36
63
  ```
37
64
  gem install fox
38
65
  ```
39
66
 
40
- or by adding to `Gemfile`
67
+ or by adding to `Gemfile` (unstable version)
41
68
 
42
69
  ```ruby
43
- gem 'fox', git: 'https://github.com/rennhak/fox'
70
+ gem 'fox', git: 'https://github.com/rennhak/fox', branch: 'develop'
44
71
  ```
45
72
 
46
- ## Usage
73
+ ## USAGE
47
74
 
48
75
  As library
49
76
 
@@ -62,6 +89,161 @@ Commands:
62
89
  fox generate
63
90
  ```
64
91
 
92
+ ## DEVELOPMENT
93
+
94
+ Get a copy of current source from SCM
95
+
96
+ ```sh
97
+ ~# git clone https://github.com/rennhak/fox
98
+ ```
99
+
100
+ Install system dependencies (e.g. Debian/GNU)
101
+
102
+ ```sh
103
+ ~# apt-get install iconv
104
+ ~# apt-get install imagemagick libmagickcore-dev libmagickwand-dev libmagic1 libmagic-dev
105
+ ~# apt-get install curl screen less vim
106
+ ~# apt-get install zlib1g zlib1g-dev
107
+ ```
108
+
109
+ Install RVM (may not apply)
110
+
111
+ ```sh
112
+ ~# curl -sSL https://get.rvm.io | bash -s stable
113
+ ```
114
+
115
+ Make sure to follow install instructions and also integrate it also into your shell. e.g. for ZSH,
116
+ add this line to your .zshrc.
117
+
118
+ ```sh
119
+ [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" ;
120
+
121
+ or
122
+
123
+ ~# echo "source /usr/local/rvm/scripts/rvm" >> ~/.zshrc
124
+
125
+ ```
126
+
127
+ Create proper RVM gemset
128
+
129
+ ```sh
130
+ ~# rvm --create use 2.1.3@fox_project
131
+ ```
132
+
133
+ Install Ruby VM 2.1.x or better
134
+
135
+ ```sh
136
+ ~# rvm install 2.1.3
137
+ ```
138
+
139
+ Install libraries via bundler
140
+
141
+ ```sh
142
+ ~# gem install bundler
143
+ ~# bundle
144
+ ```
145
+
146
+ Development uses SQLite3
147
+
148
+ ```sh
149
+ ~# apt-get install sqlite3 libsqlite3-dev
150
+ ```
151
+
152
+ ### BUILDING GEM
153
+
154
+ ```sh
155
+ ~# rake build
156
+ ```
157
+
158
+ ### INSTALLING GEM
159
+
160
+ ```sh
161
+ ~# gem install pkg/fox-X.X.X.gem
162
+ ```
163
+
164
+ ### SUBMIT TO RUBYGEMS.ORG
165
+
166
+ ```sh
167
+ ~# cd pkg
168
+ ~# gem push -V fox-X.X.X.gem
169
+ ```
170
+
171
+ ### CURRENTLY AVAILABLE RAKE TASKS
172
+
173
+ For a full list of Rake tasks suported, use `rake -T`.
174
+
175
+ rake build # Build fox-0.0.2.gem into the pkg directory
176
+ rake cucumber:pretty # Run Cucumber features
177
+ rake cucumber:progress # Run Cucumber features
178
+ rake default # Show the default task when executing rake without arguments
179
+ rake docs:generate # Generate Yardoc documentation for this project
180
+ rake docs:graph # Generate Yard Graphs for this project
181
+ rake guard:default # Execute Ruby Guard
182
+ rake help # Shows the usage help screen
183
+ rake install # Build and install fox-0.0.2.gem into system gems
184
+ rake man:build # Build the manual pages
185
+ rake man:clean # Clean up from the built man pages
186
+ rake measurement:benchmark # When executing rake tasks measure elapsed time, used with other tasks
187
+ rake measurement:profiling # Run profiling over stack
188
+ rake metric:metric # Run metric fu for project
189
+ rake package:clean # Clean all files from pkg folder
190
+ rake readme:all # Generate proper README file from templates
191
+ rake readme:subdirs # Builds generates readme files in all sub-directories
192
+ rake readme:topdir # Generate top level README file from template
193
+ rake release # Create tag v0.0.2 and build and push fox-0.0.2.gem to Rubygems
194
+ rake spec # RSpec Core Tasks
195
+ rake todo # Look for TODO and FIXME tags in the code
196
+ rake version # Git Tag number of this repo
197
+
198
+
199
+
200
+ ### CURRENTLY AVAILABLE THOR TASKS
201
+
202
+ For a full list of Thor tasks suported, use `thor -T`.
203
+
204
+ default
205
+ -------
206
+ thor :build # build
207
+ thor :clean # clean
208
+ thor :default # Show the default task when executing rake without arguments
209
+ thor :docs:generate # Generate Yardoc documentation for this project
210
+ thor :docs:graph # Generate Yard Graphs for this project
211
+ thor :guard:default # Execute Ruby Guard
212
+ thor :help # Shows the usage help screen
213
+ thor :install # Build and install fox-0.0.2.gem into system gems
214
+ thor :man:build # Build the manual pages
215
+ thor :man:clean # Clean up from the built man pages
216
+ thor :measurement:benchmark # When executing rake tasks measure elapsed time, used with other tasks
217
+ thor :measurement:profiling # Run profiling over stack
218
+ thor :metric:metric # Run metric fu for project
219
+ thor :package:clean # Clean all files from pkg folder
220
+ thor :readme:all # Generate proper README file from templates
221
+ thor :readme:subdirs # Builds generates readme files in all sub-directories
222
+ thor :readme:topdir # Generate top level README file from template
223
+ thor :release # release
224
+ thor :spec # Run RSpec code examples
225
+ thor :todo # Look for TODO and FIXME tags in the code
226
+ thor :version # Git Tag number of this repo
227
+
228
+ info
229
+ ----
230
+ thor info:overview # Shows system overview
231
+
232
+ version
233
+ -------
234
+ thor version:show # Show version of this app
235
+
236
+
237
+
238
+
239
+ ## IF SOMETHING GOES WRONG
240
+
241
+ In case you enconter bugs which seem to be related to the package please check in
242
+ the MAINTAINERS file for the associated person in charge and contact him or her directly. If
243
+ there is no valid address then try to mail Bjoern Rennhak <bjoern AT clothesnetwork DOT com> to get
244
+ some basic assistance in finding the right person in charge of this section of the project.
245
+
246
+
65
247
  ## Contributing
66
248
 
67
249
  1. Fork it ( https://github.com/rennhak/fox/fork )
data/bin/fox CHANGED
@@ -2,21 +2,41 @@
2
2
 
3
3
  # Make sure load path contains local + global
4
4
  $LOAD_PATH << '.'
5
- $LOAD_PATH << File.dirname( File.join( __FILE__, '../lib/' ) )
5
+ $LOAD_PATH << 'lib'
6
+
7
+ $LOAD_PATH << File.expand_path("#{File.expand_path('../..', __FILE__)}/lib/fox/messages")
8
+ $LOAD_PATH << File.expand_path("#{File.expand_path('../..', __FILE__)}/lib/fox/service")
6
9
 
7
10
  # System includes
8
11
  require 'bundler'
12
+
13
+ # Make Thor scripts debug-able, e.g. ruby -r debug -- Thorfile
9
14
  require 'thor' unless defined? Thor::Runner
15
+ require 'thor/runner'
16
+
17
+ # Development Mode?
18
+ if ENV["FOX_ENV"] == "development"
19
+ require "simplecov"
20
+
21
+ # Ensure merging of subprocesses by giving them a special name
22
+ # SimpleCov.command_name ARGV.join(" ")
23
+ SimpleCov.command_name "Fox #{Process.pid}"
24
+
25
+ # Set the correct root folder for SimpleCov
26
+ SimpleCov.root File.join(File.expand_path(File.dirname(__FILE__)), "..")
27
+
28
+ # Start coverage
29
+ SimpleCov.start
30
+ end # of if ENV
31
+
10
32
 
11
- # Custom includes
12
- require_relative '../lib/fox'
33
+ # Fox::Runner.new( ARGV.dup ).execute!
34
+ $thor_runner = true
13
35
 
36
+ require File.expand_path("#{File.expand_path('../..', __FILE__)}/lib/fox/cli")
14
37
 
15
- # @class Fox executable
16
- # @brief Main entry point for commandline execution
17
- class Default < Thor
18
- end # of class Default
38
+ $thor_runner = true
39
+ CLI.start
19
40
 
20
- Default.start( ARGV )
21
41
 
22
42
  # vim:ts=2:tw=100:wm=100:syntax=ruby
@@ -58,8 +58,6 @@ Gem::Specification.new do |spec|
58
58
 
59
59
  spec.files += Dir.glob( 'spec/**/*' )
60
60
 
61
- spec.files += Dir.glob( 'thrift/**/*' )
62
-
63
61
  spec.files += Dir.glob( 'data/**/*' )
64
62
 
65
63
  spec.files += Dir.glob( 'documentation/**/*' )
@@ -68,6 +66,10 @@ Gem::Specification.new do |spec|
68
66
 
69
67
  spec.files += Dir.glob( 'base/**/*' )
70
68
 
69
+ spec.files += Dir.glob( 'lib/fox/template/*' )
70
+
71
+ spec.files += Dir.glob( 'lib/thrift/**/*' )
72
+
71
73
  spec.test_files += Dir.glob( 'test/**/*' )
72
74
  spec.test_files += Dir.glob( 'spec/**/*' )
73
75
  spec.test_files += Dir.glob( 'features/**/*' )
@@ -79,12 +81,48 @@ Gem::Specification.new do |spec|
79
81
 
80
82
  # General
81
83
  spec.add_runtime_dependency 'thor'
82
- spec.add_runtime_dependency 'ruby-try', '~> 1.1.1'
84
+
85
+ # Package building
86
+ spec.add_runtime_dependency 'fpm'
83
87
 
84
88
  # Shell
85
89
  spec.add_runtime_dependency 'ptools'
86
90
  spec.add_runtime_dependency 'os'
87
91
 
92
+ # Database ORM (Persistent)
93
+ spec.add_runtime_dependency 'datamapper'
94
+ spec.add_runtime_dependency 'data_mapper'
95
+ spec.add_runtime_dependency 'dm-core'
96
+ spec.add_runtime_dependency 'dm-tags'
97
+ spec.add_runtime_dependency 'dm-migrations'
98
+ spec.add_runtime_dependency 'dm-types'
99
+ spec.add_runtime_dependency 'dm-enum'
100
+ spec.add_runtime_dependency 'dm-validations'
101
+ spec.add_runtime_dependency 'dm-timestamps'
102
+ spec.add_runtime_dependency 'dm-sqlite-adapter'
103
+ spec.add_runtime_dependency 'dm-do-adapter'
104
+
105
+ # Data RPCs and Messaging
106
+ spec.add_runtime_dependency 'msgpack'
107
+
108
+ spec.add_runtime_dependency 'faraday'
109
+ spec.add_runtime_dependency 'mime-types'
110
+
111
+ # Data Exchange Containers/Parsing
112
+ spec.add_runtime_dependency 'oj'
113
+
114
+ # Caching
115
+ spec.add_runtime_dependency 'moneta'
116
+
117
+ # Mail
118
+ spec.add_runtime_dependency 'pony'
119
+
120
+ # l10n
121
+ spec.add_runtime_dependency 'gettext'
122
+
123
+ # Rest interface
124
+ spec.add_runtime_dependency 'rack'
125
+
88
126
  # Monadic/Functional
89
127
  spec.add_runtime_dependency 'andand'
90
128
  # spec.add_runtime_dependency 'ick'
data/lib/fox.rb CHANGED
@@ -7,19 +7,32 @@ require 'rake'
7
7
  require 'ruby-try'
8
8
 
9
9
 
10
- # @class Fox
11
- # @brief Provides complete solution for scientific authoring
12
- class Fox
10
+ # @module module Fox
11
+ # @brief Fox modules and classes namespace
12
+ module Fox
13
13
 
14
- # @fn def initialize {{{
15
- # @brief Default Constructor
16
- def initialize
17
- end # }}}
14
+ require_relative 'fox/version'
15
+ require_relative 'fox/error'
18
16
 
19
- end # of module Fox
17
+ # @module module Mixin
18
+ # @brief Mixin module contains various functions to be used in other components
19
+ module Mixin
20
+
21
+ # autoload :Guess, 'fox/mixin/'
22
+
23
+ end # of module Mixing
24
+
25
+ # autoload :Cache, 'fox/library/cache'
26
+ # autoload :Choice, 'fox/library/choice'
20
27
 
21
- # Load other library files
22
- Dir[ File.dirname(__FILE__) + '/fox/library/*.rb' ].each { |file| require file }
23
28
 
29
+ DEFAULT_CONFIG = '.fox/config.yaml'.freeze
30
+
31
+ class << self
32
+ end # of class << self
33
+
34
+ end # of module Fox
35
+
36
+ Default.start
24
37
 
25
38
  # vim:ts=2:tw=100:wm=100:syntax=ruby
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # System
4
+ require "thor"
5
+
6
+ # Custom
7
+ require File.expand_path(File.dirname(__FILE__) + '/interface/thor/version')
8
+ require File.expand_path(File.dirname(__FILE__) + '/interface/thor/configuration')
9
+
10
+
11
+ class CLI < Thor
12
+
13
+ register(Version, 'version', 'version [something]', "Show current version")
14
+ register(Configuration, 'config', 'config [something]', "Type for work with fox config")
15
+
16
+ end
17
+
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # System
4
+ require "yaml"
5
+
6
+
7
+ module Fox
8
+
9
+ # @class Configuration
10
+ # @brief Configuration control class
11
+ class Configuration
12
+
13
+ attr_accessor :project_name
14
+ attr_accessor :base_dir
15
+
16
+ # @fn def initialize confguration_file # {{{
17
+ # @brief Constructor for Configuration class
18
+ #
19
+ # @param [String] - path to configuration file
20
+ def initialize confguration_file = nil
21
+ configuration = if confguration_file
22
+ base_configuration.merge(YAML.load_file(confguration_file))
23
+ else
24
+ base_configuration
25
+ end
26
+
27
+ # @todo add a deep loop for inner key-value pair
28
+ configuration.each do |key, value|
29
+ # if Default configuration not contain property, then we should raise exception
30
+ raise Exception.new("Unexpected #{key} for Fox configuration") unless base_configuration.include?(key)
31
+ instance_variable_set(:"@#{key}", value)
32
+ end
33
+ end # of def initialize }}}
34
+
35
+ # @fn def base_configuration {{{
36
+ # @brief return default configuration for Fox
37
+ # @return [Hash]
38
+ def base_configuration
39
+ {
40
+ "project_name" => "project-#{rand(100)}",
41
+ "base_dir" => Dir.pwd
42
+ }
43
+ end # of def base_configuration }}}
44
+
45
+ end # end of Configure class
46
+
47
+ end # end of Fox module
48
+