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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42df0666b0fe511c259d52c15ad0e9043997d8dd
4
- data.tar.gz: 667b2704058d7c64a50e891eed25e3f8345ec90e
3
+ metadata.gz: 36908b5cf1c64607ada48c0496e8acd59492fdb3
4
+ data.tar.gz: 00020da07dbb52122e70b1881d008fd0a16cae80
5
5
  SHA512:
6
- metadata.gz: c8f488c8d73d6c219e7eb162638137a4e8e050f6e5fd257f00ce9f48265d1c3ebd239c85b43aff4e76d45b17af1d8f60b25a703edf86911664c21434d09c0263
7
- data.tar.gz: c1745ef8cdea41fa44867884d7b667345734e7fd228ca9c14d9b2f2d50df0122c7c49f4e5a08c2a43a1ae7ed83da5eb10acb0d52914e5991d1eac87041e92b64
6
+ metadata.gz: 0c45b5ab72f90fdb39d9b36d6fa77fe7aba9997749cfad782c97e77e402ef00ec7aa53292f649c2ec9885312dc229b3f2ba6813eed4198fea872470641381219
7
+ data.tar.gz: 4a1dca49d1b2dc06b39c652122c7f7b331d25d5f3c8ebff0a785b6efda781fe378047f37e530971702bcb54ff690339e4d30ac8448e27ea517639b06a898888f
data/README.md CHANGED
@@ -1,31 +1,75 @@
1
- # Rails::New::Gem
1
+ # Rails New
2
2
 
3
- TODO: Write a gem description
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
- ## Installation
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
- ```ruby
10
- gem 'rails-new-gem'
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
- And then execute:
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
- $ bundle
54
+ ## Installation
16
55
 
17
- Or install it yourself as:
56
+ Install running:
18
57
 
19
58
  $ gem install rails-new-gem
20
59
 
21
60
  ## Usage
22
61
 
23
- TODO: Write usage instructions here
62
+ Run `rails-new --help` for instructions.
63
+
64
+ ## Contributing with Templates while private
24
65
 
25
- ## Contributing
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
- 1. Fork it ( https://github.com/[my-github-username]/rails-new-gem/fork )
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
@@ -1,7 +1,7 @@
1
1
  module Rails
2
2
  module New
3
3
  module Gem
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-new
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag