Class: Xcode::Deploy::Ftp
- Inherits:
-
Object
- Object
- Xcode::Deploy::Ftp
- Defined in:
- lib/xcode/deploy/ftp.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #deploy ⇒ Object
-
#get_binding ⇒ Object
Support templating of member data.
-
#initialize(builder, options = {}) ⇒ Ftp
constructor
A new instance of Ftp.
- #remote_installation_path ⇒ Object
Constructor Details
#initialize(builder, options = {}) ⇒ Ftp
Returns a new instance of Ftp.
9 10 11 12 13 14 15 16 |
# File 'lib/xcode/deploy/ftp.rb', line 9 def initialize(builder, = {}) @builder = builder @username = [:username] @password = [:password] @dir = [:dir] @host = [:host] @base_url = [:base_url] end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/xcode/deploy/ftp.rb', line 7 def dir @dir end |
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/xcode/deploy/ftp.rb', line 7 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/xcode/deploy/ftp.rb', line 7 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/xcode/deploy/ftp.rb', line 7 def username @username end |
Instance Method Details
#deploy ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/xcode/deploy/ftp.rb', line 27 def deploy WebAssets.generate @builder, @base_url do |dir| puts "Connecting to #{@remote_host} with username #{@username}" Net::FTP.open(@host, @username, @password) do |ftp| begin puts "Creating folder #{remote_installation_path}" ftp.mkdir(remote_installation_path) rescue Net::FTPError puts "It looks like the folder is already there." end puts "Changing to remote folder #{remote_installation_path}" files = ftp.chdir(remote_installation_path) Dir["#{dir}/*"].each do |f| filename = File.basename(f) puts "Uploading #{filename}" ftp.putbinaryfile(f, filename, 1024) end filename = File.basename("#{@builder.ipa_path}") puts "Uploading #{filename}" ftp.putbinaryfile("#{@builder.ipa_path}", filename, 1024) end end end |
#get_binding ⇒ Object
Support templating of member data.
19 20 21 |
# File 'lib/xcode/deploy/ftp.rb', line 19 def get_binding binding end |
#remote_installation_path ⇒ Object
23 24 25 |
# File 'lib/xcode/deploy/ftp.rb', line 23 def remote_installation_path File.join(@dir, @builder.product_name) end |