sinatra-cl 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -9
- data/bin/sinatra-cl +1 -2
- data/lib/sinatra-cl/version.rb +1 -1
- data/lib/sinatra-cl.rb +20 -6
- metadata +1 -1
data/README.md
CHANGED
@@ -2,22 +2,20 @@
|
|
2
2
|
|
3
3
|
TODO: Write a gem description
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'sinatra-cl'
|
10
|
-
|
11
|
-
And then execute:
|
5
|
+
This is a sinatra app generator based on [Ashley William's](http://heyashleyashley.com/) [Ratpack](https://github.com/ashleygwilliams/ratpack)
|
12
6
|
|
13
|
-
|
7
|
+
## Installation
|
14
8
|
|
15
|
-
|
9
|
+
Install it:
|
16
10
|
|
17
11
|
$ gem install sinatra-cl
|
18
12
|
|
19
13
|
## Usage
|
20
14
|
|
15
|
+
Generate a Sinatra App:
|
16
|
+
|
17
|
+
$ sinatra-cl new app
|
18
|
+
|
21
19
|
TODO: Write usage instructions here
|
22
20
|
|
23
21
|
## Contributing
|
data/bin/sinatra-cl
CHANGED
data/lib/sinatra-cl/version.rb
CHANGED
data/lib/sinatra-cl.rb
CHANGED
@@ -3,16 +3,30 @@ require_relative "sinatra-cl/version"
|
|
3
3
|
module Sinatra
|
4
4
|
module Cl
|
5
5
|
class Generate
|
6
|
+
attr_reader :command, :argument
|
6
7
|
|
7
|
-
def initialize(
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def initialize(user_input)
|
9
|
+
@command, @argument = user_input
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute_new(argument)
|
13
|
+
argument = "sinatra-app" if argument.nil?
|
14
|
+
`git clone git@github.com:ashleygwilliams/ratpack.git #{argument}`
|
15
|
+
end
|
16
|
+
|
17
|
+
def build_app
|
18
|
+
case command
|
19
|
+
when "new"
|
20
|
+
execute_new(argument)
|
21
|
+
when "help"
|
22
|
+
"Usage:\nnew: sinatra-cl new [APPNAME]"
|
23
|
+
else
|
24
|
+
"#{command} is not a valid command.\nType 'sinatra-cl help' for more information"
|
11
25
|
end
|
12
26
|
end
|
27
|
+
|
13
28
|
end
|
14
|
-
# Your code goes here...
|
15
29
|
end
|
16
30
|
end
|
17
31
|
|
18
|
-
Sinatra::Cl::Generate.new(@
|
32
|
+
Sinatra::Cl::Generate.new(@input).build_app
|