phoenix-cli 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d65ddf7dc3dc807134b5eeae970e75dbc3b90dec
4
- data.tar.gz: 36e163eab71888fe1d22cb7b31db7d00334dc913
3
+ metadata.gz: '0840d7c64fcb817e3a5f6479e04a5e1d87680ffa'
4
+ data.tar.gz: 1ac00180b66d10f318b117dc60b26089d0ecd0a8
5
5
  SHA512:
6
- metadata.gz: 549e30ca8c562600343235cfc5fa284757216b4f89f53154f9eb36d3ded86679e704879e04a01862f1995a3fff57662f14800f10e8c6cc9afbebccceb0a74370
7
- data.tar.gz: b93e98ea9bce1905fbdfbcb6a8372bdc8d0544b72213590f4ee5d0b11ab9c599971f879f740069287dba703b18835a7684d5642fc0621679c385e8f36d327e55
6
+ metadata.gz: 9ef3a859c4ffdde08adb36c1c8351e49745f7edd5db71e01dc769e50a93b083017a77db72c79e3aa1af45f6c5d7c1737b616dfe857574c5e48a7dfe1f17df508
7
+ data.tar.gz: 95af5b75db4814b17ce2a2c2c7789e1dd91e33a12b14890487301d0b2eeb7aa9936f9b9c570163adcac754b442897886de81e2ad8825e07f8b4ffeb89fd9a6df
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Phoenix-cli
2
2
  =================
3
+ [![Gem Version](https://badge.fury.io/rb/phoenix-cli.svg)](https://badge.fury.io/rb/phoenix-cli)
3
4
 
4
5
  Phoenix Pretty CLI
5
6
  Use Phoenix Framework with the same friendly rails interface
@@ -8,24 +9,45 @@ Use Phoenix Framework with the same friendly rails interface
8
9
 
9
10
  ## Setup
10
11
 
11
- 1. Install `gem install phoenix-cli`.
12
+ 1. Install via rubygems
12
13
 
13
- ## Commands List
14
+ ```bash
15
+ gem install phoenix-cli
16
+ ```
14
17
 
15
- | Command | Description |
16
- | --- | --- |
17
- | install | Install Phoenix Framework |
18
- | new APP_PATH | Create new Phoenix application |
19
- | deps | Install the Phoenix dependencies |
20
- | server | Start the web server |
21
- | console | Start Phoenix console |
22
- | routes | Show Phoenix routes |
23
- | version | Get current CLI version |
18
+ ## Command List
19
+
20
+ | Command | Description | Phoenix equivalent |
21
+ | --- | --- | --- |
22
+ | install | Install Phoenix Framework | -
23
+ | new APP_PATH | Create new Phoenix application | mix phoenix.new
24
+ | deps | Install the Phoenix dependencies | mix deps.get
25
+ | server | Start the web server | mix phoenix.server
26
+ | console | Start Phoenix console | iex -S mix
27
+ | routes | Show Phoenix routes | mix phoenix.routes
28
+ | version | Get current CLI version | -
24
29
 
25
30
 
26
31
  Run `phoenix` for more options
27
32
 
28
33
 
34
+ ## Generators List
35
+ 2. You can use generators with the following syntax
36
+
37
+ ```bash
38
+ phoenix generate GENERATOR_NAME
39
+ ```
40
+
41
+ | Command | Description | Phoenix equivalent |
42
+ | --- | --- | --- |
43
+ | scaffold | Generate Full set of model, view, database migration for that model, controller | mix phoenix.gen.html
44
+ | api | Generate Full model, view in json, database migration for that model, controller | mix phoenix.gen.json
45
+ | json | Alias for api command | mix phoenix.gen.json
46
+ | model | Generates an Ecto model in your Phoenix application. | mix phoenix.gen.model
47
+ | channel | Generates a Phoenix channel | mix phoenix.gen.channel
48
+ | presence | Generates a Presence tracker for your application | mix phoenix.gen.presence
49
+ | secret | Generates a secret and print it to the terminal | mix phoenix.gen.secret
50
+
29
51
  ## Development
30
52
 
31
53
  When hacking on this gem, the REPL `pry` comes in handy. You can load the
@@ -41,10 +41,28 @@ module PhoenixCli
41
41
  end
42
42
 
43
43
  desc "generate", "Run generators"
44
- def generate(generator, resource_name, *args)
45
- if generator == 'scaffold'
46
- commands = args.join(' ')
47
- exec("mix phoenix.gen.html #{resource_name.camelize} #{resource_name.pluralize} #{commands}")
44
+ def generate(*commands)
45
+ generator = commands[0]
46
+ resource = commands[1]
47
+ attributes = commands[2..(commands.length - 1)]
48
+
49
+ resource_camelized = resource.camelize
50
+ resource_pluralized = resource.pluralize
51
+
52
+ if ['scaffold', 'html', 'resource'].include? generator
53
+ exec("mix phoenix.gen.html #{resource_camelized} #{resource_pluralized} #{attributes.join(' ')}")
54
+ end
55
+
56
+ if ['json', 'api'].include? generator
57
+ exec("mix phoenix.json #{resource_camelized} #{resource_pluralized} #{attributes.join(' ')}")
58
+ end
59
+
60
+ if ['channel', 'presence', 'secret', 'digest'].include? generator
61
+ exec("mix phoenix.gen.#{generator} #{attributes.join(' ')}")
62
+ end
63
+
64
+ if ['model'].include? generator
65
+ exec("mix phoenix.gen.#{generator} #{resource_camelized} #{resource_pluralized} #{attributes.join(' ')}")
48
66
  end
49
67
  end
50
68
 
@@ -58,4 +76,8 @@ module PhoenixCli
58
76
  puts PhoenixCli::VERSION
59
77
  end
60
78
  end
79
+
80
+ class Generate < Thor
81
+
82
+ end
61
83
  end
@@ -1,3 +1,3 @@
1
1
  module PhoenixCli
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoenix-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dayvson Lima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor