vedeu 0.4.35 → 0.4.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Dockerfile +56 -35
- data/bin/vedeu +54 -13
- data/docs/applications.md +92 -0
- data/features/cli_vedeu.feature +5 -0
- data/features/start_stop.feature +1 -1
- data/features/step_definitions/vedeu_steps.rb +0 -0
- data/features/support/env.rb +3 -2
- data/lib/vedeu.rb +1 -0
- data/lib/vedeu/all.rb +6 -0
- data/lib/vedeu/application/all.rb +2 -0
- data/lib/vedeu/application/application_controller.rb +7 -0
- data/lib/vedeu/application/application_helper.rb +7 -0
- data/lib/vedeu/bootstrap.rb +73 -0
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +7 -14
- data/lib/vedeu/generator/all.rb +13 -0
- data/lib/vedeu/generator/application.rb +108 -0
- data/lib/vedeu/generator/helpers.rb +55 -0
- data/lib/vedeu/generator/templates/application/Gemfile +3 -0
- data/lib/vedeu/generator/templates/application/app/controllers/application_controller.erb +7 -0
- data/lib/vedeu/generator/templates/application/app/controllers/name.erb +10 -0
- data/lib/vedeu/generator/templates/application/app/helpers/application_helper.erb +9 -0
- data/lib/vedeu/generator/templates/application/app/helpers/name.erb +9 -0
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_global_.rb +2 -0
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +2 -0
- data/lib/vedeu/generator/templates/application/app/views/interfaces/name.erb +44 -0
- data/lib/vedeu/generator/templates/application/app/views/name.erb +0 -0
- data/lib/vedeu/generator/templates/application/app/views/templates/name.erb +0 -0
- data/lib/vedeu/generator/templates/application/application.rb +9 -0
- data/lib/vedeu/generator/templates/application/bin/name +7 -0
- data/lib/vedeu/generator/templates/application/config/app_name.erb +1 -0
- data/lib/vedeu/generator/templates/application/config/configuration.rb +22 -0
- data/lib/vedeu/generator/templates/application/lib/.gitkeep +0 -0
- data/lib/vedeu/generator/templates/application/test/.gitkeep +0 -0
- data/lib/vedeu/generator/templates/application/vendor/.gitkeep +0 -0
- data/lib/vedeu/generator/view.rb +71 -0
- data/lib/vedeu/geometry/area.rb +21 -21
- data/lib/vedeu/main_loop.rb +0 -1
- data/lib/vedeu/output/esc.rb +5 -4
- data/lib/vedeu/output/refresh.rb +9 -3
- data/lib/vedeu/output/view_helpers/all.rb +0 -2
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/template.rb +1 -1
- data/lib/vedeu/support/terminal.rb +10 -2
- data/lib/vedeu/tasks/application.rake +28 -0
- data/lib/vedeu/tasks/vedeu.rake +3 -0
- data/lib/vedeu/templating/directive.rb +1 -8
- data/lib/vedeu/traps.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_controller_test.rb +12 -0
- data/test/lib/vedeu/application/application_helper_test.rb +18 -0
- data/test/lib/vedeu/bootstrap_test.rb +30 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +7 -0
- data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -0
- data/test/lib/vedeu/configuration/api_test.rb +6 -0
- data/test/lib/vedeu/cursor/move_test.rb +7 -0
- data/test/lib/vedeu/distributed/client_test.rb +4 -0
- data/test/lib/vedeu/distributed/server_test.rb +9 -0
- data/test/lib/vedeu/dsl/use_test.rb +4 -0
- data/test/lib/vedeu/generator/application_test.rb +55 -0
- data/test/lib/vedeu/generator/helpers_test.rb +80 -0
- data/test/lib/vedeu/generator/view_test.rb +35 -0
- data/test/lib/vedeu/geometry/area_test.rb +8 -0
- data/test/lib/vedeu/launcher_test.rb +2 -0
- data/test/lib/vedeu/main_loop_test.rb +2 -0
- data/test/lib/vedeu/null/interface_test.rb +1 -0
- data/test/lib/vedeu/output/clear_test.rb +3 -0
- data/test/lib/vedeu/output/refresh_test.rb +1 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +1 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +3 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +2 -0
- data/test/lib/vedeu/repositories/repository_test.rb +1 -0
- data/test/lib/vedeu/support/log_test.rb +5 -0
- data/test/lib/vedeu/support/terminal_test.rb +1 -0
- data/test/lib/vedeu/traps_test.rb +1 -1
- data/test/lib/vedeu_test.rb +1 -0
- data/vedeu.gemspec +7 -4
- metadata +97 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ecad92f4001170f4fa870a5738639b549bd5030
|
4
|
+
data.tar.gz: aebc0c775c358a62c309bdfba93d58d01077c662
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe008b535bc415a6a7c6829ebf256bc0913edf2fe5d2abc4808e8e8ea67d9ee7e8ca9e14286de8d5829617abd381f47dfe070117190194468f796b2f707dc25
|
7
|
+
data.tar.gz: d822a5e46f9c3897c49eb7edb65f4ecb2c32b61a5bc0c62ac1f2b6080febebcfc439d80e81e0e8832ca392f08b6fa9b6fc375e1ff15b08cc22e29f7154aeccc5
|
data/.rubocop.yml
CHANGED
@@ -368,6 +368,9 @@ Style/LambdaCall:
|
|
368
368
|
- call
|
369
369
|
- braces
|
370
370
|
|
371
|
+
Style/ModuleFunction:
|
372
|
+
Enabled: false
|
373
|
+
|
371
374
|
Style/Next:
|
372
375
|
# With `always` all conditions at the end of an iteration needs to be
|
373
376
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
data/Dockerfile
CHANGED
@@ -2,43 +2,39 @@ FROM ubuntu:15.04
|
|
2
2
|
MAINTAINER Gavin Laking <gavinlaking@gmail.com>
|
3
3
|
|
4
4
|
# Build dependencies
|
5
|
-
RUN apt-get update
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
RUN apt-get clean -y
|
31
|
-
RUN apt-get autoremove -y
|
5
|
+
RUN apt-get update && apt-get install -y --force-yes \
|
6
|
+
software-properties-common \
|
7
|
+
build-essential \
|
8
|
+
openssl \
|
9
|
+
ca-certificates \
|
10
|
+
git-core \
|
11
|
+
autoconf \
|
12
|
+
gawk \
|
13
|
+
libreadline-dev \
|
14
|
+
libyaml-dev \
|
15
|
+
libgdbm-dev \
|
16
|
+
libncurses5-dev \
|
17
|
+
automake \
|
18
|
+
libtool \
|
19
|
+
bison \
|
20
|
+
pkg-config \
|
21
|
+
curl \
|
22
|
+
wget \
|
23
|
+
libxslt-dev \
|
24
|
+
libxml2-dev \
|
25
|
+
libffi-dev \
|
26
|
+
libssl-dev \
|
27
|
+
zlib1g-dev \
|
28
|
+
make
|
29
|
+
RUN apt-get clean -y && apt-get autoremove -y
|
32
30
|
|
33
31
|
# Chruby
|
34
32
|
RUN wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
|
35
|
-
RUN tar -xzvf chruby-0.3.9.tar.gz
|
36
|
-
RUN cd chruby-0.3.9/ && make install
|
33
|
+
RUN tar -xzvf chruby-0.3.9.tar.gz && cd chruby-0.3.9/ && make install
|
37
34
|
|
38
35
|
# Ruby Install
|
39
36
|
RUN wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
|
40
|
-
RUN tar -xzvf ruby-install-0.5.0.tar.gz
|
41
|
-
RUN cd ruby-install-0.5.0/ && make install
|
37
|
+
RUN tar -xzvf ruby-install-0.5.0.tar.gz && cd ruby-install-0.5.0/ && make install
|
42
38
|
|
43
39
|
# Install Ruby 2.2.2
|
44
40
|
RUN ruby-install ruby 2.2.2
|
@@ -48,12 +44,37 @@ RUN echo '[ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ] || return' >> /etc/pro
|
|
48
44
|
RUN echo 'source /usr/local/share/chruby/chruby.sh' >> /etc/profile.d/chruby.sh
|
49
45
|
RUN echo 'source /usr/local/share/chruby/auto.sh' >> $HOME/.bashrc
|
50
46
|
RUN echo 'chruby ruby-2.2.2' >> $HOME/.bash_profile
|
51
|
-
|
52
|
-
# Setup .gemrc
|
53
|
-
RUN echo "---\n:benchmark: false\n:bulk_threshold: 1000\n:backtrace: false\n:verbose: true\ngem: --no-ri --no-rdoc" > $HOME/.gemrc
|
47
|
+
RUN echo "---\n:benchmark: false\n:bulk_threshold: 1000\n:backtrace: false\n:verbose: true\ngem: --no-ri --no-rdoc" >> $HOME/.gemrc
|
54
48
|
|
55
49
|
# Setup PATH
|
56
|
-
ENV PATH /opt/rubies/ruby-2.2.2/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
50
|
+
ENV PATH /opt/rubies/ruby-2.2.2/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/vedeu/gem/bin
|
57
51
|
|
58
52
|
# Get ruby version
|
59
53
|
RUN ruby -v
|
54
|
+
|
55
|
+
# Create a fake home directory
|
56
|
+
RUN usr/sbin/useradd --create-home --home-dir /home/vedeu --shell /bin/bash vedeu
|
57
|
+
|
58
|
+
# Make files
|
59
|
+
RUN mkdir /home/vedeu/gem
|
60
|
+
RUN chown -R vedeu:vedeu /home/vedeu
|
61
|
+
RUN gem install bundler
|
62
|
+
|
63
|
+
# VOLUME .:/home/vedeu/gem
|
64
|
+
|
65
|
+
ADD . /home/vedeu/gem/
|
66
|
+
WORKDIR /home/vedeu
|
67
|
+
USER vedeu
|
68
|
+
|
69
|
+
# To build this file:
|
70
|
+
#
|
71
|
+
# sudo docker build -t vedeu/my_first_app .
|
72
|
+
#
|
73
|
+
#
|
74
|
+
# Once we're up and running, we can create a shell to the docker instance and
|
75
|
+
# start running commands against it.
|
76
|
+
#
|
77
|
+
# sudo docker run -it -v $PWD:/home/vedeu/gem:rw vedeu/my_first_app /bin/bash
|
78
|
+
#
|
79
|
+
#
|
80
|
+
|
data/bin/vedeu
CHANGED
@@ -1,15 +1,56 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
bundler_message = 'Bundler is required. Please install bundler with ' \
|
6
|
+
"'gem install bundler'"
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'bundler'
|
10
|
+
|
11
|
+
rescue LoadError
|
12
|
+
puts bundler_message
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
fail bundler_message unless defined?(Bundler)
|
17
|
+
|
18
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
19
|
+
# load Gem.bin_path('bundler', 'bundle')
|
20
|
+
|
21
|
+
Bundler.setup
|
22
|
+
|
23
|
+
Rake.application.init
|
24
|
+
|
25
|
+
gem_dir = File.expand_path('..', File.dirname(__FILE__))
|
26
|
+
$LOAD_PATH.unshift(gem_dir) unless $LOAD_PATH.include?(gem_dir)
|
27
|
+
|
28
|
+
# Initialize vedeu
|
29
|
+
require 'vedeu'
|
30
|
+
|
31
|
+
# Load the rake tasks of vedeu
|
32
|
+
load "#{gem_dir}/lib/vedeu/tasks/vedeu.rake"
|
33
|
+
|
34
|
+
# Let's go!
|
35
|
+
begin
|
36
|
+
if ARGV.empty?
|
37
|
+
print "\n\e[33mVedeu v#{Vedeu::VERSION}\e[39m\n\n"
|
38
|
+
print "\e[4m\e[36mUsage:\e[39m\e[24m\n\n"
|
39
|
+
print "\e[32m vedeu new [app_name]\e[39m\n"
|
40
|
+
print " Creates the skeleton file and directory structure for a new Vedeu client application.\n\n"
|
41
|
+
print "\e[32m vedeu view [view_name]\e[39m\n"
|
42
|
+
print " Creates a new view for Vedeu.\n"
|
43
|
+
print "\n\n"
|
44
|
+
|
45
|
+
else
|
46
|
+
Rake.application.invoke_task(ARGV.shift)
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
rescue RuntimeError => exception
|
51
|
+
puts 'Vedeu Error: Either the task you specified failed, or the task could ' \
|
52
|
+
"not be built.\n"
|
53
|
+
puts "Exception: #{exception.class.name}"
|
54
|
+
puts "Message: #{exception.message}"
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
## Vedeu Applications
|
2
|
+
|
3
|
+
Vedeu has basic tools to generate client application scaffolding, in a similar way to Ruby on Rails. Although not nearly as advanced as the Rails equivalent,
|
4
|
+
hopefully these generators will get you off the ground.
|
5
|
+
|
6
|
+
### Application Structure
|
7
|
+
|
8
|
+
|
|
9
|
+
|- app_name/
|
10
|
+
| |
|
11
|
+
|- app/
|
12
|
+
| |- controllers
|
13
|
+
| |- helpers
|
14
|
+
| |- models
|
15
|
+
| | |- keymaps
|
16
|
+
| |- views
|
17
|
+
| |- interfaces
|
18
|
+
| |- templates
|
19
|
+
|
|
20
|
+
|- bin
|
21
|
+
|- config
|
22
|
+
|- lib
|
23
|
+
|- test
|
24
|
+
|- vendor
|
25
|
+
|
|
26
|
+
|
27
|
+
To create the application structure as shown above:
|
28
|
+
|
29
|
+
vedeu new app_name
|
30
|
+
|
31
|
+
Let's talk about each directory and its purpose.
|
32
|
+
|
33
|
+
#### app/controllers
|
34
|
+
|
35
|
+
The controllers directory is the place to store the events and behaviour logic
|
36
|
+
of your application. It will manage the choosing of views and models based on
|
37
|
+
previous choices. Think of them as the orchestrators of your application.
|
38
|
+
|
39
|
+
In web applications, the controller typically handles the routed request and interacts with the models and sets up the views. In Vedeu, it does much the same, minus the requests.
|
40
|
+
|
41
|
+
#### app/helpers
|
42
|
+
|
43
|
+
Ruby on Rails has a concept of helpers which are not very object-oriented, but
|
44
|
+
allow you to share functionality/behaviour across multiple views. Vedeu uses this concept as it will be familiar to many Rails developers and might be helpful to beginners.
|
45
|
+
|
46
|
+
#### app/models
|
47
|
+
|
48
|
+
Much like `lib`, this directory is for your application logic code. Some people
|
49
|
+
prefer to use `app/models`, others like to use `lib`. Some even use both!
|
50
|
+
|
51
|
+
#### app/models/keymaps
|
52
|
+
|
53
|
+
This will contain the global keymap (which affects all of your application) plus any specific interface keymaps which only affect a certain interface when
|
54
|
+
in focus.
|
55
|
+
|
56
|
+
#### app/views
|
57
|
+
|
58
|
+
This will contain classes which produce the views needed by Vedeu to make your
|
59
|
+
application come alive!
|
60
|
+
|
61
|
+
#### app/views/interfaces
|
62
|
+
|
63
|
+
This will contain the information Vedeu needs to draw the various interfaces and views of your application.
|
64
|
+
|
65
|
+
#### app/views/templates
|
66
|
+
|
67
|
+
This will house the templates your application will use to display views. You can populate templates with generic view information and supplement it with
|
68
|
+
variable data from your application.
|
69
|
+
|
70
|
+
#### bin
|
71
|
+
|
72
|
+
This will contain executable Ruby scripts (or Bash, or shell language of your choice) which will launch your application or provide command-line behaviours.
|
73
|
+
|
74
|
+
#### config
|
75
|
+
|
76
|
+
This will contain any configuration your application needs to run, plus the
|
77
|
+
configuration for Vedeu. This configuration affects the way Vedeu works with
|
78
|
+
your application.
|
79
|
+
|
80
|
+
#### lib
|
81
|
+
|
82
|
+
This is for code your application may use to support code you have in `app/models`.
|
83
|
+
|
84
|
+
#### test
|
85
|
+
|
86
|
+
This is for the tests you might write to help ensure your application executes
|
87
|
+
in the way you expect.
|
88
|
+
|
89
|
+
#### vendor
|
90
|
+
|
91
|
+
This is for third-party code which your application might want to ship with. Usually you will include various Ruby gems to provide functionality, but you
|
92
|
+
might want to do something special.
|
data/features/start_stop.feature
CHANGED
File without changes
|
data/features/support/env.rb
CHANGED
@@ -4,9 +4,10 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
|
4
4
|
require 'simplecov'
|
5
5
|
require 'aruba'
|
6
6
|
require 'aruba/cucumber'
|
7
|
-
|
7
|
+
require 'aruba/in_process'
|
8
8
|
require 'mocha/api'
|
9
|
-
|
9
|
+
|
10
|
+
require_relative '../../lib/vedeu.rb'
|
10
11
|
|
11
12
|
class CucumberError < StandardError; end
|
12
13
|
|
data/lib/vedeu.rb
CHANGED
data/lib/vedeu/all.rb
CHANGED
@@ -13,6 +13,8 @@ require 'vedeu/repositories/all'
|
|
13
13
|
require 'vedeu/api'
|
14
14
|
require 'vedeu/bindings'
|
15
15
|
|
16
|
+
require 'vedeu/generator/all'
|
17
|
+
|
16
18
|
# load order has not been fully established beyond this point
|
17
19
|
|
18
20
|
require 'vedeu/buffers/all'
|
@@ -31,3 +33,7 @@ require 'vedeu/templating/all'
|
|
31
33
|
require 'vedeu/main_loop'
|
32
34
|
require 'vedeu/application'
|
33
35
|
require 'vedeu/launcher'
|
36
|
+
|
37
|
+
require 'vedeu/application/all'
|
38
|
+
|
39
|
+
require 'vedeu/bootstrap'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Provides the mechanism to start up a generated application.
|
4
|
+
#
|
5
|
+
# This class loads all necessary client application files and initializes
|
6
|
+
# Vedeu with this data, then starts the client application.
|
7
|
+
class Bootstrap
|
8
|
+
|
9
|
+
# @param argv [Array<String>]
|
10
|
+
# @return [void]
|
11
|
+
def self.start(argv = ARGV)
|
12
|
+
new(argv).start
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param argv [Array<String>]
|
16
|
+
# @return [Vedeu::Bootstrap]
|
17
|
+
def initialize(argv)
|
18
|
+
@argv = argv
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [void]
|
22
|
+
def start
|
23
|
+
[:configuration_path,
|
24
|
+
:interface_path,
|
25
|
+
:keymap_path].each do |path|
|
26
|
+
load(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
Vedeu::Launcher.execute!(argv)
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
# @!attribute [r] argv
|
35
|
+
# @return [Array<String>]
|
36
|
+
attr_reader :argv
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
def configuration_path
|
42
|
+
File.dirname(__FILE__) + '/config/**/*'
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [String]
|
46
|
+
def interface_path
|
47
|
+
File.dirname(__FILE__) + '/app/views/interfaces/**/*'
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [String]
|
51
|
+
def keymap_path
|
52
|
+
File.dirname(__FILE__) + '/app/models/keymaps/**/*'
|
53
|
+
end
|
54
|
+
|
55
|
+
# @param path [String]
|
56
|
+
# @return [String]
|
57
|
+
def load(path)
|
58
|
+
files = send(path)
|
59
|
+
|
60
|
+
Dir.glob(files).select do |file|
|
61
|
+
File.file?(file) && File.extname(file) == '.rb'
|
62
|
+
|
63
|
+
end.each do |file|
|
64
|
+
Kernel.load(file)
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
path
|
69
|
+
end
|
70
|
+
|
71
|
+
end # Bootstrap
|
72
|
+
|
73
|
+
end # Vedeu
|