rails_packager 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/exe/rails_package +25 -0
- data/lib/rails_packager.rb +8 -0
- data/lib/rails_packager/command.rb +84 -0
- data/lib/rails_packager/command_parser.rb +66 -0
- data/lib/rails_packager/engine.rb +4 -0
- data/lib/rails_packager/runner.rb +138 -0
- data/lib/rails_packager/util.rb +30 -0
- data/lib/rails_packager/version.rb +3 -0
- data/lib/tasks/rails_packager_tasks.rake +8 -0
- data/test/dummy/Gemfile +2 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +15 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +7 -0
- data/test/dummy/log/test.log +21747 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/files/environment-variable-in-one-command-merges-with-env.yml +9 -0
- data/test/files/environment-variable-in-one-command.yml +5 -0
- data/test/files/environment-variable-replacement.yml +7 -0
- data/test/files/execution-path.yml +3 -0
- data/test/files/failure-integration.yml +6 -0
- data/test/files/files-is-within-quotes.yml +2 -0
- data/test/files/files-not-its-own-argument.yml +2 -0
- data/test/files/fully-customized.yml +13 -0
- data/test/files/missing-command-name.yml +5 -0
- data/test/files/quotes-in-command.yml +2 -0
- data/test/files/simple-integration.yml +7 -0
- data/test/integration_test.rb +224 -0
- data/test/jruby_dummy/Jarfile +1 -0
- data/test/jruby_dummy/README.rdoc +28 -0
- data/test/jruby_dummy/Rakefile +6 -0
- data/test/jruby_dummy/app/assets/javascripts/application.js +13 -0
- data/test/jruby_dummy/app/assets/stylesheets/application.css +15 -0
- data/test/jruby_dummy/app/controllers/application_controller.rb +5 -0
- data/test/jruby_dummy/app/helpers/application_helper.rb +2 -0
- data/test/jruby_dummy/app/views/layouts/application.html.erb +14 -0
- data/test/jruby_dummy/bin/bundle +3 -0
- data/test/jruby_dummy/bin/rails +4 -0
- data/test/jruby_dummy/bin/rake +4 -0
- data/test/jruby_dummy/bin/setup +29 -0
- data/test/jruby_dummy/config.ru +4 -0
- data/test/jruby_dummy/config/application.rb +22 -0
- data/test/jruby_dummy/config/boot.rb +5 -0
- data/test/jruby_dummy/config/database.yml +23 -0
- data/test/jruby_dummy/config/environment.rb +5 -0
- data/test/jruby_dummy/config/environments/development.rb +41 -0
- data/test/jruby_dummy/config/environments/production.rb +79 -0
- data/test/jruby_dummy/config/environments/test.rb +42 -0
- data/test/jruby_dummy/config/initializers/assets.rb +11 -0
- data/test/jruby_dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/jruby_dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/jruby_dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/jruby_dummy/config/initializers/inflections.rb +16 -0
- data/test/jruby_dummy/config/initializers/mime_types.rb +4 -0
- data/test/jruby_dummy/config/initializers/session_store.rb +3 -0
- data/test/jruby_dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/jruby_dummy/config/locales/en.yml +23 -0
- data/test/jruby_dummy/config/routes.rb +56 -0
- data/test/jruby_dummy/config/secrets.yml +22 -0
- data/test/jruby_dummy/db/schema.rb +15 -0
- data/test/jruby_dummy/public/404.html +67 -0
- data/test/jruby_dummy/public/422.html +67 -0
- data/test/jruby_dummy/public/500.html +66 -0
- data/test/jruby_dummy/public/favicon.ico +0 -0
- data/test/rails_packager/command_parser_test.rb +74 -0
- data/test/rails_packager/runner_test.rb +225 -0
- data/test/rails_packager/util_test.rb +84 -0
- data/test/rails_packager_test.rb +7 -0
- data/test/support/util_helper.rb +20 -0
- data/test/test_helper.rb +22 -0
- metadata +279 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
exclude:
|
2
|
+
- log/**/*
|
3
|
+
name: packaged-0.0.1-SNAPSHOT
|
4
|
+
env:
|
5
|
+
EXAMPLE: first env var
|
6
|
+
EXAMPLE_2: second env var
|
7
|
+
before:
|
8
|
+
- echo this is before - @{name}
|
9
|
+
- echo this is also before
|
10
|
+
package: echo @{name}.tar.gz @{files}
|
11
|
+
after:
|
12
|
+
- echo this is after - @{name}
|
13
|
+
- echo this is also after @{files}
|
@@ -0,0 +1,224 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class IntegrationTest < ActiveSupport::TestCase
|
4
|
+
include RailsPackager::UtilHelper
|
5
|
+
teardown { close_runner }
|
6
|
+
|
7
|
+
test "execution path" do
|
8
|
+
runner = new_runner(config_file: config_file("execution-path.yml"), dir: DUMMY_RAILS_DIR)
|
9
|
+
|
10
|
+
out, err = capture_subprocess_io do
|
11
|
+
runner.execute
|
12
|
+
end
|
13
|
+
|
14
|
+
assert_equal strip_whitespace(<<-END), out
|
15
|
+
#{DUMMY_RAILS_DIR}
|
16
|
+
Packaging
|
17
|
+
END
|
18
|
+
assert_equal "", err
|
19
|
+
assert runner.successful?
|
20
|
+
end
|
21
|
+
|
22
|
+
test "simple integration" do
|
23
|
+
runner = new_runner(config_file: config_file("simple-integration.yml"), dir: DUMMY_RAILS_DIR)
|
24
|
+
|
25
|
+
out, err = capture_subprocess_io do
|
26
|
+
runner.execute
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_equal strip_whitespace(<<-END), out
|
30
|
+
Before one
|
31
|
+
Before two
|
32
|
+
Packaging
|
33
|
+
After one
|
34
|
+
After two
|
35
|
+
END
|
36
|
+
assert_equal "", err
|
37
|
+
assert runner.successful?
|
38
|
+
end
|
39
|
+
|
40
|
+
test "simple integration with verbose" do
|
41
|
+
runner = new_runner(config_file: config_file("simple-integration.yml"), dir: DUMMY_RAILS_DIR)
|
42
|
+
|
43
|
+
out, err = capture_subprocess_io do
|
44
|
+
runner.execute(verbose: true)
|
45
|
+
end
|
46
|
+
|
47
|
+
assert_equal strip_whitespace(<<-END), out
|
48
|
+
$ echo Before one
|
49
|
+
Before one
|
50
|
+
$ echo Before two
|
51
|
+
Before two
|
52
|
+
$ echo Packaging
|
53
|
+
Packaging
|
54
|
+
$ echo After one
|
55
|
+
After one
|
56
|
+
$ echo After two
|
57
|
+
After two
|
58
|
+
END
|
59
|
+
assert_equal "", err
|
60
|
+
assert runner.successful?
|
61
|
+
end
|
62
|
+
|
63
|
+
test "integration from rails project" do
|
64
|
+
out, err = capture_subprocess_io do
|
65
|
+
system "cd '#{DUMMY_RAILS_DIR}' && rake package"
|
66
|
+
end
|
67
|
+
|
68
|
+
status = $?
|
69
|
+
|
70
|
+
assert_equal strip_whitespace(<<-END), out
|
71
|
+
Before one
|
72
|
+
Before two
|
73
|
+
Packaging dummy
|
74
|
+
After one
|
75
|
+
After two
|
76
|
+
END
|
77
|
+
assert_equal "", err
|
78
|
+
assert status.success?
|
79
|
+
end
|
80
|
+
|
81
|
+
test "debug with rake task" do
|
82
|
+
out, err = capture_subprocess_io do
|
83
|
+
system "cd '#{DUMMY_RAILS_DIR}' && rake package verbose=true"
|
84
|
+
end
|
85
|
+
|
86
|
+
status = $?
|
87
|
+
|
88
|
+
assert_equal strip_whitespace(<<-END), out
|
89
|
+
$ echo Before one
|
90
|
+
Before one
|
91
|
+
$ echo Before two
|
92
|
+
Before two
|
93
|
+
$ echo Packaging dummy
|
94
|
+
Packaging dummy
|
95
|
+
$ echo After one
|
96
|
+
After one
|
97
|
+
$ echo After two
|
98
|
+
After two
|
99
|
+
END
|
100
|
+
assert_equal "", err
|
101
|
+
assert status.success?
|
102
|
+
end
|
103
|
+
|
104
|
+
test "change name with rake task" do
|
105
|
+
out, err = capture_subprocess_io do
|
106
|
+
system "cd '#{DUMMY_RAILS_DIR}' && rake package[customized-1.0.0]"
|
107
|
+
end
|
108
|
+
|
109
|
+
status = $?
|
110
|
+
|
111
|
+
assert_equal strip_whitespace(<<-END), out
|
112
|
+
Before one
|
113
|
+
Before two
|
114
|
+
Packaging customized-1.0.0
|
115
|
+
After one
|
116
|
+
After two
|
117
|
+
END
|
118
|
+
assert_equal "", err
|
119
|
+
assert status.success?
|
120
|
+
end
|
121
|
+
|
122
|
+
test "integration from rails project with program form" do
|
123
|
+
out, err = capture_subprocess_io do
|
124
|
+
system "cd '#{DUMMY_RAILS_DIR}' && rails_package"
|
125
|
+
end
|
126
|
+
|
127
|
+
status = $?
|
128
|
+
|
129
|
+
assert_equal strip_whitespace(<<-END), out
|
130
|
+
Before one
|
131
|
+
Before two
|
132
|
+
Packaging dummy
|
133
|
+
After one
|
134
|
+
After two
|
135
|
+
END
|
136
|
+
assert_equal "", err
|
137
|
+
assert status.success?
|
138
|
+
end
|
139
|
+
|
140
|
+
test "program form with debug output" do
|
141
|
+
out, err = capture_subprocess_io do
|
142
|
+
system "cd '#{DUMMY_RAILS_DIR}' && rails_package -v"
|
143
|
+
end
|
144
|
+
|
145
|
+
status = $?
|
146
|
+
|
147
|
+
assert_equal strip_whitespace(<<-END), out
|
148
|
+
$ echo Before one
|
149
|
+
Before one
|
150
|
+
$ echo Before two
|
151
|
+
Before two
|
152
|
+
$ echo Packaging dummy
|
153
|
+
Packaging dummy
|
154
|
+
$ echo After one
|
155
|
+
After one
|
156
|
+
$ echo After two
|
157
|
+
After two
|
158
|
+
END
|
159
|
+
assert_equal "", err
|
160
|
+
assert status.success?
|
161
|
+
end
|
162
|
+
|
163
|
+
test "program form with customized name output" do
|
164
|
+
out, err = capture_subprocess_io do
|
165
|
+
system "cd '#{DUMMY_RAILS_DIR}' && rails_package --name customized-1.0.0"
|
166
|
+
end
|
167
|
+
|
168
|
+
status = $?
|
169
|
+
|
170
|
+
assert_equal strip_whitespace(<<-END), out
|
171
|
+
Before one
|
172
|
+
Before two
|
173
|
+
Packaging customized-1.0.0
|
174
|
+
After one
|
175
|
+
After two
|
176
|
+
END
|
177
|
+
assert_equal "", err
|
178
|
+
assert status.success?
|
179
|
+
end
|
180
|
+
|
181
|
+
test "failure integration" do
|
182
|
+
runner = new_runner(config_file: config_file("failure-integration.yml"), dir: DUMMY_RAILS_DIR)
|
183
|
+
|
184
|
+
out, err = capture_subprocess_io do
|
185
|
+
runner.execute
|
186
|
+
end
|
187
|
+
|
188
|
+
failed_command = runner.commands[1]
|
189
|
+
|
190
|
+
assert_equal strip_whitespace(<<-END), out
|
191
|
+
Before one
|
192
|
+
END
|
193
|
+
assert_equal strip_whitespace(<<-END), err
|
194
|
+
ERROR: 'false' returned error code: #{failed_command.exit_code}
|
195
|
+
END
|
196
|
+
|
197
|
+
assert_kind_of Integer, failed_command.exit_code
|
198
|
+
refute_equal 0, failed_command.exit_code
|
199
|
+
refute runner.successful?
|
200
|
+
end
|
201
|
+
|
202
|
+
test "failure integration with verbose" do
|
203
|
+
runner = new_runner(config_file: config_file("failure-integration.yml"), dir: DUMMY_RAILS_DIR)
|
204
|
+
|
205
|
+
out, err = capture_subprocess_io do
|
206
|
+
runner.execute(verbose: true)
|
207
|
+
end
|
208
|
+
|
209
|
+
failed_command = runner.commands[1]
|
210
|
+
|
211
|
+
assert_equal strip_whitespace(<<-END), out
|
212
|
+
$ echo Before one
|
213
|
+
Before one
|
214
|
+
$ false
|
215
|
+
END
|
216
|
+
assert_equal strip_whitespace(<<-END), err
|
217
|
+
ERROR: 'false' returned error code: #{failed_command.exit_code}
|
218
|
+
END
|
219
|
+
|
220
|
+
assert_kind_of Integer, failed_command.exit_code
|
221
|
+
refute_equal 0, failed_command.exit_code
|
222
|
+
refute runner.successful?
|
223
|
+
end
|
224
|
+
end
|