Class: Vagrant::Provisioners::Shell::Config
- Inherits:
-
Config::Base
- Object
- Config::Base
- Vagrant::Provisioners::Shell::Config
- Defined in:
- lib/vagrant/provisioners/shell.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#inline ⇒ Object
Returns the value of attribute inline.
-
#path ⇒ Object
Returns the value of attribute path.
-
#upload_path ⇒ Object
Returns the value of attribute upload_path.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(env, errors) ⇒ Object
Methods inherited from Config::Base
#instance_variables_hash, json_create, #merge, #set_options, #to_hash, #to_json
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
12 13 14 |
# File 'lib/vagrant/provisioners/shell.rb', line 12 def initialize @upload_path = "/tmp/vagrant-shell" end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
10 11 12 |
# File 'lib/vagrant/provisioners/shell.rb', line 10 def args @args end |
#inline ⇒ Object
Returns the value of attribute inline.
7 8 9 |
# File 'lib/vagrant/provisioners/shell.rb', line 7 def inline @inline end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/vagrant/provisioners/shell.rb', line 8 def path @path end |
#upload_path ⇒ Object
Returns the value of attribute upload_path.
9 10 11 |
# File 'lib/vagrant/provisioners/shell.rb', line 9 def upload_path @upload_path end |
Instance Method Details
#validate(env, errors) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vagrant/provisioners/shell.rb', line 16 def validate(env, errors) # Validate that the parameters are properly set if path && inline errors.add(I18n.t("vagrant.provisioners.shell.path_and_inline_set")) elsif !path && !inline errors.add(I18n.t("vagrant.provisioners.shell.no_path_or_inline")) end # Validate the existence of a script to upload if path = Pathname.new(path).(env.root_path) if !.file? errors.add(I18n.t("vagrant.provisioners.shell.path_invalid", :path => )) end end # There needs to be a path to upload the script to if !upload_path errors.add(I18n.t("vagrant.provisioners.shell.upload_path_not_set")) end # If there are args and its not a string, that is a problem if args && !args.is_a?(String) errors.add(I18n.t("vagrant.provisioners.shell.args_not_string")) end end |