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 +4 -4
- data/README.md +33 -11
- data/lib/phoenix-cli/cli.rb +26 -4
- data/lib/phoenix-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0840d7c64fcb817e3a5f6479e04a5e1d87680ffa'
|
|
4
|
+
data.tar.gz: 1ac00180b66d10f318b117dc60b26089d0ecd0a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ef3a859c4ffdde08adb36c1c8351e49745f7edd5db71e01dc769e50a93b083017a77db72c79e3aa1af45f6c5d7c1737b616dfe857574c5e48a7dfe1f17df508
|
|
7
|
+
data.tar.gz: 95af5b75db4814b17ce2a2c2c7789e1dd91e33a12b14890487301d0b2eeb7aa9936f9b9c570163adcac754b442897886de81e2ad8825e07f8b4ffeb89fd9a6df
|
data/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Phoenix-cli
|
|
2
2
|
=================
|
|
3
|
+
[](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
|
|
12
|
+
1. Install via rubygems
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
```bash
|
|
15
|
+
gem install phoenix-cli
|
|
16
|
+
```
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
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
|
data/lib/phoenix-cli/cli.rb
CHANGED
|
@@ -41,10 +41,28 @@ module PhoenixCli
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
desc "generate", "Run generators"
|
|
44
|
-
def generate(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
data/lib/phoenix-cli/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|