propro 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +339 -0
  5. data/README.md +134 -0
  6. data/Rakefile +9 -0
  7. data/bin/propro +6 -0
  8. data/examples/vagrant.propro +41 -0
  9. data/examples/vps_webserver.propro +51 -0
  10. data/ext/bash/app/nginx.sh +9 -0
  11. data/ext/bash/app/node.sh +5 -0
  12. data/ext/bash/app/pg.sh +5 -0
  13. data/ext/bash/app/puma/nginx.sh +58 -0
  14. data/ext/bash/app/puma.sh +64 -0
  15. data/ext/bash/app/rvm.sh +7 -0
  16. data/ext/bash/app/sidekiq.sh +69 -0
  17. data/ext/bash/app.sh +75 -0
  18. data/ext/bash/db/pg.sh +47 -0
  19. data/ext/bash/db/redis.sh +20 -0
  20. data/ext/bash/lib/extras.sh +11 -0
  21. data/ext/bash/lib/nginx.sh +233 -0
  22. data/ext/bash/lib/node.sh +28 -0
  23. data/ext/bash/lib/pg.sh +44 -0
  24. data/ext/bash/lib/propro.sh +104 -0
  25. data/ext/bash/lib/redis.sh +59 -0
  26. data/ext/bash/lib/rvm.sh +21 -0
  27. data/ext/bash/lib/system.sh +57 -0
  28. data/ext/bash/lib/ubuntu.sh +175 -0
  29. data/ext/bash/vagrant/nginx.sh +31 -0
  30. data/ext/bash/vagrant/node.sh +5 -0
  31. data/ext/bash/vagrant/pg.sh +12 -0
  32. data/ext/bash/vagrant/redis.sh +5 -0
  33. data/ext/bash/vagrant/rvm.sh +6 -0
  34. data/ext/bash/vagrant/system.sh +26 -0
  35. data/ext/bash/vagrant.sh +3 -0
  36. data/ext/bash/vps/system.sh +156 -0
  37. data/lib/propro/cli/templates/init.tt +21 -0
  38. data/lib/propro/cli.rb +125 -0
  39. data/lib/propro/command.rb +17 -0
  40. data/lib/propro/export.rb +119 -0
  41. data/lib/propro/option.rb +36 -0
  42. data/lib/propro/package.rb +68 -0
  43. data/lib/propro/script.rb +95 -0
  44. data/lib/propro/source.rb +86 -0
  45. data/lib/propro/version.rb +3 -0
  46. data/lib/propro.rb +57 -0
  47. data/propro.gemspec +27 -0
  48. data/test/export_spec.rb +88 -0
  49. data/test/minitest_helper.rb +6 -0
  50. data/test/option_spec.rb +34 -0
  51. metadata +167 -0
@@ -0,0 +1,88 @@
1
+ require 'minitest_helper'
2
+
3
+ describe Propro::Export do
4
+ def parse(string)
5
+ Propro::Export.parse("#{string}\n")
6
+ end
7
+
8
+ def assert_parse(bash, ruby)
9
+ assert_equal parse(bash).to_ruby, ruby
10
+ end
11
+
12
+ it 'parses unquoted values' do
13
+ assert_parse \
14
+ 'export WAT_IS=neato',
15
+ 'set :wat_is, "neato"'
16
+ end
17
+
18
+ it 'parses single quoted values' do
19
+ assert_parse \
20
+ "export WAT_IS='neato'",
21
+ 'set :wat_is, "neato", lit: true'
22
+ end
23
+
24
+ it 'parses double quoted values' do
25
+ assert_parse \
26
+ 'export WAT_IS="neato"',
27
+ 'set :wat_is, "neato"'
28
+ end
29
+
30
+ it 'parses booleans' do
31
+ assert_parse \
32
+ 'export BOOL=yes',
33
+ 'set :bool, true'
34
+ assert_parse \
35
+ 'export BOOL=no',
36
+ 'set :bool, false'
37
+ end
38
+
39
+ it 'parses integers' do
40
+ assert_parse \
41
+ 'export INT=1234',
42
+ 'set :int, 1234'
43
+ end
44
+
45
+ it 'parses floats' do
46
+ assert_parse \
47
+ 'export FLOAT=123.4567',
48
+ 'set :float, 123.4567'
49
+ end
50
+
51
+ it 'parses strings' do
52
+ assert_parse \
53
+ 'export STR="super/cool.str"',
54
+ 'set :str, "super/cool.str"'
55
+ end
56
+
57
+ it 'parses arrays' do
58
+ assert_parse \
59
+ 'export ARY="super cool"',
60
+ 'set :ary, ["super", "cool"]'
61
+ end
62
+
63
+ it 'passes comments though' do
64
+ assert_parse \
65
+ 'export HI="yes" # comment, zro',
66
+ 'set :hi, true # comment, zro'
67
+ end
68
+
69
+ it 'removes tags from comments' do
70
+ assert_parse \
71
+ 'export HI="no" # @specify comment, zro',
72
+ 'set :hi, false # comment, zro'
73
+
74
+ assert_parse \
75
+ 'export HI="lo" # @specify',
76
+ 'set :hi, "lo"'
77
+ end
78
+
79
+ it 'parses @specify' do
80
+ export = parse('export HI="yes" # @specify I am important')
81
+ export.is_specified?.must_equal true
82
+ end
83
+
84
+ it 'parses @require' do
85
+ export = parse('export HI="yes" # @require I am important')
86
+ export.is_required?.must_equal true
87
+ end
88
+ end
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'propro'
3
+ require 'minitest'
4
+ require 'minitest/spec'
5
+ require 'minitest/pride'
6
+ require 'minitest/autorun'
@@ -0,0 +1,34 @@
1
+ require 'minitest_helper'
2
+
3
+ describe Propro::Option do
4
+ def build(*args)
5
+ Propro::Option.new(*args)
6
+ end
7
+
8
+ def assert_option(*builder, bash_value)
9
+ assert_equal build(:my_key, *builder).to_bash, "MY_KEY=#{bash_value}"
10
+ end
11
+
12
+ it 'handles array values' do
13
+ assert_option ['a', 'b', 'c'], '"a b c"'
14
+ end
15
+
16
+ it 'handles integer values' do
17
+ assert_option 1234, '"1234"'
18
+ end
19
+
20
+ it 'handles float values' do
21
+ assert_option 1.23, '"1.23"'
22
+ end
23
+
24
+ it 'handles boolean values' do
25
+ assert_option true, '"yes"'
26
+ assert_option false, '"no"'
27
+ assert_option 'yes', '"yes"'
28
+ assert_option 'no', '"no"'
29
+ end
30
+
31
+ it 'handles literal values' do
32
+ assert_option 'hello', { lit: true }, "'hello'"
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: propro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Carsten Nielsen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.18'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.18'
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-scp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Propro is a tool for provisioning remote servers.
84
+ email:
85
+ - heycarsten@gmail.com
86
+ executables:
87
+ - propro
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE
94
+ - README.md
95
+ - Rakefile
96
+ - bin/propro
97
+ - examples/vagrant.propro
98
+ - examples/vps_webserver.propro
99
+ - ext/bash/app.sh
100
+ - ext/bash/app/nginx.sh
101
+ - ext/bash/app/node.sh
102
+ - ext/bash/app/pg.sh
103
+ - ext/bash/app/puma.sh
104
+ - ext/bash/app/puma/nginx.sh
105
+ - ext/bash/app/rvm.sh
106
+ - ext/bash/app/sidekiq.sh
107
+ - ext/bash/db/pg.sh
108
+ - ext/bash/db/redis.sh
109
+ - ext/bash/lib/extras.sh
110
+ - ext/bash/lib/nginx.sh
111
+ - ext/bash/lib/node.sh
112
+ - ext/bash/lib/pg.sh
113
+ - ext/bash/lib/propro.sh
114
+ - ext/bash/lib/redis.sh
115
+ - ext/bash/lib/rvm.sh
116
+ - ext/bash/lib/system.sh
117
+ - ext/bash/lib/ubuntu.sh
118
+ - ext/bash/vagrant.sh
119
+ - ext/bash/vagrant/nginx.sh
120
+ - ext/bash/vagrant/node.sh
121
+ - ext/bash/vagrant/pg.sh
122
+ - ext/bash/vagrant/redis.sh
123
+ - ext/bash/vagrant/rvm.sh
124
+ - ext/bash/vagrant/system.sh
125
+ - ext/bash/vps/system.sh
126
+ - lib/propro.rb
127
+ - lib/propro/cli.rb
128
+ - lib/propro/cli/templates/init.tt
129
+ - lib/propro/command.rb
130
+ - lib/propro/export.rb
131
+ - lib/propro/option.rb
132
+ - lib/propro/package.rb
133
+ - lib/propro/script.rb
134
+ - lib/propro/source.rb
135
+ - lib/propro/version.rb
136
+ - propro.gemspec
137
+ - test/export_spec.rb
138
+ - test/minitest_helper.rb
139
+ - test/option_spec.rb
140
+ homepage: http://github.com/heycarsten/propro
141
+ licenses:
142
+ - GNU v2
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.2.0
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: A standalone server provisioning tool
164
+ test_files:
165
+ - test/export_spec.rb
166
+ - test/minitest_helper.rb
167
+ - test/option_spec.rb