Skip to content

Commit

Permalink
Merge branch 'release-0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
meisyal committed Oct 20, 2016
2 parents 70cb924 + 8a38fbf commit 206ee87
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 233 deletions.
23 changes: 11 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,36 @@
Contributions to staruml-ruby are very welcome. Please, have a look through the
guidelines in this file before submitting an issue or a pull request.

## Using issues
## Issues

Use the [issue tracker][issuetracker] for reporting bugs, requesting new features,
and discussing. If you want to submit an issue,
Use the [issue tracker][issuetracker] for reporting bugs, requesting new
features, and discussing. If you want to submit an issue,

* check the issue search first to prevent double submission of issues.
* search the issue first to prevent double submission of issues.
* the issue detail should be written clearly.

## Pull requests

Follow these guidelines below.

* use soft tabs set to 2 spaces.
* test your code first to make sure your code is working properly.
* commit message should contain what you changed (explain it clearly and capitalize
its first letter).
* choose `dev` branch as your target branch (don't choose `master` branch).
* use soft tabs that set to 2 spaces for the code.
* test your code first to make sure the code is working properly.
* commit message should contain what you changed.
* choose `dev` branch as your target branch.
* the pull request detail should be written for additional details.

## Useful Links

Here below are some useful links for developing StarUML extension.
Here below are some useful links for developing a StarUML extension.

* [StarUML main page][staruml]
* [StarUML developer's guide][starumldev]
* [StarUML API reference][starumlapi]

## License

By contributing your code, you agree to license your contribution under the terms
of the [MIT License][license].
By contributing your code, you agree to license your contribution under the
terms of the [MIT License][license].

[issuetracker]: https://github.com/meisyal/staruml-ruby/issues
[staruml]: http://staruml.io
Expand Down
153 changes: 44 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,146 +1,81 @@
# staruml-ruby

staruml-ruby is a Ruby extension for [StarUML][staruml] 2. This extension helps you
to generate Ruby code from a UML class diagram.

## Installation

There are several ways to install this extension. You can install manually, via
StarUML extension repository, or via URL. **I strongly recommend installing via
StarUML extension repository**.

### Manual

If you prefer to install manually. Please, follow these steps below.

1. Download the latest package of staruml-ruby [here][release].
2. Create a new folder `meisyal.starumlruby` in this location. Location depends on
your operating system.

* Linux: `~/.config/StarUML/extensions/user`
* Mac OS: `~/Library/Application Support/StarUML/extensions/user`
* Windows: `C:\Users\<user>\AppData\Roaming\StarUML\extensions\user`

3. Extract the package in the new extension folder.
4. Open or restart StarUML if you have already opened it.

Internet connection is needed before installing extension via StarUML extension
repository or URL.

### via StarUML extension repository

Open the StarUML extension manager (**Tools** -> **Extension Manager...**) and
install the Ruby extension. I recommend this installation method because it is
going to install the stable version of the extension. Beside that, the installed
extension is from StarUML extension repository (it means the extension is officially
registered).

### via URL

Follow these steps below.

1. Open the StarUML extension manager (**Tools** -> **Extension Manager...**).
2. Select **Install From URL...** button in the bottom left corner of the pop
window.
3. Enter the following URL `https://github.com/meisyal/staruml-ruby`.
4. Open or restart StarUML if you are already opening it.

At last, open the StarUML extension manager (**Tools** -> **Extension Manager...**)
and then click **Installed** tab to make sure this extension is successfully
installed.
staruml-ruby is a Ruby extension for [StarUML][staruml] 2. This extension helps
you to generate Ruby code from a UML class diagram.

## Current Status

This extension currently supports generating Ruby code from a UML class diagram.
Reverse engineering from Ruby code to a UML class diagram is not supported at
the moment.

### Supported UML Concepts

This tool supports StarUML model below.

**Classes**

* tool will generate a separated `.rb` file that contains a Ruby class.
* the generated file name will be `snake_case.rb` (file name refers to the name of
Ruby class).
* constructor is generated by default (`def initialize` method).
* a to string instance method is generated by default (`def to_s` method).
* code documentation will be generated at the top of class name.
Please, refer to [Supported UML concepts][umlconcept] page for futher details.

**Attributes of clasess**
* methods for set and get attributes are generated by default (it doesn't use
`attr_accessor :an_attribute`).
* methods for set and get attributes are grouped by theirs visibility. Same
condition is applied for attribute accessor.
* code documentation will be generated at the top of attribute accessor
declaration if it uses attribute accessor rather than set and get attributes.

**Methods of classes**

* tool will generate a grouped method based on its visibility (`public`,
`protected`, and `private` methods).
* the generated method name is same as your method name in the model.
* code documentation will be generated at the top of method name.

**Method Parameters**

tool will generate method parameters.
## Installation

**Generalization**
The simplest way to install staruml-ruby is from StarUML extension repository.
This installation method is explained as follows:

* tool will generate a separated `.rb` file that contains an inheritance class.
* the generated class name will be `class DerivedClass < BaseClass`.
* constructor and a to string instance method are generated by default.
1. Click **Tools** -> **Extension Manager...** on the menu bar of StarUML.
The Extension Manager window will appear as a pop-up window.
2. Select **Registry** button.
3. Type `ruby` on search box. Ruby extension will appear.
4. Press **Install** button of Ruby extension.

**Packages**
Note that internet connection is needed to perfom the installation.

* tool will convert to Ruby module (as a folder with name `packagename`
folder).
* the `packagename` folder contains classes that belong to the package.
* code documentation will be generated at the top of package name.
StarUML extension repository stores extensions that officially registered.
Because of it, I **highly recommend** to use this installation method.
Registered extensions are available on [this page][starumlextension].

**Constants**
See [Installation][installation] for other installation methods.

* tool will generate constants.
* the constants support public and private constants.
## Usage

## How to use this extension
When this extension is successfully installed, it's time to use the extension.
Prepare your model that contains a UML class diagram and then:

Please, follow these steps below.
1. Click **Tools** -> **Ruby** -> **Generate Code...** on the menu bar of
StarUML. A pop-up window will appear.
2. Choose a model that will be generated its code. And then, press **OK**
button.
3. Select a location where the generated code will be stored.
4. Press **Open** button.

1. Click the menu (**Tools** -> **Ruby** -> **Generate Code...**).
2. Select a model which will be generated its code in the pop window. And then,
click **OK**.
3. Select a location where the generated code will be saved.
4. The generated code will be saved in the place where you selected before.
Your Ruby code is generated. :yay:

## How to configure this extension
## Configuration

You can configure the extension before generating the code.
You can configure the extension before generating the code. The configuration
handles how the generated code looks like. Indentation of code and code comment,
for example. This is supported by this extension to generate Ruby code, as
you prefer.

1. Click the menu (**Tools** -> **Ruby** -> **Configure...**).
2. Manage the configuration for code generation (there are some options there). You
can always restore default configurations.
3. Click **Close** when you have configured it.
Check [Configuration][configuration] to configure the extension.

## Documentation

Documentation is available at [staruml-ruby GitHub Wiki][wiki]. Documentation
contains a lot more detail on examples, use and features, and roadmap.
contains a lot more detail on examples, features, and roadmap.

## Contributing

Before submitting an issue or a pull request, please take a moment to look over
the [contributing guidelines][contributing] first.
Contributions are welcome. Before submitting an issue or a pull request, please
take a moment to look over the [contributing guidelines][contributing] first.

## License

This extension is released under the terms of MIT License. See the [LICENSE][license]
file for more details.
This extension is released under the terms of MIT License. See the
[LICENSE][license] file for more details.

Copyright &copy; 2016 Andrias Meisyal.

[staruml]: http://staruml.io
[release]: https://github.com/meisyal/staruml-ruby/releases
[umlconcept]:
https://github.com/meisyal/staruml-ruby/wiki/Supported-UML-Concepts
[starumlextension]: http://staruml.io/extensions
[installation]: https://github.com/meisyal/staruml-ruby/wiki/Installation
[configuration]: https://github.com/meisyal/staruml-ruby/wiki/Configuration
[wiki]: https://github.com/meisyal/staruml-ruby/wiki
[contributing]:
https://github.com/meisyal/staruml-ruby/blob/master/CONTRIBUTING.md
Expand Down
6 changes: 6 additions & 0 deletions code-generator-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ define(function (require, exports, module) {
return className.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
};

CodeWriter.prototype.toCamelCase = function (className) {
return className.replace(/(\b|_)\w/g, function (match) {
return match.replace(/_/, '').toUpperCase();
});
};

exports.CodeWriter = CodeWriter;
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://github.com/meisyal/staruml-ruby",
"issues": "https://github.com/meisyal/staruml-ruby/issues",
"keywords": ["ruby"],
"version": "0.1.3",
"version": "0.1.4",
"author": {
"name": "Andrias Meisyal",
"email": "andriasonline@gmail.com",
Expand Down
Loading

0 comments on commit 206ee87

Please sign in to comment.