scalarium_cli 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ examples/**
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --profile
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in scalarium.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ scalarium_cli (0.0.1)
5
+ mechanize (~> 1.0.0)
6
+ thor (~> 0.14.6)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ addressable (2.2.2)
12
+ crack (0.1.8)
13
+ diff-lcs (1.1.2)
14
+ mechanize (1.0.0)
15
+ nokogiri (>= 1.2.1)
16
+ nokogiri (1.4.4)
17
+ rspec (2.3.0)
18
+ rspec-core (~> 2.3.0)
19
+ rspec-expectations (~> 2.3.0)
20
+ rspec-mocks (~> 2.3.0)
21
+ rspec-core (2.3.1)
22
+ rspec-expectations (2.3.0)
23
+ diff-lcs (~> 1.1.2)
24
+ rspec-mocks (2.3.0)
25
+ thor (0.14.6)
26
+ webmock (1.6.1)
27
+ addressable (>= 2.2.2)
28
+ crack (>= 0.1.7)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ mechanize (~> 1.0.0)
35
+ rspec (~> 2.3.0)
36
+ scalarium_cli!
37
+ thor (~> 0.14.6)
38
+ webmock (~> 1.6.1)
39
+
40
+ METADATA
41
+ version: 1.0.6
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # Gem Name
2
+
3
+ Allows you to deploy apps hosted on Scalarium from the command line.
4
+
5
+ ## How To Install
6
+
7
+ sudo gem install scalarium_cli
8
+
9
+ ## Example
10
+
11
+ ### Rails
12
+
13
+ Add `scalarium.yml` in your config folder. It should look something like:
14
+
15
+ staging:
16
+ email: test@test.com
17
+ password: password
18
+ slug: YYY
19
+
20
+ production:
21
+ email: test@test.com
22
+ password: password
23
+ slug: XXX
24
+
25
+ You will find the slug of the application inside the URL:
26
+
27
+ ![slug](https://img.skitch.com/20101229-nygy9t86d85ea8gjw5133kxjbj.jpg)
28
+
29
+ Then from the Root directory, just run
30
+
31
+ sca deploy staging
32
+
33
+ Or to run migrations
34
+
35
+ sca deploy staging --migrate
36
+
37
+ ### Non Rails
38
+
39
+ By default the CLI will look at `./config/scalarium.yml` for the config.
40
+
41
+ If you wish to specify a different config file just type:
42
+
43
+ sca deploy staging --config="path/to/config.yml"
44
+
45
+ ## Note on Patches/Pull Requests
46
+
47
+ * Fork the project.
48
+ * Create a feature branch
49
+ * Make your feature addition or bug fix.
50
+ * Add tests.
51
+ * Commit, do not mess with RakeFile, version, or history.
52
+ * Send me a pull request.
53
+
54
+ ## Copyright
55
+
56
+ Copyright (c) 2010 Red Davis.
57
+
58
+ ## License
59
+
60
+ The MIT License
61
+
62
+ Permission is hereby granted, free of charge, to any person obtaining a copy
63
+ of this software and associated documentation files (the "Software"), to deal
64
+ in the Software without restriction, including without limitation the rights
65
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
66
+ copies of the Software, and to permit persons to whom the Software is
67
+ furnished to do so, subject to the following conditions:
68
+
69
+ The above copyright notice and this permission notice shall be included in
70
+ all copies or substantial portions of the Software.
71
+
72
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
73
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
74
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
75
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
76
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
77
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
78
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ desc "Run specs"
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default => :spec
data/bin/sca ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
3
+
4
+ require "rubygems"
5
+ require "scalarium"
6
+ require "scalarium/cli"
7
+
8
+ Scalarium::CLI.start
@@ -0,0 +1,36 @@
1
+ module Scalarium
2
+ class Application
3
+ attr_accessor :email, :password, :slug, :run_migrations
4
+
5
+ def deploy
6
+ login do
7
+ agent.get("https://manage.scalarium.com/applications/#{slug}/deployments/new") do |page|
8
+ form = page.forms.first
9
+ form["deployment[migrate]"] = 1 if run_migrations
10
+ form.click_button
11
+ end
12
+ end
13
+ end
14
+
15
+ def config
16
+ yield(self)
17
+ end
18
+
19
+ private
20
+
21
+ def login
22
+ agent.get("https://manage.scalarium.com/session/new") do |page|
23
+ manage_page = page.form_with(:action => "/session") do |f|
24
+ f["user[email]"] = email
25
+ f["user[password]"] = password
26
+ end.click_button
27
+
28
+ yield
29
+ end
30
+ end
31
+
32
+ def agent
33
+ @agent ||= Mechanize.new
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ require "thor"
2
+
3
+ module Scalarium
4
+ class CLI < Thor
5
+ desc "deploy [staging|production]", "deploy to specified env"
6
+ method_options :migrate => :boolean, :config => :string
7
+ def deploy(env="production")
8
+ application = Scalarium::Application.new
9
+
10
+ application.config do |x|
11
+ x.email = config[env]["email"]
12
+ x.password = config[env]["password"]
13
+ x.slug = config[env]["slug"]
14
+ x.run_migrations = options.migrate?
15
+ end
16
+
17
+ application.deploy
18
+ end
19
+
20
+ private
21
+
22
+ def config
23
+ @config ||= begin
24
+ config_path = options[:config] || "config/scalarium.yml"
25
+
26
+ YAML.load_file(config_path)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module Scalarium
2
+ VERSION = "0.0.1"
3
+ end
data/lib/scalarium.rb ADDED
@@ -0,0 +1,10 @@
1
+ $:.unshift(File.expand_path("../", __FILE__))
2
+
3
+ # Gems
4
+ require "mechanize"
5
+
6
+ # Local files
7
+ require "scalarium/application"
8
+
9
+ module Scalarium
10
+ end
data/scalarium.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "scalarium/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "scalarium_cli"
7
+ s.version = Scalarium::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Red Davis"]
10
+ s.email = ["red@railslove.com"]
11
+ s.homepage = "https://github.com/railslove/Scalarium-CLI"
12
+ s.summary = %q{Allows you to deploy apps hosted on Scalarium from the command line}
13
+ s.description = %q{Allows you to deploy apps hosted on Scalarium from the command line}
14
+
15
+ s.rubyforge_project = "scalarium_cli"
16
+
17
+ s.add_dependency "mechanize", "~> 1.0.0"
18
+ s.add_dependency "thor", "~> 0.14.6"
19
+
20
+ s.add_development_dependency "rspec", "~> 2.3.0"
21
+ s.add_development_dependency "webmock", "~> 1.6.1"
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+ end
@@ -0,0 +1,291 @@
1
+
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
8
+ <link rel="icon" href="/images/favicon.png" type="image/png" />
9
+ <title> New Deployment for Application railslove
10
+ </title>
11
+ <link href="/stylesheets/layout.css?1292617034" media="screen" rel="stylesheet" type="text/css" />
12
+ <link href="/stylesheets/facebox.css?1292617034" media="screen" rel="stylesheet" type="text/css" />
13
+ <script src="/javascripts/jquery/jquery.min.js?1292617034" type="text/javascript"></script>
14
+ <script src="/javascripts/jquery/jquery-ui-1.7.2.custom.min.js?1292617034" type="text/javascript"></script>
15
+ <script src="/javascripts/jquery/jquery.bgiframe.min.js?1292617034" type="text/javascript"></script>
16
+ <script src="/javascripts/superfish/superfish.js?1292617034" type="text/javascript"></script>
17
+ <script src="/javascripts/superfish/supersubs.js?1292617034" type="text/javascript"></script>
18
+ <script src="/javascripts/application.js?1292617034" type="text/javascript"></script>
19
+ <script src="/javascripts/jquery/jquery.tipTip-mod.js?1292617034" type="text/javascript"></script>
20
+ <script src="/javascripts/jquery/jquery.easing.1.3.js?1292617034" type="text/javascript"></script>
21
+ <script src="/javascripts/jquery/jquery.sparkline.js?1292617034" type="text/javascript"></script>
22
+ <script src="/javascripts/jquery/jquery.color.js?1292617034" type="text/javascript"></script>
23
+ <script src="/javascripts/jquery/jquery.flot_patch.js?1292617034" type="text/javascript"></script>
24
+ <script src="/javascripts/jquery/jquery.flot.selection.min.js?1292617034" type="text/javascript"></script>
25
+ <script src="/javascripts/jquery/jquery.flot.stack.min.js?1292617034" type="text/javascript"></script>
26
+
27
+ <script type="text/javascript">
28
+ $(document).ready(function(){
29
+ Scalarium.initMenus();
30
+
31
+ $("ul.sf-menu .sf-right a").live("click", function(){
32
+ $(this).parents("ul.sf-menu").hideSuperfishUl();
33
+ });
34
+
35
+ });
36
+
37
+ var $scalarium = {
38
+ instanceRefreshInterval: 10000,
39
+ logLoadingTimeout: 15000,
40
+ debug: false
41
+ };
42
+ </script>
43
+
44
+ <script type="text/javascript">
45
+ var host = document.location.host;
46
+ if (host == 'manage.scalarium.com') {
47
+ var _gaq = _gaq || [];
48
+ _gaq.push(['_setAccount', 'UA-6003901-5']);
49
+ _gaq.push(['_setDomainName', host]);
50
+ _gaq.push(['_trackPageview']);
51
+
52
+ (function() {
53
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
54
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
55
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
56
+ })();
57
+ }
58
+ </script>
59
+ </head>
60
+
61
+ <body>
62
+
63
+ <div id="page">
64
+ <div id="center">
65
+ <a href="/" style="height:80px; width:120px; display:block; position:absolute; outline: none;" title="Home"></a>
66
+ <div id="header">
67
+ <ul class="horizontal-menu">
68
+ <li>
69
+ <a href="/users/7fe7e51f77da9bce74e9f5adaa9f21c0/login_settings">Settings</a>
70
+ </li>
71
+ <li><a href="#" id="feedback">Support</a></li>
72
+ <li><a href="http://support.scalarium.com/faqs" target="_blank">FAQ</a></li>
73
+ <li><a href="/logout">Logout (Red Davis)</a></li>
74
+ </ul>
75
+ </div>
76
+
77
+ <div id="nav">
78
+ <ul class="sf-menu">
79
+ <li>
80
+ <a href="/clouds" class="">Clouds</a>
81
+ <ul>
82
+ </ul>
83
+ </li>
84
+ <li>
85
+ <a href="/applications" class="active">Applications</a>
86
+ <ul>
87
+
88
+ </ul>
89
+ </li>
90
+ <li><a href="/events" class="">Events</a></li>
91
+ <li><a href="http://www.scalarium.com/blog" target="_blank">Blog</a></li>
92
+ </ul>
93
+ <span style="float: right">
94
+ <a href="/"><img alt="Zeppelin" height="75" id="zeppelin" longdesc="/images/zeppelin.png" src="/images/zeppelin.png?1292617034" width="150" /></a>
95
+ </span>
96
+ </div>
97
+
98
+ <div id="content">
99
+
100
+
101
+ <div class="row">
102
+ <div class="snd-nav">
103
+ <h2 class="grey"><a href="/clouds/asd">Railslove</a>: </h2>
104
+ <h2 class="grey"><a href="/applications/railslove">railslove</a>: </h2>
105
+ <h2>New Deployment</h2>
106
+ </div>
107
+ <div class="column width_12 no-padding">
108
+
109
+
110
+
111
+ <div class="flashnotice" style="display:none" id="notice_if_no_instances_selected">
112
+ Please select at least one instance to deploy to.
113
+ </div>
114
+ </div>
115
+
116
+ <form action="/applications/railslove/deployments" class="new_deployment" id="new_deployment" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="KhQg/0sbvK2LsGV1cvIjeEOB+TxFsRGsIa6naLrJ5z8=" /></div> <input id="deployment_instances_to_deploy_for_html" name="deployment[instances_to_deploy_for_html]" type="hidden" value="asd" />
117
+ <input id="deployment_instances_to_skip_for_html" name="deployment[instances_to_skip_for_html]" type="hidden" value="" />
118
+ <div class="column width_6">
119
+ <div class="table2">
120
+ <table>
121
+ <colgroup>
122
+ <col width="155"/>
123
+ <col width="309"/>
124
+ </colgroup>
125
+ <thead>
126
+ <tr>
127
+ <th colspan="2">Options</th>
128
+ </tr>
129
+ </thead>
130
+ <tbody>
131
+ <tr>
132
+ <td style="border-bottom:#FFF;">
133
+ <label for="deployment_command">Command</label>
134
+ </td>
135
+ <td style="border-bottom:#FFF;">
136
+ <select id="deployment_command" name="deployment[command]"><option value="deploy">deploy</option>
137
+ <option value="rollback">rollback</option>
138
+ <option value="start">start</option>
139
+ <option value="stop">stop</option>
140
+ <option value="restart">restart</option>
141
+ <option value="undeploy">undeploy</option></select>
142
+ </td>
143
+ </tr>
144
+ <tr>
145
+ <td></td>
146
+ <td id="deploy_command_helper" class="helper"></td>
147
+ </tr>
148
+ <tr>
149
+ <td>
150
+ <label for="deployment_comment">Comment</label>
151
+ </td>
152
+ <td>
153
+ <textarea cols="40" id="deployment_comment" name="deployment[comment]" rows="5"></textarea>
154
+ </td>
155
+ </tr>
156
+ <tr>
157
+ <td>
158
+ <label for="deployment_migrate">Migrate Database</label>
159
+ </td>
160
+ <td>
161
+ <input name="deployment[migrate]" type="hidden" value="0" /><input id="deployment_migrate" name="deployment[migrate]" type="checkbox" value="1" />
162
+ </td>
163
+ </tr>
164
+ <tr>
165
+ <td>
166
+ <label for="deployment_shift_between_restarts">Shift between restarts</label>
167
+ </td>
168
+ <td>
169
+ <input class="align-right inline" id="deployment_shift_between_restarts" name="deployment[shift_between_restarts]" size="30" style="width: 24px;" type="text" value="0" /> seconds
170
+ </td>
171
+ </tr>
172
+ </tbody>
173
+ </table>
174
+ </div>
175
+ </div>
176
+
177
+ <div class="column width_6">
178
+ <div class="table2" id="choose_instances_to_deploy">
179
+ <table>
180
+ <colgroup>
181
+ <col width="155"/>
182
+ <col width="309"/>
183
+ </colgroup>
184
+ <thead>
185
+ <tr>
186
+ <th>Roles</th>
187
+ <th>Instances</th>
188
+ </tr>
189
+ </thead>
190
+ <tbody>
191
+ <tr>
192
+
193
+ <span class="status_preview deploy_switch_instance green_status" data-instance-id="Railslove" title="webtwo - Large - online"></span>
194
+ </td>
195
+ </tr>
196
+ <tr>
197
+ <td style="border-bottom: none;"></td>
198
+ <td style="border-bottom: none;" class="helper">
199
+ You can exclude individual instances and entire roles from a deployment simply by (de-)selecting them.
200
+ </td>
201
+ </tr>
202
+ </tbody>
203
+ </table>
204
+ </div>
205
+ </div>
206
+ <hr/>
207
+ <input name="commit" type="submit" value="Run" />
208
+ <input class="link_button greybutton" type="submit" value="Cancel" name="Cancel" data-target="/applications/railslove" />
209
+ <noscript><a href="/applications/railslove">Cancel</a></noscript>
210
+
211
+ </form></div>
212
+
213
+
214
+ <script src="/javascripts/deployments.js?1292617034" type="text/javascript"></script>
215
+ <script type="text/javascript">
216
+ $('.deploy_switch_instance').live('click', function(event) {
217
+ event.preventDefault();
218
+ var instanceId = $(this).attr("data-instance-id");
219
+ ScalariumDeployment.switchInstances(instanceId);
220
+ ScalariumDeployment.countInstances();
221
+ });
222
+
223
+ $('.deploy_switch_role').live('click', function(event) {
224
+ event.preventDefault();
225
+ var role = $(this);
226
+ var roleInstances = $(role.next()).children('.deploy_switch_instance');
227
+ var firstInstance = roleInstances[0]
228
+
229
+ if ( firstInstance ){
230
+ if ( ScalariumDeployment.switchedOn(firstInstance) ) {
231
+
232
+ $.each(roleInstances, function(index, instance) {
233
+ var instanceId = $(instance).attr("data-instance-id");
234
+ ScalariumDeployment.switchOffInstance(instanceId);
235
+ });
236
+
237
+ } else {
238
+ $.each(roleInstances, function(index, instance) {
239
+ var instanceId = $(instance).attr("data-instance-id");
240
+ ScalariumDeployment.switchOnInstance(instanceId);
241
+ });
242
+ }
243
+ }
244
+
245
+ ScalariumDeployment.countInstances();
246
+ });
247
+
248
+ $('#deployment_command').change(function() {
249
+ update_deploy_command_helper();
250
+ });
251
+
252
+ function update_deploy_command_helper(){
253
+ var command = $('#deployment_command').val();
254
+ $('#deploy_command_helper').html(ScalariumDeployment.commandDescriptions[command])
255
+ };
256
+ update_deploy_command_helper();
257
+
258
+ </script>
259
+
260
+
261
+ </div>
262
+ <div id="push"></div>
263
+ </div>
264
+ </div>
265
+
266
+
267
+
268
+ <div id="footer">
269
+ <div>
270
+ <ul class="horizontal-menu">
271
+ <li style="margin-top:0px;"><a href="http://www.peritor.com"><img alt="Peritor Logo" height="40" longdesc="/images/logo-peritor.png" src="/images/logo-peritor.png?1292617034" width="115" /></a></li>
272
+ <li><a href="http://www.scalarium.com/blog">Blog</a></li>
273
+ <li><a href="http://support.scalarium.com">Support</a></li>
274
+ <li><a href="http://www.peritor.com/de/contact/index.html">Contact</a></li>
275
+ <li><a href="http://twitter.com/scalarium">Twitter</a></li>
276
+ <li><a href="http://www.peritor.com/de/shared/legal.html">Imprint</a></li>
277
+ <li><a href="http://www.peritor.com/de/shared/legal.html">Legal</a></li>
278
+ </ul>
279
+ </div>
280
+ </div>
281
+
282
+ <script type="text/javascript" charset="utf-8">
283
+ Tender = {
284
+ hideToggle: true,
285
+ widgetToggles: $('#feedback')
286
+ };
287
+ </script>
288
+ <script src="https://scalarium.tenderapp.com/tender_widget.js" type="text/javascript"></script>
289
+
290
+ </body>
291
+ </html>
@@ -0,0 +1,149 @@
1
+
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
8
+ <link rel="icon" href="/images/favicon.png" type="image/png" />
9
+ <title>Scalarium Login</title>
10
+ <link href="/stylesheets/layout.css?1291053194" media="screen" rel="stylesheet" type="text/css" />
11
+ <link href="/stylesheets/facebox.css?1291053194" media="screen" rel="stylesheet" type="text/css" />
12
+ <script src="/javascripts/jquery/jquery.min.js?1291053194" type="text/javascript"></script>
13
+ <script src="/javascripts/jquery/jquery-ui-1.7.2.custom.min.js?1291053194" type="text/javascript"></script>
14
+ <script src="/javascripts/jquery/jquery.bgiframe.min.js?1291053194" type="text/javascript"></script>
15
+ <script src="/javascripts/superfish/superfish.js?1291053194" type="text/javascript"></script>
16
+ <script src="/javascripts/superfish/supersubs.js?1291053194" type="text/javascript"></script>
17
+ <script src="/javascripts/application.js?1291053194" type="text/javascript"></script>
18
+ <script src="/javascripts/jquery/jquery.tipTip-mod.js?1291053194" type="text/javascript"></script>
19
+ <script src="/javascripts/jquery/jquery.easing.1.3.js?1291053194" type="text/javascript"></script>
20
+ <script src="/javascripts/jquery/jquery.sparkline.js?1291053194" type="text/javascript"></script>
21
+ <script src="/javascripts/jquery/jquery.color.js?1291053194" type="text/javascript"></script>
22
+ <script src="/javascripts/jquery/jquery.flot_patch.js?1291053194" type="text/javascript"></script>
23
+ <script src="/javascripts/jquery/jquery.flot.selection.min.js?1291053194" type="text/javascript"></script>
24
+ <script src="/javascripts/jquery/jquery.flot.stack.min.js?1291053194" type="text/javascript"></script>
25
+
26
+ <script type="text/javascript">
27
+ $(document).ready(function(){
28
+ Scalarium.initMenus();
29
+
30
+ $("ul.sf-menu .sf-right a").live("click", function(){
31
+ $(this).parents("ul.sf-menu").hideSuperfishUl();
32
+ });
33
+
34
+ });
35
+
36
+ var $scalarium = {
37
+ instanceRefreshInterval: 10000,
38
+ logLoadingTimeout: 15000,
39
+ debug: false
40
+ };
41
+ </script>
42
+
43
+ <script type="text/javascript">
44
+ var host = document.location.host;
45
+ if (host == 'manage.scalarium.com') {
46
+ var _gaq = _gaq || [];
47
+ _gaq.push(['_setAccount', 'UA-6003901-5']);
48
+ _gaq.push(['_setDomainName', host]);
49
+ _gaq.push(['_trackPageview']);
50
+
51
+ (function() {
52
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
53
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
54
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
55
+ })();
56
+ }
57
+ </script>
58
+ </head>
59
+
60
+ <body>
61
+
62
+ <div id="page">
63
+ <div id="center">
64
+ <a href="/" style="height:80px; width:120px; display:block; position:absolute; outline: none;" title="Home"></a>
65
+ <div id="header">
66
+ <ul class="horizontal-menu">
67
+ <li><a href="#" id="feedback">Support</a></li>
68
+ <li><a href="http://support.scalarium.com/faqs" target="_blank">FAQ</a></li>
69
+ <li><a href="/login">Login</a></li>
70
+ </ul>
71
+ </div>
72
+
73
+ <div id="nav">
74
+ <ul class="sf-menu">
75
+ </ul>
76
+ <span style="float: right">
77
+ <a href="/"><img alt="Zeppelin" height="75" id="zeppelin" longdesc="/images/zeppelin.png" src="/images/zeppelin.png?1291053194" width="150" /></a>
78
+ </span>
79
+ </div>
80
+
81
+ <div id="content">
82
+
83
+
84
+ <div class="row">
85
+ <form action="/session" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="QVlCYGRzSoYF2govWqvwjP1Ac8kIZQTfgJFImWdssQY=" /></div>
86
+ <div class="column width_4">
87
+ <h2>Login</h2>
88
+ <fieldset>
89
+ <label for="user_email">Email</label>
90
+ <input id="user_email" name="user[email]" size="30" tabindex="1" type="text" />
91
+ <label for="user_password">Password <span style="color:#999999"> - </span><a href="/password_resets/new" style="color:#999999">Forgot Password?</a></label>
92
+ <input id="user_password" name="user[password]" size="30" tabindex="2" type="password" />
93
+ </fieldset>
94
+ </div>
95
+
96
+ <div class="column width_8">
97
+ <h2>Sign up</h2>
98
+ <p>If you don't have an account yet, <a href="/users/new" class="strong">sign up now</a>.</p>
99
+ <p>A valid <a href="http://www.amazon.com/gp/aws/registration/registration-form.html" class="strong">Amazon Web Services account</a> is required. Make sure it's enabled for use with EC2.</p>
100
+ <p>To learn more about Scalarium, <a href="http://www.scalarium.com/tour" class="text-link">check out our screencasts</a>.
101
+ </div>
102
+
103
+ <div class="column width_4 clear">
104
+ <hr/>
105
+ <input name="commit" type="submit" value="Login" />
106
+ </div>
107
+
108
+ <div class="column width_8">
109
+ <hr/>
110
+ <input class="link_button " type="submit" value="Sign up" name="Sign up" data-target="/account/new" />
111
+ <noscript><a href="/account/new">Sign up</a></noscript>
112
+
113
+ </div>
114
+
115
+ </form></div>
116
+
117
+
118
+
119
+ </div>
120
+ <div id="push"></div>
121
+ </div>
122
+ </div>
123
+
124
+
125
+
126
+ <div id="footer">
127
+ <div>
128
+ <ul class="horizontal-menu">
129
+ <li style="margin-top:0px;"><a href="http://www.peritor.com"><img alt="Peritor Logo" height="40" longdesc="/images/logo-peritor.png" src="/images/logo-peritor.png?1291053194" width="115" /></a></li>
130
+ <li><a href="http://www.scalarium.com/blog">Blog</a></li>
131
+ <li><a href="http://support.scalarium.com">Support</a></li>
132
+ <li><a href="http://www.peritor.com/de/contact/index.html">Contact</a></li>
133
+ <li><a href="http://twitter.com/scalarium">Twitter</a></li>
134
+ <li><a href="http://www.peritor.com/de/shared/legal.html">Imprint</a></li>
135
+ <li><a href="http://www.peritor.com/de/shared/legal.html">Legal</a></li>
136
+ </ul>
137
+ </div>
138
+ </div>
139
+
140
+ <script type="text/javascript" charset="utf-8">
141
+ Tender = {
142
+ hideToggle: true,
143
+ widgetToggles: $('#feedback')
144
+ };
145
+ </script>
146
+ <script src="https://scalarium.tenderapp.com/tender_widget.js" type="text/javascript"></script>
147
+
148
+ </body>
149
+ </html>
@@ -0,0 +1,75 @@
1
+ require "spec_helper"
2
+
3
+ describe Scalarium::Application do
4
+ describe "Configuring an application" do
5
+ before(:all) do
6
+ @application = Scalarium::Application.new
7
+ @application.config do |c|
8
+ c.email = "test@email.com"
9
+ c.password = "password"
10
+ c.slug = "railslove"
11
+ end
12
+ end
13
+
14
+ subject { @application }
15
+
16
+ its(:email) { should eql("test@email.com") }
17
+ its(:password) { should eql("password") }
18
+ its(:slug) { should eql("railslove") }
19
+ end
20
+
21
+ describe "Deploying an application" do
22
+ before do
23
+ stub_request(:any, /scalarium/)
24
+
25
+ @application = Scalarium::Application.new
26
+
27
+ # WebMock stubs
28
+ stub_request(:get, "https://manage.scalarium.com/session/new").
29
+ to_return(:body => fixture("session_new.html"),
30
+ :headers => {"Content-Type" => "text/html"})
31
+
32
+ stub_request(:post, "https://manage.scalarium.com/session")
33
+
34
+ stub_request(:get, "https://manage.scalarium.com/applications/railslove/deployments/new").
35
+ to_return(:body => fixture("new_deploy.html"),
36
+ :headers => {"Content-Type" => "text/html"})
37
+ end
38
+
39
+ context "when basic deploy" do
40
+ before do
41
+ @application.config do |c|
42
+ c.email = "test@email.com"
43
+ c.password = "password"
44
+ c.slug = "railslove"
45
+ end
46
+
47
+ @application.deploy
48
+ end
49
+
50
+ subject { WebMock::API }
51
+
52
+ it { should have_requested(:get, "https://manage.scalarium.com/session/new") }
53
+ it { should have_requested(:get, "https://manage.scalarium.com/applications/railslove/deployments/new") }
54
+ it { should have_requested(:post, "https://manage.scalarium.com/applications/railslove/deployments") }
55
+ end
56
+
57
+ context "when deploying with a migration" do
58
+ before do
59
+ @application.config do |c|
60
+ c.email = "test@email.com"
61
+ c.password = "password"
62
+ c.slug = "railslove"
63
+ c.run_migrations = true
64
+ end
65
+
66
+ @application.deploy
67
+ end
68
+
69
+ subject { WebMock::API }
70
+
71
+ it { should have_requested(:post, "https://manage.scalarium.com/applications/railslove/deployments").
72
+ with {|req| req.body.match(/migrate%5D=1/) } }
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,18 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require "scalarium"
5
+ require "rspec"
6
+ require "webmock/rspec"
7
+
8
+ def fixture(file_name)
9
+ File.read(fixture_path(file_name))
10
+ end
11
+
12
+ def fixture_path(file_name)
13
+ File.expand_path(File.dirname(__FILE__)) + "/fixtures/#{file_name}"
14
+ end
15
+
16
+ RSpec.configure do |config|
17
+ config.include(WebMock::API)
18
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scalarium_cli
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Red Davis
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-29 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: mechanize
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 0
34
+ version: 1.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: thor
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 43
46
+ segments:
47
+ - 0
48
+ - 14
49
+ - 6
50
+ version: 0.14.6
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 2
64
+ - 3
65
+ - 0
66
+ version: 2.3.0
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 13
78
+ segments:
79
+ - 1
80
+ - 6
81
+ - 1
82
+ version: 1.6.1
83
+ type: :development
84
+ version_requirements: *id004
85
+ description: Allows you to deploy apps hosted on Scalarium from the command line
86
+ email:
87
+ - red@railslove.com
88
+ executables:
89
+ - sca
90
+ extensions: []
91
+
92
+ extra_rdoc_files: []
93
+
94
+ files:
95
+ - .gitignore
96
+ - .rspec
97
+ - Gemfile
98
+ - Gemfile.lock
99
+ - README.md
100
+ - Rakefile
101
+ - bin/sca
102
+ - lib/scalarium.rb
103
+ - lib/scalarium/application.rb
104
+ - lib/scalarium/cli.rb
105
+ - lib/scalarium/version.rb
106
+ - scalarium.gemspec
107
+ - spec/fixtures/new_deploy.html
108
+ - spec/fixtures/session_new.html
109
+ - spec/scalarium/application_spec.rb
110
+ - spec/spec_helper.rb
111
+ has_rdoc: true
112
+ homepage: https://github.com/railslove/Scalarium-CLI
113
+ licenses: []
114
+
115
+ post_install_message:
116
+ rdoc_options: []
117
+
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ requirements: []
139
+
140
+ rubyforge_project: scalarium_cli
141
+ rubygems_version: 1.3.7
142
+ signing_key:
143
+ specification_version: 3
144
+ summary: Allows you to deploy apps hosted on Scalarium from the command line
145
+ test_files:
146
+ - spec/fixtures/new_deploy.html
147
+ - spec/fixtures/session_new.html
148
+ - spec/scalarium/application_spec.rb
149
+ - spec/spec_helper.rb