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 CHANGED
@@ -2,22 +2,20 @@
2
2
 
3
3
  TODO: Write a gem description
4
4
 
5
- ## Installation
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
- $ bundle
7
+ ## Installation
14
8
 
15
- Or install it yourself as:
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
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- @command = ARGV[0]
4
- @argument = ARGV[1]
3
+ @input = ARGV
5
4
 
6
5
 
7
6
  require_relative "../lib/sinatra-cl"
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Cl
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
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(command, argument=nil)
8
- if command == "new"
9
- argument = "sinatra-app" if argument.nil?
10
- `git clone git@github.com:ashleygwilliams/ratpack.git #{argument}`
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(@command,@argument)
32
+ Sinatra::Cl::Generate.new(@input).build_app
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-cl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: