ymdp 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/ymdp/compiler/compiler.rb +278 -0
- data/lib/ymdp/compiler/template.rb +314 -0
- data/lib/ymdp/configuration/config.rb +104 -0
- data/lib/ymdp/configuration/constants.rb +5 -0
- data/lib/ymdp/processor/compressor.rb +4 -9
- data/lib/ymdp/processor/validator.rb +2 -12
- data/lib/ymdp/support/git_helper.rb +23 -0
- data/lib/ymdp/tasks/ymdp.rake +16 -16
- data/lib/ymdp/translator/base.rb +1 -1
- data/lib/ymdp/ymdp.rb +2 -4
- data/lib/ymdp.rb +5 -4
- data/spec/configuration_spec.rb +39 -0
- data/spec/data/config/config.yml +1 -0
- data/spec/data/config/constants.rb +4 -2
- data/spec/spec_helper.rb +6 -3
- data/spec/translator_spec.rb +0 -3
- data/ymdp.gemspec +14 -10
- metadata +19 -8
- data/lib/ymdp/compiler/template_compiler.rb +0 -432
- data/lib/ymdp/config.rb +0 -69
- data/lib/ymdp/deploy/ymdt.rb +0 -118
- data/lib/ymdp/support/string_masker.rb +0 -17
- data/spec/ymdt_spec.rb +0 -149
data/spec/ymdt_spec.rb
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
require 'deploy/ymdt'
|
4
|
-
|
5
|
-
describe "YMDT" do
|
6
|
-
before(:each) do
|
7
|
-
$stdout.stub!(:puts)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "instantiation" do
|
11
|
-
it "should raise error without a username and password" do
|
12
|
-
lambda {
|
13
|
-
YMDT::Base.new()
|
14
|
-
}.should raise_error(ArgumentError)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should raise error without a username" do
|
18
|
-
lambda {
|
19
|
-
YMDT::Base.new(:password => "password")
|
20
|
-
}.should raise_error(ArgumentError)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should raise error without a password" do
|
24
|
-
lambda {
|
25
|
-
YMDT::Base.new(:username => "fred")
|
26
|
-
}.should raise_error(ArgumentError)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should not raise error with a username and password" do
|
30
|
-
lambda {
|
31
|
-
YMDT::Base.new(:username => "fred", :password => "password")
|
32
|
-
}.should_not raise_error(ArgumentError)
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "instance variables" do
|
36
|
-
before(:each) do
|
37
|
-
@script_path = "./path/to/ymdt"
|
38
|
-
@username = "fred"
|
39
|
-
@password = "password"
|
40
|
-
@ymdt = YMDT::Base.new(:username => @username, :password => @password, :script_path => @script_path)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should set username" do
|
44
|
-
@ymdt.username.should == @username
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should set password" do
|
48
|
-
@ymdt.password.should == @password
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should set script_path" do
|
52
|
-
@ymdt.script_path.should == @script_path
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "invoke" do
|
58
|
-
before(:each) do
|
59
|
-
YMDT::System.stub!(:execute)
|
60
|
-
@ymdt = YMDT::Base.new(:username => "fred", :password => "password", :script_path => "./path/to/ymdt")
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should execute command" do
|
64
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt put \".//servers/app\" -ufred -ppassword")
|
65
|
-
@ymdt.invoke(:put, :application => "app")
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should add sync flag" do
|
69
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt put \".//servers/app\" -s -ufred -ppassword")
|
70
|
-
@ymdt.invoke(:put, :application => "app", :sync => true)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should put a path" do
|
74
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt put \".//servers/app/views\" -ufred -ppassword")
|
75
|
-
@ymdt.invoke(:put, :application => "app", :path => "views")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "shouldn't add extra slashes" do
|
79
|
-
end
|
80
|
-
|
81
|
-
describe "shortcut methods" do
|
82
|
-
it "should put" do
|
83
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt put \".//servers/app\" -ufred -ppassword")
|
84
|
-
@ymdt.put(:application => "app")
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should get" do
|
88
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt get \".//servers/app\" -ufred -ppassword")
|
89
|
-
@ymdt.get(:application => "app")
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should create" do
|
93
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt get \".//servers/app\" -a12345 -ufred -ppassword")
|
94
|
-
@ymdt.create(:application_id => "12345", :application => "app")
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should ls" do
|
98
|
-
YMDT::System.should_receive(:execute).with("./path/to/ymdt ls \".//servers/app\" -ufred -ppassword", :return => true)
|
99
|
-
@ymdt.ls(:application => "app")
|
100
|
-
end
|
101
|
-
|
102
|
-
it "ls should return results" do
|
103
|
-
@results = "These are the results."
|
104
|
-
YMDT::System.stub!(:execute).with(anything, :return => true).and_return(@results)
|
105
|
-
@ymdt.ls(:application => "app").should == @results
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe "dry run" do
|
110
|
-
it "should not execute anything for a dry run" do
|
111
|
-
YMDT::System.should_not_receive(:execute)
|
112
|
-
@ymdt.invoke(:put, :application => "app", :dry_run => true)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe "return results" do
|
117
|
-
before(:each) do
|
118
|
-
@results = "These are the results."
|
119
|
-
YMDT::System.stub!(:execute).with(anything, :return => true).and_return(@results)
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should return results from YMDT::System" do
|
123
|
-
YMDT::System.should_receive(:execute).with(anything, :return => true)
|
124
|
-
@ymdt.invoke(:put, :application => "app", :return => true)
|
125
|
-
end
|
126
|
-
|
127
|
-
it "should return results" do
|
128
|
-
@ymdt.invoke(:put, :application => "app", :return => true).should == @results
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
describe "output" do
|
133
|
-
it "should not print username and password" do
|
134
|
-
$stdout.should_receive(:puts).with("./path/to/ymdt put \".//servers/app\" -u[username] -p[password]")
|
135
|
-
@ymdt.invoke(:put, :application => "app")
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|