rails-new 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +57 -13
- data/bin/rails-new +2 -1
- data/lib/rails/new/gem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36908b5cf1c64607ada48c0496e8acd59492fdb3
|
4
|
+
data.tar.gz: 00020da07dbb52122e70b1881d008fd0a16cae80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c45b5ab72f90fdb39d9b36d6fa77fe7aba9997749cfad782c97e77e402ef00ec7aa53292f649c2ec9885312dc229b3f2ba6813eed4198fea872470641381219
|
7
|
+
data.tar.gz: 4a1dca49d1b2dc06b39c652122c7f7b331d25d5f3c8ebff0a785b6efda781fe378047f37e530971702bcb54ff690339e4d30ac8448e27ea517639b06a898888f
|
data/README.md
CHANGED
@@ -1,31 +1,75 @@
|
|
1
|
-
# Rails
|
1
|
+
# Rails New
|
2
2
|
|
3
|
-
|
3
|
+
This is a wrapper over `rails new` attached to a privately managed repository of templates on `http://rails-new.herokuapp.com/admin`. We don't store the templates itself but a reference to his repository location (only GIT supported right now). The main objective of this repository is to be to able to put in a single place how the template should be using.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
5
|
+
For example, this url: <http://rails-new.herokuapp.com/api/v1/templates/julio/base.json> returns:
|
8
6
|
|
9
|
-
```
|
10
|
-
|
7
|
+
```json
|
8
|
+
{
|
9
|
+
"template": {
|
10
|
+
"id": 1,
|
11
|
+
"name": "base",
|
12
|
+
"git_repository": "https://github.com/juliogarciag/rails-template.git",
|
13
|
+
"main_file_location": "template.rb",
|
14
|
+
"arguments": [
|
15
|
+
{
|
16
|
+
"id": 1,
|
17
|
+
"key": "--skip-test-unit",
|
18
|
+
"has_value": false,
|
19
|
+
"value": ""
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"id": 2,
|
23
|
+
"key": "--skip-turbolinks",
|
24
|
+
"has_value": false,
|
25
|
+
"value": ""
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"id": 3,
|
29
|
+
"key": "--skip-bundle",
|
30
|
+
"has_value": false,
|
31
|
+
"value": ""
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"id": 4,
|
35
|
+
"key": "--skip-spring",
|
36
|
+
"has_value": false,
|
37
|
+
"value": ""
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
}
|
11
42
|
```
|
12
43
|
|
13
|
-
|
44
|
+
This json represents the arguments needed for this template, the repository where this is stored and the location of the template file inside of the the repository.
|
45
|
+
|
46
|
+
The fact that is privately managed is just temporal. To make it public, we should need to improve the UI and improve the security to completely remove the chance of shell execution through the pass of parameters or some other arguments. Because we are not totally sure yet of the security of that system, the system is kept privately.
|
47
|
+
|
48
|
+
The main point of this gem is to allow to use that template in this way:
|
49
|
+
|
50
|
+
```bash
|
51
|
+
rails-new julio/base my-new-project
|
52
|
+
```
|
14
53
|
|
15
|
-
|
54
|
+
## Installation
|
16
55
|
|
17
|
-
|
56
|
+
Install running:
|
18
57
|
|
19
58
|
$ gem install rails-new-gem
|
20
59
|
|
21
60
|
## Usage
|
22
61
|
|
23
|
-
|
62
|
+
Run `rails-new --help` for instructions.
|
63
|
+
|
64
|
+
## Contributing with Templates while private
|
24
65
|
|
25
|
-
|
66
|
+
Create an issue with the git repository of the template, the location inside it, the name of the user you want to keep the repository within, the name of the template and the arguments you expect the template to be called with. This is just temporal until we figure out how to make it more user-friendly and secure at the same time.
|
26
67
|
|
27
|
-
|
68
|
+
## Contributing with Code
|
69
|
+
|
70
|
+
1. Fork it ( https://github.com/juliogarciag/rails-new-gem/fork )
|
28
71
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
72
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
73
|
4. Push to the branch (`git push origin my-new-feature`)
|
31
74
|
5. Create a new Pull Request
|
75
|
+
|
data/bin/rails-new
CHANGED
@@ -37,6 +37,7 @@ class RailsNewWrapper < Thor::Group
|
|
37
37
|
def parse_template_data
|
38
38
|
@template_data = JSON.parse(@response.body)['template']
|
39
39
|
@git_repository = @template_data['git_repository']
|
40
|
+
@git_branch = @template_data['git_branch']
|
40
41
|
@main_file_location = @template_data["main_file_location"]
|
41
42
|
@arguments = build_arguments_array(@template_data['arguments'])
|
42
43
|
end
|
@@ -47,7 +48,7 @@ class RailsNewWrapper < Thor::Group
|
|
47
48
|
|
48
49
|
say "Cloning git repository ", :green, false
|
49
50
|
say @git_repository, :blue
|
50
|
-
Kernel.system "git clone #{@git_repository} #{temp_dir}"
|
51
|
+
Kernel.system "git clone -b #{@git_branch} #{@git_repository} #{temp_dir}"
|
51
52
|
|
52
53
|
command = [
|
53
54
|
"rails", "new", @app_name, "-m", template_location, *@arguments, *extra_rails_arguments
|