codestrap 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +4 -0
- data/.yardopts +3 -0
- data/BOILERPLATE.md +151 -0
- data/CODESTRAPFILE.md +28 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +13 -0
- data/README.md +69 -0
- data/Rakefile +51 -0
- data/bin/strap +8 -0
- data/bin/upstrap +8 -0
- data/codestrap.gemspec +37 -0
- data/config/projects/codestrap.rb +22 -0
- data/config/software/codestrap.rb +20 -0
- data/config/software/ruby.rb +247 -0
- data/config/software/zlib.rb +86 -0
- data/features/client.feature +99 -0
- data/features/fixtures/client/home/codestrap/bin/.empty +0 -0
- data/features/fixtures/client/home/codestrap/content/bash.erb +3 -0
- data/features/fixtures/client/home/codestrap/content/gem/dir/file +0 -0
- data/features/fixtures/client/home/codestrap/content/gem/dir/template +3 -0
- data/features/fixtures/client/home/codestrap/content/gem/file +1 -0
- data/features/fixtures/client/home/codestrap/content/gem/template +3 -0
- data/features/fixtures/client/home/codestrap/content/local_remote.erb +1 -0
- data/features/fixtures/client/home/codestrap/content/local_remote/dir/file +0 -0
- data/features/fixtures/client/home/codestrap/content/local_remote/dir/template +3 -0
- data/features/fixtures/client/home/codestrap/content/local_remote/file +1 -0
- data/features/fixtures/client/home/codestrap/content/local_remote/template +3 -0
- data/features/fixtures/client/home/codestrap/objects/local.json +3 -0
- data/features/fixtures/client/output/.empty +0 -0
- data/features/fixtures/client/var/lib/codestrap/bin/.empty +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/bashremote.erb +3 -0
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/template +3 -0
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/gemremote/template +3 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_local.erb +1 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/template +3 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/file +1 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_local/template +3 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote.erb +1 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/template +3 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/file +0 -0
- data/features/fixtures/client/var/lib/codestrap/content/remote_remote/template +3 -0
- data/features/fixtures/client/var/lib/codestrap/objects/remote.json +3 -0
- data/features/fixtures/logging/home/logging/codestrap/bin/stubdirectory/.empty +0 -0
- data/features/fixtures/logging/home/logging/codestrap/bin/stubnotlink +0 -0
- data/features/fixtures/logging/home/logging/codestrap/content/.empty +0 -0
- data/features/fixtures/logging/home/logging/codestrap/objects/.empty +0 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/address.erb +3 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/cell.erb +3 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/email.erb +3 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/mobile.erb +3 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/name.erb +3 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/phone.erb +3 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/Modulefile +12 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/README +17 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/manifests/init.pp +42 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/spec/spec_helper.rb +18 -0
- data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/tests/init.pp +13 -0
- data/features/fixtures/server/mixed/var/lib/stub/objects/contact.json +8 -0
- data/features/fixtures/server/mixed/var/lib/stub/objects/shadow/contact.json +8 -0
- data/features/fixtures/strap/projects/etc/.empty +0 -0
- data/features/fixtures/strap/projects/home/user/dir/bin/.empty +0 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/Modulefile +12 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/README +17 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/:stub:project.name:/subclass.pp +3 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/init.pp +42 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/spec/spec_helper.rb +18 -0
- data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/tests/init.pp +13 -0
- data/features/fixtures/strap/projects/home/user/dir/objects/contact.json +8 -0
- data/features/fixtures/strap/projects/home/user/dir/objects/shadow/contact.json +8 -0
- data/features/fixtures/strap/projects/output/.empty +0 -0
- data/features/fixtures/stub/contact/etc/.empty +0 -0
- data/features/fixtures/stub/contact/home/user/dir/bin/.empty +0 -0
- data/features/fixtures/stub/contact/home/user/dir/content/address.erb +3 -0
- data/features/fixtures/stub/contact/home/user/dir/content/cell.erb +3 -0
- data/features/fixtures/stub/contact/home/user/dir/content/email.erb +3 -0
- data/features/fixtures/stub/contact/home/user/dir/content/mobile.erb +3 -0
- data/features/fixtures/stub/contact/home/user/dir/content/name.erb +3 -0
- data/features/fixtures/stub/contact/home/user/dir/content/phone.erb +3 -0
- data/features/fixtures/stub/contact/home/user/dir/objects/contact.json +8 -0
- data/features/fixtures/stub/contact/home/user/dir/objects/shadow/contact.json +8 -0
- data/features/fixtures/stub/contact/output/.empty +0 -0
- data/features/fixtures/stub/date/etc/.empty +0 -0
- data/features/fixtures/stub/date/home/user/stub/bin/.empty +0 -0
- data/features/fixtures/stub/date/home/user/stub/content/day.erb +3 -0
- data/features/fixtures/stub/date/home/user/stub/content/hour.erb +3 -0
- data/features/fixtures/stub/date/home/user/stub/content/minute.erb +3 -0
- data/features/fixtures/stub/date/home/user/stub/content/month.erb +3 -0
- data/features/fixtures/stub/date/home/user/stub/content/second.erb +3 -0
- data/features/fixtures/stub/date/home/user/stub/content/year.erb +3 -0
- data/features/fixtures/stub/date/home/user/stub/objects/.empty +0 -0
- data/features/fixtures/stub/date/output/.empty +0 -0
- data/features/fixtures/stub/script/etc/.empty +0 -0
- data/features/fixtures/stub/script/home/user/stub/bin/.empty +0 -0
- data/features/fixtures/stub/script/home/user/stub/content/credentials.erb +6 -0
- data/features/fixtures/stub/script/home/user/stub/objects/credentials.rb +11 -0
- data/features/fixtures/stub/script/output/.empty +0 -0
- data/features/logging.feature +39 -0
- data/features/object_scripts.feature +13 -0
- data/features/server.feature +36 -0
- data/features/step_definitions/client_steps.rb +99 -0
- data/features/step_definitions/logging_steps.rb +65 -0
- data/features/step_definitions/object_scripts_steps.rb +26 -0
- data/features/step_definitions/server_steps.rb +112 -0
- data/features/step_definitions/strap_steps.rb +69 -0
- data/features/step_definitions/stub_option_simple_steps.rb +31 -0
- data/features/step_definitions/stub_steps.rb +94 -0
- data/features/strap.feature +34 -0
- data/features/stub.feature +157 -0
- data/features/stub_option_simple.feature +14 -0
- data/features/stub_packages.feature +15 -0
- data/features/support/env.rb +197 -0
- data/lib/codestrap.rb +415 -0
- data/lib/codestrap/cli.rb +76 -0
- data/lib/codestrap/client.rb +179 -0
- data/lib/codestrap/config.rb +199 -0
- data/lib/codestrap/log.rb +56 -0
- data/lib/codestrap/mixin.rb +20 -0
- data/lib/codestrap/namespace.rb +19 -0
- data/lib/codestrap/object/abstract.rb +33 -0
- data/lib/codestrap/object/factory.rb +86 -0
- data/lib/codestrap/object/standard/datetime.rb +24 -0
- data/lib/codestrap/object/standard/files.rb +40 -0
- data/lib/codestrap/object/standard/project.rb +33 -0
- data/lib/codestrap/object/standard/rest.rb +30 -0
- data/lib/codestrap/patch.rb +122 -0
- data/lib/codestrap/server/rest.rb +177 -0
- data/lib/codestrap/server/version.rb +5 -0
- data/lib/codestrap/strap/abstract.rb +135 -0
- data/lib/codestrap/strap/factory.rb +85 -0
- data/lib/codestrap/strap/standard.rb +95 -0
- data/lib/codestrap/stub/abstract.rb +156 -0
- data/lib/codestrap/stub/factory.rb +87 -0
- data/lib/codestrap/stub/standard.rb +23 -0
- data/lib/codestrap/version.rb +3 -0
- data/omnibus.rb +53 -0
- data/package-scripts/codestrap/postinst +25 -0
- data/package-scripts/codestrap/postrm +17 -0
- data/package-scripts/codestrap/preinst +7 -0
- data/package-scripts/codestrap/prerm +15 -0
- data/resources/codestrap/pkg/background.png +0 -0
- data/resources/codestrap/pkg/distribution.xml.erb +22 -0
- data/resources/codestrap/pkg/license.html.erb +202 -0
- data/resources/codestrap/pkg/welcome.html.erb +7 -0
- metadata +466 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5ade3b755f5973545b219689e0842be8ed6ca922
|
4
|
+
data.tar.gz: 5249299dab56defeba0fa2c075321033986d8bf5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: caf4f4aeeef6684135046cdaa417036de74832cd476ebb849a6066dc77c074fa37683ed3e01a59ce3a4c966ddde93729f944b18914b65aaccb45c696ebc2066c
|
7
|
+
data.tar.gz: b6ca59e18da972da5a30795b7f7d9afd147c6eb7cdc5cec3775f515dffe225f2ba8c571e06c9c974032ca2f9f71b2287f983038db31c8d6f2b72a32dbf64be55
|
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.idea/
|
3
|
+
/.yardoc
|
4
|
+
/Gemfile.lock
|
5
|
+
/_yardoc/
|
6
|
+
/coverage/
|
7
|
+
/doc/
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/tmp/
|
11
|
+
Vagrantfile
|
12
|
+
.ruby-gemset
|
13
|
+
.ruby-version
|
14
|
+
/.vagrant/
|
15
|
+
atlassian-ide-plugin.xml
|
16
|
+
*.bundle
|
17
|
+
*.so
|
18
|
+
*.o
|
19
|
+
*.a
|
20
|
+
mkmf.log
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/BOILERPLATE.md
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
# Template Setup
|
2
|
+
|
3
|
+
## 1. Content directory
|
4
|
+
```
|
5
|
+
$HOME/.codestrap/content
|
6
|
+
```
|
7
|
+
|
8
|
+
The content directory contains all file and project templates.
|
9
|
+
|
10
|
+
### Individual text file templates
|
11
|
+
|
12
|
+
Individual text templates as files ending in .erb (EG script.erb). These are Embedded Ruby files. Objects in these files are generated from files contained in the *objects/* directory.
|
13
|
+
|
14
|
+
* Each file ending in .erb has a one to one relationship with a generated command.
|
15
|
+
* Generated commands for individual text files begin with *stub* and end with the same name as the file under *content* minus the .erb postfix.
|
16
|
+
|
17
|
+
### Project templates
|
18
|
+
|
19
|
+
Sub directories form project templates (EG content/puppetmodule).
|
20
|
+
|
21
|
+
* Each sub-directory has a one to one relationship with a generated command.
|
22
|
+
* Generated commands for projects begin with *strap* and end with the same name as the sub-directory.
|
23
|
+
|
24
|
+
#### ERB templates and project context
|
25
|
+
|
26
|
+
ERB Files in a project template do not end in ".erb". Instead the files have a *modeline* entry "strap:erb" or "stub:erb" (within the first 10 lines), to indicate an ERB template.
|
27
|
+
```erb
|
28
|
+
#!/bin/sh
|
29
|
+
# strap:erb
|
30
|
+
# Author: <%= author.name %>
|
31
|
+
# Email: <%= author.email %>
|
32
|
+
```
|
33
|
+
|
34
|
+
Note: Modelines are removed from the generated boilerplate
|
35
|
+
|
36
|
+
#### Directory text interpolation
|
37
|
+
|
38
|
+
Directory names can contain variables/objects which are interpolated with the idiom ":strap:object.text:" or ":stub:object.text:"
|
39
|
+
```
|
40
|
+
content/PROJECT/:strap:project.name:/myfile.txt
|
41
|
+
content/PROJECT/:stub:project.name:/myfile.txt
|
42
|
+
```
|
43
|
+
|
44
|
+
## 2. Generated commands directory
|
45
|
+
```
|
46
|
+
$HOME/.codestrap/bin
|
47
|
+
```
|
48
|
+
|
49
|
+
Contains generated commands (symlinks). Generated commands have a one to one relationship with a content directory file/sub-directory.
|
50
|
+
|
51
|
+
* Generated commands corresponding to text file templates begin with *stub* followed by *textfile* (minus the .erb) in the content directory.
|
52
|
+
* Generated commands corresponding to project templates begin with *strap* followed by *dir* in the content directory.
|
53
|
+
|
54
|
+
## 3. Variable/Object definition files directory
|
55
|
+
```
|
56
|
+
$HOME/.codestrap/objects
|
57
|
+
```
|
58
|
+
|
59
|
+
Contains *.json, *.yaml or executable files which output JSON. Objects are available in YAML format.
|
60
|
+
|
61
|
+
### YAML Objects
|
62
|
+
|
63
|
+
A file named *"company.yaml"* with content
|
64
|
+
```yaml
|
65
|
+
name: ACME Corp.
|
66
|
+
email: email@address.com
|
67
|
+
url: "http://www.company.com"
|
68
|
+
```
|
69
|
+
|
70
|
+
Creates an object "company" with interfaces "company.name", "company.email" and "company.url". Each interface corresponds to the relevant *"company.yaml"* file entry.
|
71
|
+
|
72
|
+
The "company" object is then available to all template files.
|
73
|
+
|
74
|
+
*Example ERB*
|
75
|
+
```erb
|
76
|
+
#!/bin/sh
|
77
|
+
|
78
|
+
mail -s "Order product" <%= company.email %> <<EOF
|
79
|
+
Hello <%= company.name %>,
|
80
|
+
|
81
|
+
I just ordered more product from <%= company.url %>.
|
82
|
+
EOF
|
83
|
+
```
|
84
|
+
|
85
|
+
### JSON Objects
|
86
|
+
|
87
|
+
A file named *"socialmedia.json"* with content
|
88
|
+
```json
|
89
|
+
{
|
90
|
+
"twitter": "supercoder",
|
91
|
+
"facebook": "http://www.facebook.com/supercoder"
|
92
|
+
}
|
93
|
+
```
|
94
|
+
|
95
|
+
Creates an object "socialmedia" with interfaces "socialmedia.twitter", "socialmedia.facebook" interfaces containg the relevant values from *socialmedia.json*
|
96
|
+
|
97
|
+
*Example use in a ERB file*
|
98
|
+
```erb
|
99
|
+
#!/bin/sh
|
100
|
+
|
101
|
+
echo "Posting to <%= socialmedia.facebook %> and sending a tweet to <%= socialmedia.twitter %>
|
102
|
+
```
|
103
|
+
|
104
|
+
### Executable file Objects
|
105
|
+
|
106
|
+
Executable file objects are similar to JSON Objects except the JSON string is parsed directly from script standard output (STDOUT).
|
107
|
+
|
108
|
+
A file named *"system.sh"* with content
|
109
|
+
```sh
|
110
|
+
#!/bin/sh
|
111
|
+
cat <<EOF
|
112
|
+
{
|
113
|
+
"hostname": "$(hostname)",
|
114
|
+
"uname": "$(uname -a)",
|
115
|
+
"uptime": "$(uptime)"
|
116
|
+
}
|
117
|
+
EOF
|
118
|
+
```
|
119
|
+
|
120
|
+
Creates an object "system" (All postfixes are stripped out EG .sh .py .rb), with interfaces "system.hostname", "system.uname" and "system.uptime" containing values of the same unix command.
|
121
|
+
|
122
|
+
*Example use in a ERB file*
|
123
|
+
```erb
|
124
|
+
#!/bin/sh
|
125
|
+
|
126
|
+
echo "The Uptime of host <%= system.hostname %> is <%= system.uptime %>."
|
127
|
+
echo "The kernel version is <%= system.uname %>
|
128
|
+
```
|
129
|
+
|
130
|
+
### Default Objects
|
131
|
+
|
132
|
+
Codestrap also creates objects internally for use in templates.
|
133
|
+
|
134
|
+
*project*
|
135
|
+
```erb
|
136
|
+
<%= project.module %> - Name of the strap$MODULE or stub$MODULE used.
|
137
|
+
<%= project.name %> - Name of directory or file output.
|
138
|
+
```
|
139
|
+
|
140
|
+
*datetime*
|
141
|
+
This is the DateTime object used in Ruby created using "DateTime.now()". You can use any methods available to this object in your code but to save time here are some useful ones.
|
142
|
+
|
143
|
+
*Example use in a ERB file*
|
144
|
+
```erb
|
145
|
+
<%= datetime.strftime('%c') %> - Sample "Wed Jun 29 23:20:49 2016" - Date and Time (%a %b %e %T %Y)
|
146
|
+
<%= datetime.strftime('%D') %> - Sample "06/29/16" - Date (%m/%d/%y)
|
147
|
+
<%= datetime.strftime('%F') %> - Sample "2016-06-29" - The ISO 8601 date format (%Y-%m-%d)
|
148
|
+
<%= datetime.strftime('%R') %> - Sample "23:20" - 24-hour time (%H:%M)
|
149
|
+
<%= datetime.strftime('%T') %> - Sample "23:20:49" - 24-hour time (%H:%M:%S)
|
150
|
+
<%= datetime.strftime('%+') %> - Sample "Wed Jun 29 23:20:49 +10:00 2016" - date(1) (%a %b %e %H:%M:%S %Z %Y)
|
151
|
+
```
|
data/CODESTRAPFILE.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Configuration
|
2
|
+
|
3
|
+
The default configuration file for Codestrap is located at
|
4
|
+
|
5
|
+
```
|
6
|
+
$HOME/.codestrap/Codestrapfile
|
7
|
+
```
|
8
|
+
|
9
|
+
This can be overriden using the $CODESTRAPFILE environment variable
|
10
|
+
|
11
|
+
```bash
|
12
|
+
export CODESTRAPFILE='/usr/local/codestrap/Codestrapfile'
|
13
|
+
```
|
14
|
+
|
15
|
+
Available settings
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Codestrapfile.config do |conf|
|
19
|
+
# Base directory or list of base directories that contain "object" and "content" sub directories
|
20
|
+
# Defaults to $HOME/.codestrap
|
21
|
+
#conf.local.base = [ '/home/user/.codestrap', '/usr/local/codestrap' ]
|
22
|
+
#conf.local.base = '/home/user/.codestrap'
|
23
|
+
|
24
|
+
# Ignore paths or list of paths to ignore
|
25
|
+
#conf.local.ignore = [ '.git', '.svn' ]
|
26
|
+
#conf.local.ignore = '.git'
|
27
|
+
end
|
28
|
+
```
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2014 Dexter Plameras
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# CodeStrap
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/dexterp/codestrap.svg?branch=master)](https://travis-ci.org/dexterp/codestrap)
|
4
|
+
[![Dependency Status](https://gemnasium.com/dexterp/codestrap.png)](https://gemnasium.com/dexterp/codestrap)
|
5
|
+
[![Inline docs](http://inch-ci.org/github/dexterp/codestrap.svg)](http://inch-ci.org/github/dexterp/codestrap)
|
6
|
+
|
7
|
+
CodeStrap is a simple command line project code generator. It provides an easy way to create custom boilerplate for new projects and individual text files, and a very easy way to access that boilerplate.
|
8
|
+
|
9
|
+
It is written specifically for ease of use on the command line.
|
10
|
+
|
11
|
+
## Quickstart
|
12
|
+
|
13
|
+
### 1. Download and install using the package installer
|
14
|
+
|
15
|
+
At this stage only Linux and OSX are supported.
|
16
|
+
|
17
|
+
[PACKAGES](https://github.com/dexterp/codestrap/releases)
|
18
|
+
|
19
|
+
### 2. Clone the sample templates to your home directory
|
20
|
+
|
21
|
+
```bash
|
22
|
+
git clone http://github.com/dexterp/codestrap-samples.git $HOME/.codestrap
|
23
|
+
```
|
24
|
+
|
25
|
+
### 3. Add CodeStrap files to your path
|
26
|
+
|
27
|
+
```bash
|
28
|
+
echo 'export PATH=$HOME/.codestrap/bin:$PATH' >> $HOME/.profile
|
29
|
+
```
|
30
|
+
|
31
|
+
### 4. Scan available templates and generate commands (sym links)
|
32
|
+
|
33
|
+
```bash
|
34
|
+
# List templates
|
35
|
+
ls $HOME/.codestrap/content
|
36
|
+
|
37
|
+
# Generate links
|
38
|
+
strap -g
|
39
|
+
|
40
|
+
# List generated commands
|
41
|
+
ls $HOME/.codestrap/bin
|
42
|
+
```
|
43
|
+
|
44
|
+
### 5. Create files and projects from boilerplate
|
45
|
+
|
46
|
+
```bash
|
47
|
+
# Text file boilerplate
|
48
|
+
stubrubyscript myscript.rb
|
49
|
+
stubperlscript myscript.pl
|
50
|
+
```
|
51
|
+
|
52
|
+
```
|
53
|
+
# Project boilerplate
|
54
|
+
strappuppetmodule mypuppetmodule
|
55
|
+
straprubygem mygem
|
56
|
+
```
|
57
|
+
|
58
|
+
## Boilerplate Setup
|
59
|
+
|
60
|
+
For template setups for both projects and individual files see ...
|
61
|
+
|
62
|
+
[BOILERPLATE](BOILERPLATE.md)
|
63
|
+
|
64
|
+
## Configuration File
|
65
|
+
|
66
|
+
Codestrap uses "Codestrapfile" as a configuration file. For details see.
|
67
|
+
|
68
|
+
[CODESTRAPFILE](CODESTRAPFILE.md)
|
69
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
ROOT = File.dirname(File.expand_path(__FILE__))
|
2
|
+
FEATURES_PATH = File.join(ROOT, 'features')
|
3
|
+
LIB_PATH = File.join(ROOT, 'lib')
|
4
|
+
TMP_PATH = File.join(ROOT, 'tmp')
|
5
|
+
TMP_FILES = Rake::FileList.new(File.join(ROOT, 'tmp','*'))
|
6
|
+
PACKAGES = Rake::FileList.new(File.join(ROOT, 'pkg', '*'))
|
7
|
+
DOCS = Rake::FileList.new(File.join(ROOT, 'doc', '*'))
|
8
|
+
$LOAD_PATH.unshift(LIB_PATH)
|
9
|
+
require 'codestrap'
|
10
|
+
require 'codestrap/version'
|
11
|
+
require 'bundler/gem_tasks'
|
12
|
+
require 'cucumber'
|
13
|
+
require 'cucumber/rake/task'
|
14
|
+
require 'rake'
|
15
|
+
require 'yard'
|
16
|
+
|
17
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
18
|
+
t.cucumber_opts = "#{FEATURES_PATH} -r #{FEATURES_PATH}/step_definitions -r #{FEATURES_PATH}/support --format pretty"
|
19
|
+
end
|
20
|
+
|
21
|
+
YARD::Rake::YardocTask.new do |t|
|
22
|
+
t.files = %w[ lib/**/*.rb ]
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Clean files'
|
26
|
+
task :clean do
|
27
|
+
clean = []
|
28
|
+
clean += TMP_FILES
|
29
|
+
clean += PACKAGES
|
30
|
+
clean += DOCS
|
31
|
+
clean.each do |file|
|
32
|
+
rm_rf file
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Uninstall'
|
37
|
+
task :uninstall do
|
38
|
+
sh 'gem uninstall codestrap -x'
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Reinstall'
|
42
|
+
task :reinstall do
|
43
|
+
Rake::Task['uninstall'].invoke
|
44
|
+
Rake::Task['install'].invoke
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Package using omnibus'
|
48
|
+
task :package do
|
49
|
+
Rake::Task['build'].invoke
|
50
|
+
sh 'omnibus build codestrap'
|
51
|
+
end
|
data/bin/strap
ADDED
data/bin/upstrap
ADDED
data/codestrap.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'codestrap/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'codestrap'
|
8
|
+
spec.version = Codestrap::VERSION
|
9
|
+
spec.authors = ['Dexter Plameras']
|
10
|
+
spec.email = ['dpgrps@gmail.com']
|
11
|
+
spec.summary = %q{File codestrap and boilerplate command line tool.}
|
12
|
+
spec.description = <<EOF
|
13
|
+
Codestrap is a file codestrap and boilerplate project tool. It is run from the command line
|
14
|
+
and has been designed to make use of the CLIs autocomplete functionality available
|
15
|
+
on supported operating systems shells.
|
16
|
+
EOF
|
17
|
+
spec.homepage = ''
|
18
|
+
spec.license = 'Apache'
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0")
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'sinatra', '~> 1.4.5'
|
26
|
+
spec.add_runtime_dependency 'ptools'
|
27
|
+
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency 'cucumber'
|
29
|
+
spec.add_development_dependency 'rack-test'
|
30
|
+
spec.add_development_dependency 'rake'
|
31
|
+
spec.add_development_dependency 'rspec'
|
32
|
+
spec.add_development_dependency 'webmock'
|
33
|
+
spec.add_development_dependency 'shotgun'
|
34
|
+
spec.add_development_dependency 'yard'
|
35
|
+
spec.add_development_dependency 'redcarpet'
|
36
|
+
spec.add_development_dependency 'mocha'
|
37
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Dexter Plameras
|
3
|
+
#
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
require File.absolute_path(File.join(File.dirname(__FILE__),'..','..','lib','codestrap','version'))
|
7
|
+
|
8
|
+
name 'codestrap'
|
9
|
+
maintainer 'Dexter Plameras'
|
10
|
+
homepage 'https://github.com/dexterp/codestrap'
|
11
|
+
|
12
|
+
# Defaults to C:/codestrap on Windows
|
13
|
+
# and /opt/codestrap on all other platforms
|
14
|
+
install_dir "#{default_root}/#{name}"
|
15
|
+
|
16
|
+
build_version Codestrap::VERSION
|
17
|
+
build_iteration 1
|
18
|
+
|
19
|
+
dependency 'codestrap'
|
20
|
+
|
21
|
+
exclude "**/.git"
|
22
|
+
exclude "**/bundler/git"
|