canpe 0.1.0 → 0.1.1
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 +42 -12
- data/lib/canpe/command.rb +1 -1
- data/lib/canpe/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b96b2d2bc86f28daf42ffce335da985ccd8ccc7e
|
4
|
+
data.tar.gz: e7308a4c311d3f8512cc94b949aee40ec94535fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f593061a6900b33175de323468420d423b29ed01185e5849a9ffb0e9a80e929a9ab11cd95106b51ef7b5af61fdeae638ad848fc0fa60dc37277ff62ebb6b88e
|
7
|
+
data.tar.gz: 93274346664829444efe3e1192760a0e88daf8f5327480d41d11b0fc71a34d5024872bb6f6c1420e6cc654c8d1484e894e8f2928ceff2e06602aa0236df8aa54
|
data/README.md
CHANGED
@@ -12,8 +12,27 @@ When run the `canpe create sample_repository`, canpe initialize new repo in the
|
|
12
12
|
|
13
13
|
```
|
14
14
|
$ canpe create sample_repository
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
create directory: /Users/Yoshinori/.canpe_repos
|
17
|
+
create directory: /Users/Yoshinori/.canpe_repos/sample_repository
|
18
|
+
copy: /Users/Yoshinori/.canpe_repos/sample_repository/binding.yml
|
19
|
+
create directory: /Users/Yoshinori/.canpe_repos/sample_repository/templates
|
20
|
+
copy: /Users/Yoshinori/.canpe_repos/sample_repository/templates/sample.html.erb
|
21
|
+
```
|
22
|
+
|
23
|
+
Each repository has `templates` directory, and `binding.yml`.
|
24
|
+
|
25
|
+
```
|
26
|
+
$ tree .canpe_repos
|
27
|
+
|
28
|
+
.canpe_repos
|
29
|
+
`-- sample_repository
|
30
|
+
|-- binding.yml
|
31
|
+
`-- templates
|
32
|
+
`-- sample.html.erb
|
33
|
+
|
34
|
+
2 directories, 2 files
|
35
|
+
|
17
36
|
```
|
18
37
|
|
19
38
|
`binding.yml` defines the variables which you can access from templates.
|
@@ -28,21 +47,25 @@ variables:
|
|
28
47
|
|
29
48
|
Set your template files under the templates directory.
|
30
49
|
Each file is automatically evaluated as ERB template.
|
50
|
+
And you can access variables via `canpe` object.
|
31
51
|
|
32
52
|
```
|
53
|
+
$ cat .canpe_repos/sample_repository/templates/sample.html.erb
|
54
|
+
|
33
55
|
<%= canpe[:sample_string] %>
|
34
56
|
<%= canpe[:sample_array].join ', ' %>
|
35
57
|
```
|
36
58
|
|
37
|
-
|
59
|
+
To generate files from repository, you can use `canpe generate` command.
|
38
60
|
|
39
61
|
```
|
40
|
-
$
|
41
|
-
|
62
|
+
$ canpe generate sample_repository
|
63
|
+
|
64
|
+
working directory (/Users/Yoshinori) ?
|
42
65
|
you need to set variables to generate codes!
|
43
66
|
1: sample_string (string)
|
44
67
|
2: sample_array (array)
|
45
|
-
|
68
|
+
|
46
69
|
If you want to stop setting array, let it blank and press enter.
|
47
70
|
sample_string ?) Hello, world
|
48
71
|
sample_array[0] ?) 1
|
@@ -50,18 +73,25 @@ sample_array[1] ?) 2
|
|
50
73
|
sample_array[2] ?) 3
|
51
74
|
sample_array[3] ?)
|
52
75
|
finished variable settings: {"sample_string"=>"Hello, world", "sample_array"=>["1", "2", "3"]}
|
53
|
-
copy: /Users/Yoshinori/
|
54
|
-
|
76
|
+
copy: /Users/Yoshinori/sample.html.erb
|
77
|
+
|
78
|
+
$ cat sample.html.erb
|
79
|
+
Hello, world
|
80
|
+
1, 2, 3
|
55
81
|
```
|
56
82
|
|
57
|
-
|
58
|
-
This template is rendered like this.
|
83
|
+
You can list up registered repositories.
|
59
84
|
|
60
85
|
```
|
61
|
-
|
62
|
-
|
86
|
+
Yoshinori@ykosaka-MacBook-Pro:~$ canpe list
|
87
|
+
HOME::sample_repository
|
88
|
+
.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/canpe-0.1.0::default_repository
|
63
89
|
```
|
64
90
|
|
91
|
+
## Advanced Usage
|
92
|
+
|
93
|
+
File name is also evaluated as ERB.
|
94
|
+
look at `.canpe_repos/default_repository/<%= canpe[:repository_name] %>` in this repository.
|
65
95
|
|
66
96
|
## Development
|
67
97
|
|
data/lib/canpe/command.rb
CHANGED
data/lib/canpe/version.rb
CHANGED