jeni 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Bugs.rdoc +6 -0
- data/Gemfile +14 -0
- data/History.txt +9 -0
- data/Intro.txt +3 -0
- data/LICENCE.rdoc +159 -0
- data/README.md +188 -0
- data/lib/jeni.rb +374 -0
- data/lib/jeni/actions.rb +400 -0
- data/lib/jeni/errors.rb +22 -0
- data/lib/jeni/io.rb +71 -0
- data/lib/jeni/options.rb +68 -0
- data/lib/jeni/optparse.rb +84 -0
- data/lib/jeni/utils.rb +181 -0
- data/lib/jeni/version.rb +13 -0
- data/spec/jeni_spec.rb +85 -0
- data/spec/jeni_utils_spec.rb +297 -0
- data/spec/spec_helper.rb +26 -0
- data/test/examples/source/coati.haml.conf +37 -0
- data/test/examples/source/executable +3 -0
- data/test/examples/source/jenny-diff.rb +64 -0
- data/test/examples/source/jenny.rb +63 -0
- data/test/examples/source/shebang.rb +3 -0
- data/test/examples/source/subfiles/subfile_1.rb +63 -0
- data/test/examples/source/template.haml.rb +10 -0
- data/test/examples/target/archive/coati.haml.conf +37 -0
- data/test/examples/target/archive/executable +3 -0
- data/test/examples/target/archive/jenny-diff.rb +64 -0
- data/test/examples/target/archive/jenny.rb +63 -0
- data/test/examples/target/archive/shebang.rb +3 -0
- data/test/examples/target/archive/subfiles/subfile_1.rb +63 -0
- data/test/examples/target/archive/template.haml.rb +10 -0
- data/test/examples/target/jenny.rb +63 -0
- data/test/examples/target/jenny_link.rb +63 -0
- data/test/examples/target2/coati.conf +36 -0
- data/test/examples/target2/coati.haml.conf +37 -0
- data/test/examples/target2/executable +3 -0
- data/test/examples/target2/jenny-diff.rb +64 -0
- data/test/examples/target2/jenny.rb +63 -0
- data/test/examples/target2/jenny_link.rb +63 -0
- data/test/examples/target2/jenny_template.rb +10 -0
- data/test/examples/target2/jenny_test.rb +63 -0
- data/test/examples/target2/shebang.rb +3 -0
- data/test/examples/target2/std_template.rb +12 -0
- data/test/examples/target2/template.haml.rb +10 -0
- data/test/examples/test1.rb +30 -0
- data/test/examples/test2.rb +27 -0
- data/test/examples/test_args +24 -0
- data/test/examples/test_users +16 -0
- metadata +162 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
#
|
2
|
+
# Author:: R.J.Sharp
|
3
|
+
# Email:: robert(a)osburn-sharp.ath.cx
|
4
|
+
# Copyright:: Copyright (c) 2012
|
5
|
+
# License:: Open Software Licence v3.0
|
6
|
+
#
|
7
|
+
# This software is licensed for use under the Open Software Licence v. 3.0
|
8
|
+
# The terms of this licence can be found at http://www.opensource.org/licenses/osl-3.0.php
|
9
|
+
# and in the file LICENCE. Under the terms of this licence, all derivative works
|
10
|
+
# must themselves be licensed under the Open Software Licence v. 3.0
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# [requires go here]
|
14
|
+
require 'rubygems'
|
15
|
+
|
16
|
+
# = Jeni
|
17
|
+
#
|
18
|
+
# [Description of the main module]
|
19
|
+
module Jeni
|
20
|
+
class Installer
|
21
|
+
|
22
|
+
def initialize(gem_name)
|
23
|
+
@gem_name = gem_name
|
24
|
+
@gem_spec = Gem::Specification.find_by_name(@gem_name)
|
25
|
+
@commands = []
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.construct(gem_name, options={}, &block)
|
29
|
+
@pretend = options[:pretend] || true # JUST FOR NOW!
|
30
|
+
installer = self.new(gem_name)
|
31
|
+
block.call(installer)
|
32
|
+
return self
|
33
|
+
end
|
34
|
+
|
35
|
+
def run!(pretent=false)
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
# copy a file from the source, relative to the gem home to the target
|
40
|
+
# which is absolute
|
41
|
+
def file(source, target, opts={})
|
42
|
+
@commands << {:file => {source => target}}
|
43
|
+
if opts.has_key?(:chown) then
|
44
|
+
@commands << {:chown => opts[:chown]}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# copy all of the files in a directory
|
49
|
+
def directory(source, target, opts={})
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
# create a wrapper at target to call source
|
54
|
+
def wrapper(source, target)
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
def link(source, target)
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby18
|
2
|
+
# simple etst of Jeeni
|
3
|
+
require 'rubygems'
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', File.dirname(__FILE__))
|
5
|
+
require 'jeni'
|
6
|
+
require 'rspec/mocks/standalone'
|
7
|
+
|
8
|
+
gspec = double("Gem::Specification")
|
9
|
+
Gem::Specification.stub(:find_by_name).and_return(gspec)
|
10
|
+
test_dir = File.dirname(__FILE__)
|
11
|
+
target_dir = File.join(test_dir, 'target2')
|
12
|
+
FileUtils.mkdir(target_dir) unless FileTest.directory?(target_dir)
|
13
|
+
FileUtils.rm_f Dir.glob("#{target_dir}/**")
|
14
|
+
gspec.should_receive(:gem_dir).and_return(test_dir)
|
15
|
+
pretend = true
|
16
|
+
|
17
|
+
Jeni::Installer.new_from_gem('jeni') do |jeni|
|
18
|
+
jeni.pretend(false)
|
19
|
+
jeni.verbose(false)
|
20
|
+
jeni.file('source/jeni.rb', File.join(target_dir, 'jeni_test.rb'), :chown=>'robert')
|
21
|
+
jeni.file('source/jeni.rb', File.join(target_dir, 'jeni.rb'), :chown=>'robert')
|
22
|
+
jeni.file('source/shebang.rb', File.join(target_dir, 'shebang.rb'), :chown=>'robert', :chmod=>0755)
|
23
|
+
jeni.directory('source', target_dir)
|
24
|
+
jeni.message('invoke', 'templating', :white)
|
25
|
+
jeni.template('source/template.haml.rb', File.join(target_dir, 'jeni_template'), :chown=>'robert', :greeting=>'Welcome and well met', :author=>'Me')
|
26
|
+
jeni.wrapper('source/executable', File.join(target_dir, 'executable'), :chmod=>true)
|
27
|
+
jeni.link('source/jeni.rb', File.join(target_dir, 'jeni_link.rb'))
|
28
|
+
jeni.link('source/shebang.rb', File.join(target_dir, 'jeni_link.rb'))
|
29
|
+
jeni.link('/etc/conf.d/unicorn', File.join(target_dir, 'unicorn.jeni'))
|
30
|
+
end.run!
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby18
|
2
|
+
# simple etst of Jeeni
|
3
|
+
require 'rubygems'
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', File.dirname(__FILE__))
|
5
|
+
require 'jeni'
|
6
|
+
|
7
|
+
test_dir = File.dirname(__FILE__)
|
8
|
+
target_dir = File.join(test_dir, 'target2')
|
9
|
+
FileUtils.mkdir(target_dir) unless FileTest.directory?(target_dir)
|
10
|
+
FileUtils.rm_f Dir.glob("#{target_dir}/**")
|
11
|
+
|
12
|
+
pretend = true
|
13
|
+
|
14
|
+
Jeni::Installer.new(test_dir, 'jeni') do |jeni|
|
15
|
+
jeni.pretend(false)
|
16
|
+
jeni.verbose(false)
|
17
|
+
jeni.file('source/jeni.rb', File.join(target_dir, 'jeni_test.rb'), :chown=>'robert')
|
18
|
+
jeni.file('source/jeni.rb', File.join(target_dir, 'jeni.rb'), :chown=>'robert')
|
19
|
+
jeni.file('source/shebang.rb', File.join(target_dir, 'shebang.rb'), :chown=>'robert', :chmod=>0755)
|
20
|
+
jeni.directory('source', target_dir)
|
21
|
+
jeni.template('source/template.haml.rb', File.join(target_dir, 'jeni_template.rb'), :greeting=>'Welcome and well met', :author=>'Me')
|
22
|
+
jeni.template('source/coati.haml.conf', File.join(target_dir, 'coati.conf'), :root=>'/home/robert/dev/rails/coati', :app_name=>'coati')
|
23
|
+
jeni.standard_template('template.haml.rb', File.join(target_dir, 'std_template.rb'), :greeting=>'How do you do?', :author=>'Robert')
|
24
|
+
jeni.link('source/jeni.rb', File.join(target_dir, 'jeni_link.rb'))
|
25
|
+
jeni.link('source/shebang.rb', File.join(target_dir, 'jeni_link.rb'))
|
26
|
+
jeni.link('source/jeni.rb', File.join(target_dir, 'jeni.rb'))
|
27
|
+
end.run!
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby18
|
2
|
+
# simple etst of Jeeni
|
3
|
+
require 'rubygems'
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', File.dirname(__FILE__))
|
5
|
+
require 'jeni'
|
6
|
+
require 'rspec/mocks/standalone'
|
7
|
+
|
8
|
+
gspec = double("Gem::Specification")
|
9
|
+
Gem::Specification.stub(:find_by_name).and_return(gspec)
|
10
|
+
test_dir = File.dirname(__FILE__)
|
11
|
+
target_dir = File.join(test_dir, 'target2')
|
12
|
+
FileUtils.mkdir(target_dir) unless FileTest.directory?(target_dir)
|
13
|
+
FileUtils.rm_f Dir.glob("#{target_dir}/**")
|
14
|
+
gspec.should_receive(:gem_dir).and_return(test_dir)
|
15
|
+
pretend = true
|
16
|
+
|
17
|
+
Jeni::Installer.new_from_gem('jeni') do |jeni|
|
18
|
+
jeni.optparse(ARGV)
|
19
|
+
jeni.file('source/jeni.rb', File.join(target_dir, 'jeni_test.rb'), :chown=>'robert')
|
20
|
+
jeni.file('source/jeni.rb', File.join(target_dir, 'jeni.rb'), :chown=>'robert', :chgrp=>'users')
|
21
|
+
jeni.directory('source', target_dir)
|
22
|
+
jeni.wrapper('source/executable', File.join(target_dir, 'executable'), :chmod=>true)
|
23
|
+
jeni.link('source/jeni.rb', File.join(target_dir, 'jeni_link.rb'))
|
24
|
+
end.run!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby18
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', File.dirname(__FILE__))
|
5
|
+
require 'jeni'
|
6
|
+
|
7
|
+
test_dir = File.dirname(__FILE__)
|
8
|
+
target_dir = File.join(test_dir, 'target2')
|
9
|
+
FileUtils.mkdir(target_dir) unless FileTest.directory?(target_dir)
|
10
|
+
FileUtils.rm_f Dir.glob("#{target_dir}/**")
|
11
|
+
|
12
|
+
Jeni::Installer.new(test_dir, 'jeni') do |jeni|
|
13
|
+
jeni.optparse(ARGV)
|
14
|
+
jeni.group("piglets", :gid=>10101, :skip=>true)
|
15
|
+
jeni.user("peppapig", :uid=>10101, :user_group=>true, :skip=>true)
|
16
|
+
end.run!
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jeni
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Dr Robert
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-10-04 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
type: :runtime
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
name: colored
|
32
|
+
version_requirements: *id001
|
33
|
+
prerelease: false
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
type: :runtime
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
name: diffy
|
46
|
+
version_requirements: *id002
|
47
|
+
prerelease: false
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
type: :runtime
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
name: haml
|
60
|
+
version_requirements: *id003
|
61
|
+
prerelease: false
|
62
|
+
description: |
|
63
|
+
A simple alternative to rubigen and thor that can be used to create a post-install script
|
64
|
+
for a gem needing more than the standard file ops covered by rubygems. It can also be
|
65
|
+
used for straight directories instead of gems, if required.
|
66
|
+
|
67
|
+
email: robert@osburn-sharp.ath.cx
|
68
|
+
executables: []
|
69
|
+
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
extra_rdoc_files:
|
73
|
+
- History.txt
|
74
|
+
- Bugs.rdoc
|
75
|
+
- Intro.txt
|
76
|
+
- LICENCE.rdoc
|
77
|
+
- Gemfile
|
78
|
+
- README.md
|
79
|
+
files:
|
80
|
+
- History.txt
|
81
|
+
- Bugs.rdoc
|
82
|
+
- Intro.txt
|
83
|
+
- LICENCE.rdoc
|
84
|
+
- Gemfile
|
85
|
+
- README.md
|
86
|
+
- lib/jeni/errors.rb
|
87
|
+
- lib/jeni/version.rb
|
88
|
+
- lib/jeni/utils.rb
|
89
|
+
- lib/jeni/options.rb
|
90
|
+
- lib/jeni/optparse.rb
|
91
|
+
- lib/jeni/io.rb
|
92
|
+
- lib/jeni/actions.rb
|
93
|
+
- lib/jeni.rb
|
94
|
+
- spec/spec_helper.rb
|
95
|
+
- spec/jeni_spec.rb
|
96
|
+
- spec/jeni_utils_spec.rb
|
97
|
+
- test/examples/source/jenny-diff.rb
|
98
|
+
- test/examples/source/jenny.rb
|
99
|
+
- test/examples/source/shebang.rb
|
100
|
+
- test/examples/source/executable
|
101
|
+
- test/examples/source/template.haml.rb
|
102
|
+
- test/examples/source/coati.haml.conf
|
103
|
+
- test/examples/source/subfiles/subfile_1.rb
|
104
|
+
- test/examples/test1.rb
|
105
|
+
- test/examples/test_args
|
106
|
+
- test/examples/test2.rb
|
107
|
+
- test/examples/test_users
|
108
|
+
- test/examples/target/jenny.rb
|
109
|
+
- test/examples/target/archive/jenny-diff.rb
|
110
|
+
- test/examples/target/archive/jenny.rb
|
111
|
+
- test/examples/target/archive/shebang.rb
|
112
|
+
- test/examples/target/archive/executable
|
113
|
+
- test/examples/target/archive/template.haml.rb
|
114
|
+
- test/examples/target/archive/coati.haml.conf
|
115
|
+
- test/examples/target/archive/subfiles/subfile_1.rb
|
116
|
+
- test/examples/target/jenny_link.rb
|
117
|
+
- test/examples/target2/jenny_test.rb
|
118
|
+
- test/examples/target2/jenny.rb
|
119
|
+
- test/examples/target2/shebang.rb
|
120
|
+
- test/examples/target2/jenny-diff.rb
|
121
|
+
- test/examples/target2/executable
|
122
|
+
- test/examples/target2/template.haml.rb
|
123
|
+
- test/examples/target2/coati.haml.conf
|
124
|
+
- test/examples/target2/jenny_template.rb
|
125
|
+
- test/examples/target2/coati.conf
|
126
|
+
- test/examples/target2/std_template.rb
|
127
|
+
- test/examples/target2/jenny_link.rb
|
128
|
+
homepage:
|
129
|
+
licenses:
|
130
|
+
- Open Software Licence v3.0
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options:
|
133
|
+
- --main=README.rdoc
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
version: "0"
|
154
|
+
requirements: []
|
155
|
+
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 1.8.24
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: A little post-install helper for Gems to install things Gems can't reach, and can be used for non-gems too.
|
161
|
+
test_files: []
|
162
|
+
|