boxen-module-maker 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/{README.rdoc → README.md} +15 -1
- data/boxen-module-maker.gemspec +1 -0
- data/lib/boxen-module-maker/bin.rb +47 -5
- data/lib/boxen-module-maker/templates/manifests/init.pp +4 -0
- data/lib/boxen-module-maker/templates/module_spec.rb +9 -0
- data/lib/boxen-module-maker/version.rb +2 -2
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmZkYjk5MGZkMTU5OWQyMzhiMDdkNTAyYzg4MWUzN2ZmNjI3NmNjOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjRlOTExYjVjZmI0YzNhZWRlNWJkNjY5N2U1YjM1NjNmOWQ1M2MwOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDVmNzBkY2IxMjljMDMwMzFkZWRlMzNiOTliNWQzZGRhMDUyODNhNDJkMjg3
|
10
|
+
MDk3Y2M3MDk1Nzc0ZWU3YWM2YTdjYTM5YjMxZjA4Njg2MDRlOGM0NDY0ZTE3
|
11
|
+
M2Y1YTRiOWVlNzVlODdlYzNhYTlkYzI0YmZlOThhNTY5YjJjMTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWY3OWM1NGYyMDNmMWY4YTZhYjUwZDkzMzhkYmIxM2NmNDA3ZjUyNjhmOGIy
|
14
|
+
N2JmNzA5MDc1NzNhMjljMzU2NDljNjkxNmYwYjdmODA5OTBlMTA2ODRhOGM0
|
15
|
+
MGUwYmU4NzQ3MDlmMGI0YzUwNjJmNzM5MjJiMjhjYzAwZWFmNWI=
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,7 +1,21 @@
|
|
1
|
-
|
1
|
+
# boxen-module-maker
|
2
2
|
|
3
3
|
A gem for creating boxen modules easier! :)
|
4
4
|
|
5
|
+
## Basic Use
|
6
|
+
```
|
7
|
+
$ gem install boxen-module-maker
|
8
|
+
$ boxen-module-maker new_app
|
9
|
+
boxen-module-maker: [CREATE FOLDER] Making 'puppet-new_app'
|
10
|
+
create puppet-new_app
|
11
|
+
$ cd puppet-new_app
|
12
|
+
$ ls
|
13
|
+
ls
|
14
|
+
CONTRIBUTING.md Gemfile Gemfile.lock LICENSE README.md manifests script spec
|
15
|
+
```
|
16
|
+
|
17
|
+
So at the moment, all it does is make a folder and clone the [puppet-template](https://github.com/boxen/puppet-template) folder. Future features will be to customise the specs and such.
|
18
|
+
|
5
19
|
== Contributing to boxen-module-maker
|
6
20
|
|
7
21
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/boxen-module-maker.gemspec
CHANGED
@@ -27,12 +27,24 @@ class BoxenModuleMaker
|
|
27
27
|
return 1
|
28
28
|
else
|
29
29
|
puts "boxen-module-maker: [CREATE FOLDER] Making '#{module_name}'"
|
30
|
-
|
30
|
+
FileUtils.mkdir_p(module_name)
|
31
31
|
get_boxen_template(module_name)
|
32
|
+
rename_template_files(module_name)
|
33
|
+
commit_working_version(module_name)
|
32
34
|
return 0
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
38
|
+
def rename_template_files(module_name)
|
39
|
+
Dir.chdir(module_name) do
|
40
|
+
FileUtils.mv "spec/fixtures/modules/template/", "spec/fixtures/modules/#{@application_name}/"
|
41
|
+
FileUtils.rm "spec/classes/template_spec.rb"
|
42
|
+
end
|
43
|
+
output_template_in_target 'manifests/init.pp', File.join('manifests', 'init.pp')
|
44
|
+
output_template_in_target 'module_spec.rb', File.join('spec/classes/', "#{@application_name}_spec.rb")
|
45
|
+
|
46
|
+
end
|
47
|
+
|
36
48
|
def get_boxen_template(target_dir)
|
37
49
|
Dir.chdir(target_dir) do
|
38
50
|
begin
|
@@ -44,7 +56,6 @@ class BoxenModuleMaker
|
|
44
56
|
@repo.add_remote('template', 'https://github.com/boxen/puppet-template.git')
|
45
57
|
@repo.remote('template').fetch
|
46
58
|
@repo.checkout('master')
|
47
|
-
@repo.remote('template').remove
|
48
59
|
|
49
60
|
# Remote remove is broken on ruby-git right now...
|
50
61
|
# https://github.com/schacon/ruby-git/pull/42
|
@@ -61,9 +72,40 @@ class BoxenModuleMaker
|
|
61
72
|
end
|
62
73
|
end
|
63
74
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
75
|
+
def commit_working_version(target_dir)
|
76
|
+
Dir.chdir(target_dir) do
|
77
|
+
@repo = Git.init()
|
78
|
+
|
79
|
+
begin
|
80
|
+
@repo.add('.')
|
81
|
+
rescue Git::GitExecuteError => e
|
82
|
+
#raise GitAddFailed, "There was some problem adding this directory to the git changeset"
|
83
|
+
raise
|
84
|
+
end
|
85
|
+
|
86
|
+
begin
|
87
|
+
@repo.commit "#{@target_dir} generated by boxen-module-maker"
|
88
|
+
rescue Git::GitExecuteError => e
|
89
|
+
raise
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def render_template(source)
|
96
|
+
template_contents = File.read(File.join(template_dir, source))
|
97
|
+
template = ERB.new(template_contents, nil, '<>')
|
98
|
+
template.result(binding).gsub(/\n\n\n+/, "\n\n")
|
99
|
+
end
|
100
|
+
|
101
|
+
def output_template_in_target(source, destination = source)
|
102
|
+
final_destination = File.join(@target_dir, destination)
|
103
|
+
template_result = render_template(source)
|
104
|
+
File.open(final_destination, 'w') {|file| file.write(template_result)}
|
105
|
+
end
|
106
|
+
|
107
|
+
def template_dir
|
108
|
+
File.join(File.dirname(__FILE__), 'templates')
|
67
109
|
end
|
68
110
|
|
69
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxen-module-maker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter M Souter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: git
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: Get your boxen modules up and running easily
|
28
42
|
email:
|
29
43
|
- p.morsou@gmail.com
|
@@ -37,12 +51,14 @@ files:
|
|
37
51
|
- Gemfile
|
38
52
|
- Gemfile.lock
|
39
53
|
- LICENSE.txt
|
40
|
-
- README.
|
54
|
+
- README.md
|
41
55
|
- Rakefile
|
42
56
|
- bin/boxen-module-maker
|
43
57
|
- boxen-module-maker.gemspec
|
44
58
|
- lib/boxen-module-maker.rb
|
45
59
|
- lib/boxen-module-maker/bin.rb
|
60
|
+
- lib/boxen-module-maker/templates/manifests/init.pp
|
61
|
+
- lib/boxen-module-maker/templates/module_spec.rb
|
46
62
|
- lib/boxen-module-maker/version.rb
|
47
63
|
- spec/boxen-module-maker_spec.rb
|
48
64
|
- spec/spec_helper.rb
|