Repository navigation
Expand file tree
/
Copy pathruby_env.cf
More file actions
182 lines (152 loc) · 5.83 KB
/
Copy pathruby_env.cf
File metadata and controls
182 lines (152 loc) · 5.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#
# The Cfengine Cloud Pack, Copyright (C) Cfengine AS, Oslo Norway
# --------------------------------------------------------------------
#
# This file is provided under a perpetual license as part of tjhe
# Cfengine Cloud Pack (hereby called The Software). The Software may be
# used within a single Internet Domain. If no Internet Domain is
# registered, it may be used within a single legal organization
# possessing a maximum of 1024 computers, or by a single individual with
# up to 250 computers. Multiple licenses may be purchased, as needed.
#
# The Licensee may modify, adapt and create derivative works based upon
# the Software, for use within its organisation and for sharing between
# other consecutive licensees. However, the Licensee shall not
# reproduce, distribute, resell, rent, lease or disclose the Software in
# any manner or form to any other third party not holding a license for
# the Software.
#
# The Licensee may not transfer any of its rights under this agreement
# without the prior and express written consent of Cfengine.
#
# INTELLECTUAL PROPERTY RIGHTS
#
# Cfengine does not transfer any copyrights or other intellectual
# property rights relating to the Software to the Licensee. Such rights
# are protected by intellectual property legislation in the United
# States, Europe and other jurisdictions and by international treaty
# provisions. Cfengine and its suppliers retain all rights in the
# Software that are not expressly granted to the Licensee through this
# license.
#
# The Licensee is not allowed to remove, alter or destroy any proprietary,
# trademark or copyright markings or notices placed upon or contained
# within the Software.
#
# NO WARRANTY
#
# To the maximum extent permitted by law, Cfengine disclaims any
# warranty for the Software. The Software, any services and any related
# documentation are provided on an "as is" basis without warranty of any
# kind, whether express or implied, including, but not limited to,
# implied warranties of merchantability, fitness for a particular
# purpose or non-infringement. Hereunder the parties acknowledges that
# Cfengine does not warrant for the performance of any data centre on
# which the Software runs, or the absence of any errors in the Software,
# and that any such errors does not constitute a contractual defect.
#
# LIABILITY
#
# The liability of the parties in contract, tort (including negligence)
# or otherwise shall for all incidents during the entire term of 30 days
# from the date of purchase be limited to a half of the fees paid for a
# perpetual license. Cfengine or its suppliers shall not be liable for
# any special, incidental, indirect or consequential damages whatsoever
# (including, without limitation, damages for loss of business profits,
# lost savings, business interruption, loss of business information,
# personal injury, loss of privacy, loss of goodwill or any other
# financial loss) arising out of the use of or inability to use the
# Software, even if advised of the possibility of such damages.
#
# THIRD-PARTY TERMS
#
# For third-party software that is integrated with or used by
# Cfengine, the current terms of the relevant third party software
# supplier shall apply.
#
#######################################################
# RUBY on RAILS
#######################################################
#
# Scenario:
# Setup ruby on rails server.
#
bundle agent develop_ruby_on_rails
{
vars:
centos::
"ruby_pkgs" slist => {
"ruby",
"ruby-devel",
"ruby-irb",
"ruby-rdoc",
"ruby-ri",
"sqlite-devel"
};
ubuntu::
"ruby_pkgs" slist => {
"ruby",
"irb",
"rdoc",
"rubygems",
"build-essential",
"zlib1g",
"libopenssl-ruby",
"libreadline-ruby",
"rails",
"sqlite3",
"libsqlite3-ruby"
# Optional using mysql database instead
# "mysql-server",
# "mysql-client",
# "libmysqlclient-dev",
# "libmysql-ruby"
};
#
classes:
any::
"no_gems" not => fileexists("/usr/bin/gem");
"no_rails" not => fileexists("/usr/bin/rails");
#
files:
centos::
"/tmp/install_rails.rb"
comment => "Create a script to install rails by rubygems",
create => "true",
perms => mog("755","root","root"),
edit_defaults => empty,
edit_line => install_rails,
classes => if_ok("please_install_rails");
#
packages:
any::
"$(ruby_pkgs)"
comment => "Prepare RUBY environment for ruby programing and ruby on rails",
package_policy => "add",
package_method => generic,
classes => if_ok("all_set");
#
commands:
please_install_rails.all_set.no_gems.no_rails::
"/tmp/install_rails.rb"
comment => "To setup rails and rubygems on CentOS, not available on YUM repo";
centos.Hr00.Min00_05::
"/usr/bin/gem update"
comment => "check for update rubygems and its dependency once a day";
}
######################################################################
bundle edit_line install_rails
{
insert_lines:
"#!/usr/bin/env ruby
def cmd(cmd)
puts cmd; system(cmd)
end
cmd \"cd /tmp && wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz\"
cmd \"cd /tmp && tar xvfz rubygems-1.3.5.tgz\"
cmd \"cd /tmp/rubygems-1.3.5 && ruby setup.rb\"
cmd \"rm -rf /tmp/rubygems*\"
cmd \"gem install rails\"
cmd \"gem install sqlite3-ruby --version=1.2.4\"";
}
######################################################################