scalarium_cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -30,10 +30,16 @@ Then from the Root directory, just run
30
30
 
31
31
  sca deploy staging
32
32
 
33
- Or to run migrations
33
+ #### Other options
34
+
35
+ Run migrations
34
36
 
35
37
  sca deploy staging --migrate
36
38
 
39
+ Add a comment
40
+
41
+ sca deploy staging --comment="This is an awesome deploy!"
42
+
37
43
  ### Non Rails
38
44
 
39
45
  By default the CLI will look at `./config/scalarium.yml` for the config.
@@ -1,12 +1,13 @@
1
1
  module Scalarium
2
2
  class Application
3
- attr_accessor :email, :password, :slug, :run_migrations
3
+ attr_accessor :email, :password, :slug
4
4
 
5
- def deploy
5
+ def deploy(options={})
6
6
  login do
7
7
  agent.get("https://manage.scalarium.com/applications/#{slug}/deployments/new") do |page|
8
8
  form = page.forms.first
9
- form["deployment[migrate]"] = 1 if run_migrations
9
+ form["deployment[migrate]"] = 1 if options[:run_migrations]
10
+ form["deployment[comment]"] = options[:comment]
10
11
  form.click_button
11
12
  end
12
13
  end
data/lib/scalarium/cli.rb CHANGED
@@ -3,7 +3,10 @@ require "thor"
3
3
  module Scalarium
4
4
  class CLI < Thor
5
5
  desc "deploy [staging|production]", "deploy to specified env"
6
- method_options :migrate => :boolean, :config => :string
6
+ method_options :migrate => :boolean,
7
+ :config => :string,
8
+ :comment => :string
9
+
7
10
  def deploy(env="production")
8
11
  application = Scalarium::Application.new
9
12
 
@@ -11,10 +14,12 @@ module Scalarium
11
14
  x.email = config[env]["email"]
12
15
  x.password = config[env]["password"]
13
16
  x.slug = config[env]["slug"]
14
- x.run_migrations = options.migrate?
15
17
  end
16
18
 
17
- application.deploy
19
+ application.deploy(
20
+ :run_migrations => options.migrate?,
21
+ :comment => options[:comment]
22
+ )
18
23
  end
19
24
 
20
25
  private
@@ -1,3 +1,3 @@
1
1
  module Scalarium
2
- VERSION = "0.0.1"
3
- end
2
+ VERSION = "0.0.2"
3
+ end
@@ -60,10 +60,9 @@ describe Scalarium::Application do
60
60
  c.email = "test@email.com"
61
61
  c.password = "password"
62
62
  c.slug = "railslove"
63
- c.run_migrations = true
64
63
  end
65
64
 
66
- @application.deploy
65
+ @application.deploy(:run_migrations => true)
67
66
  end
68
67
 
69
68
  subject { WebMock::API }
@@ -71,5 +70,22 @@ describe Scalarium::Application do
71
70
  it { should have_requested(:post, "https://manage.scalarium.com/applications/railslove/deployments").
72
71
  with {|req| req.body.match(/migrate%5D=1/) } }
73
72
  end
73
+
74
+ context "when deploying with a comment" do
75
+ before do
76
+ @application.config do |c|
77
+ c.email = "test@email.com"
78
+ c.password = "password"
79
+ c.slug = "railslove"
80
+ end
81
+
82
+ @application.deploy(:comment => "Hello")
83
+ end
84
+
85
+ subject { WebMock::API }
86
+
87
+ it { should have_requested(:post, "https://manage.scalarium.com/applications/railslove/deployments").
88
+ with {|req| req.body.match(/comment%5D=Hello/) } }
89
+ end
74
90
  end
75
91
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalarium_cli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Red Davis