scalarium_cli 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,17 +10,15 @@ Allows you to deploy apps hosted on Scalarium from the command line.
10
10
 
11
11
  ### Rails
12
12
 
13
- Add `scalarium.yml` in your config folder. It should look something like:
13
+ Run `sca setup`
14
14
 
15
- staging:
16
- email: test@test.com
17
- password: password
18
- slug: YYY
15
+ This will:
19
16
 
20
- production:
21
- email: test@test.com
22
- password: password
23
- slug: XXX
17
+ * Add config/scalarium.yml
18
+ * Add config/scalarium.yml.example
19
+ * Add config/scalarium.yml to you .gitignore
20
+
21
+ If any of the above already exist, it will skip the creation.
24
22
 
25
23
  You will find the slug of the application inside the URL:
26
24
 
@@ -15,8 +15,53 @@ module Scalarium
15
15
  EOF
16
16
  end
17
17
 
18
+ desc "setup", "Adds config/scalarium.yml to .gitignore and creates config/scalarium.yml and config/scalarium.yml.example"
19
+ def setup
20
+ # Add config/scalarium.yml to .gitignore
21
+ puts "Adding config/scalarium.yml to .gitignore"
22
+ File.open(".gitignore", "a+") do |file|
23
+ if File.read(".gitignore").match(/config\/scalarium\.yml/)
24
+ puts "\tLooks like you already have it. Moving on..."
25
+ else
26
+ file.write("\nconfig/scalarium.yml")
27
+ end
28
+ end
29
+
30
+ # Create config/scalarium.yml
31
+ puts "Creating config/scalarium.yml"
32
+ write_config_yml
33
+
34
+ # Create config/scalarium.yml.example
35
+ puts "Creating config/scalarium.yml.example"
36
+ write_config_yml(:example)
37
+ end
38
+
18
39
  private
19
40
 
41
+ def write_config_yml(type=nil)
42
+ filename = type ? "config/scalarium.yml.example" : "config/scalarium.yml"
43
+
44
+ if File.exists?(filename)
45
+ puts "\tLooks like you already have it. Moving on..."
46
+ else
47
+ File.open(filename, "w") do |file|
48
+ file.write <<-EOF
49
+ credentials: &CREDENTIALS
50
+ email: email@email.com
51
+ password: password
52
+
53
+ staging:
54
+ <<: *CREDENTIALS
55
+ slug: XXX
56
+
57
+ production:
58
+ <<: *CREDENTIALS
59
+ slug: XXX
60
+ EOF
61
+ end
62
+ end
63
+ end
64
+
20
65
  def run(command, env)
21
66
  application = Scalarium::Application.new
22
67
 
@@ -1,3 +1,3 @@
1
1
  module Scalarium
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Red Davis
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-30 00:00:00 +00:00
18
+ date: 2011-01-06 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency