Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nucc committed Feb 2, 2014
1 parent 5e86d90 commit dc4c493
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 133 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@

## Description

You can find more info about this project [here](http://my.luc.ie/).
Lucie is a terminal application development framework written in Ruby. The aim of the framework is to make the terminal application development faster and easier with providing generators, plugins, components. With specifying a common framework, easier to share workflow management solutions among companies worldwide or creating application that doesn't require graphical user interface.

### MVC

Lucie based on Model, View, Contoller (MVC) design pattern. Using this principle data can be totally separated from business logic and from its representation. Models represent object that need to be permanent, controllers implement business logic and views help in representing models using templates to generate files or output.

When a Lucie based application is executed, first it dispatches the request and finds the appropriate controller using the first command line attribute. If a second attribute is also defined, it calls the action on the controller with the same name as the attribute, otherwise it calls the index method. Each other attribute is stored in a <code>params</code> instance variable. Mandatory and optional parameters can be defined in controller if some additional information are required by the action.

Controller implements the business logic, using models and templates for data source and representation. Model uses database to store and fetch data.

### Directory structure

<table>
<tr><td><code>/app/controllers</code></td><td> Controllers for business logic </td></tr>
<tr><td><code>/app/models</code></td><td>Models which store permanent information</td></tr>
<tr><td><code>/app/templates</code></td><td>Template files for file generation</td></tr>
<tr><td><code>/config</code></td><td>Configuration files</td></tr>
<tr><td><code>/lib</code></td><td>Libraries for shared resource</td></tr>
<tr><td><code>/bin</code></td><td>Executable file of the application</td></tr>
</table>

The project is under development. More information is coming soon.

## Code status

Expand Down
19 changes: 17 additions & 2 deletions guides/public/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,33 @@ <h1>Introduction</h1>
<li>
<a href="#toc_0">MVC</a>
</li>
<li>
<a href="#toc_1">Directory structure</a>
</li>
</ul>

<p>Lucie is a terminal application development framework written in Ruby. The aim of the framework is to make the terminal application development faster and easier with providing generators, plugins, components like Rails does for web developers.</p>
<p>Lucie is a terminal application development framework written in Ruby. The aim of the framework is to make the terminal application development faster and easier with providing generators, plugins, components. With specifying a common framework, easier to share workflow management solutions among companies worldwide or creating application that doesn&#39;t require graphical user interface.</p>

<h3 id="toc_0">MVC</h3>

<p>Lucie based on Model, View, Contoller (MVC) design pattern, where model represents permanent data, controller implements the business logic and view helps in using templates to generate files or output.</p>
<p>Lucie based on Model, View, Contoller (MVC) design pattern. Using this principle data can be totally separated from business logic and from its representation. Models represent object that need to be permanent, controllers implement business logic and views help in representing models using templates to generate files or output.</p>

<p>When a Lucie based application is executed, first it dispatches the request and finds the appropriate controller using the first command line attribute. If a second attribute is also defined, it calls the action on the controller with the same name as the attribute, otherwise it calls the index method. Each other attribute is stored in a <code>params</code> instance variable. Mandatory and optional parameters can be defined in controller if some additional information are required by the action.</p>

<p>Controller implements the business logic, using models and templates for data source and representation. Model uses database to store and fetch data.</p>

<h3 id="toc_1">Directory structure</h3>

<table>
<tr><td><code>/app/controllers</code></td><td> Controllers for business logic </td></tr>
<tr><td><code>/app/models</code></td><td>Models which store permanent information</td></tr>
</table>

<p><code>/app/models:</code> Models which store permanent information<br>
<code>/app/views: Template files</code><br>
<code>/config: Configuration files</code><br>
<code>/lib: Libraries for shared resources</code></p>

</div>
</div>
</body>
Expand Down
15 changes: 13 additions & 2 deletions guides/tutorials/10_introduction.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
Lucie is a terminal application development framework written in Ruby. The aim of the framework is to make the terminal application development faster and easier with providing generators, plugins, components like Rails does for web developers.
Lucie is a terminal application development framework written in Ruby. The aim of the framework is to make the terminal application development faster and easier with providing generators, plugins, components. With specifying a common framework, easier to share workflow management solutions among companies worldwide or creating application that doesn't require graphical user interface.

### MVC

Lucie based on Model, View, Contoller (MVC) design pattern, where model represents permanent data, controller implements the business logic and view helps in using templates to generate files or output.
Lucie based on Model, View, Contoller (MVC) design pattern. Using this principle data can be totally separated from business logic and from its representation. Models represent object that need to be permanent, controllers implement business logic and views help in representing models using templates to generate files or output.

When a Lucie based application is executed, first it dispatches the request and finds the appropriate controller using the first command line attribute. If a second attribute is also defined, it calls the action on the controller with the same name as the attribute, otherwise it calls the index method. Each other attribute is stored in a <code>params</code> instance variable. Mandatory and optional parameters can be defined in controller if some additional information are required by the action.

Controller implements the business logic, using models and templates for data source and representation. Model uses database to store and fetch data.

### Directory structure

<table>
<tr><td><code>/app/controllers</code></td><td> Controllers for business logic </td></tr>
<tr><td><code>/app/models</code></td><td>Models which store permanent information</td></tr>
</table>

`/app/models:` Models which store permanent information
`/app/views: Template files`
`/config: Configuration files`
`/lib: Libraries for shared resources`
11 changes: 11 additions & 0 deletions lucie-cmd/lib/lucie-cmd/commands.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
require 'open3'

module Lucie

# Lucie provides library to work with command line applications in an
# easy way.
#
# In order to use these methods in your controller class you need to include
# it to the class.
#
# class SampleController < Lucie::Controller::Base
# include Lucie::Commands
# end
#
module Commands

protected
Expand Down
8 changes: 8 additions & 0 deletions lucie-lib/lib/lucie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
require "lucie/version"
require "lucie/exceptions"


# Lucie is a modular MVC terminal application framework. With Lucie easy to create
# command line application using controllers to describe the process, models to store
# additional data permanently, and views to generate configuration files for applications.
#
# Lucie-lib is a glue for these MVC components and provide additional helper methods to
# support faster and easier developing.
#
module Lucie

module Controller
Expand Down
52 changes: 48 additions & 4 deletions lucie-lib/lib/lucie/app.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,75 @@


module Lucie
# App responsible for configuring and launch the application
# based on Lucie application framework.

#
# Lucie::App represents the application context. When a lucie application starts,
# it requires information about its environment, like root path, env, command. App
# also responsible for loading the right controller and to execute the process how the
# input will be parsed and the business logic is executed.
#
class App

class << self
#
# Let the exception leave the application when any occur.
#
# Normally the application doesn't raise any exception, just stops quietly.
# When the application is under debugging, developer needs more, detailed description
# about the problem. Suggested to turn this attribute on during developing.
#
# App.raise_exception = true
#
attr_accessor :raise_exception

# Sets the log level of the application.
#
attr_accessor :log_level

#
# Root directory of the source of application.
#
# Template and other source paths are calculated relatively to this directory.
#
attr_accessor :root

@raise_exception = false
@log_level = :info
end

# Command line input that is being executed. Usually it equals with ARGV.
#
attr_reader :command

# Root of the application. Same as App.root, it's a reference for that.
#
attr_reader :root

# The directory where from the application has been executed.
#
attr_reader :pwd

# Initializes and starts the applicaiton. Shortcut for self.init && self.start
#
def self.run(command = ARGV, root = nil, pwd = nil)
root ||= File.expand_path("..", File.dirname(Kernel.caller[0]))
instance = self.init(command, root, pwd)
self.start(instance)
end

# Initializes the application.
#
# @param command [Array or String]
# @param root [String] Path of the root of the app. [default: current application's path]
# @param pwd [String] Path of the terminal position.
#
def self.init(command = ARGV, root = nil, pwd = nil)
root ||= File.expand_path("..", File.dirname(Kernel.caller[0]))
self.new(command, root, pwd)
end

# Starts the application instance and returns its exit status.
#
# @param instance [App] Application instance
#
def self.start(instance)
instance.start
instance.exit_value
Expand All @@ -43,14 +84,17 @@ def initialize(command, root, pwd = nil)
Dir.chdir(@pwd)
end

# Starts the application.
def start
help? ? call_help : call_method_invoking_process
end

# Exit status of the application
def exit_value
@exit_value
end

# Environment of the application. Contains the ENV of the terminal.
def env
ENV
end
Expand Down
Loading

0 comments on commit dc4c493

Please sign in to comment.