motion-fileutils 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 ITO SOFT DESIGN Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # motion-fileutils
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'motion-fileutils'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install motion-fileutils
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ unless defined?(Motion::Project::Config)
2
+ raise "This file must be required within a RubyMotion project Rakefile."
3
+ end
4
+
5
+ lib_dir_path = File.dirname(File.expand_path(__FILE__))
6
+ Motion::Project::App.setup do |app|
7
+ app.files.unshift(Dir.glob(File.join(lib_dir_path, "project/**/*.rb")))
8
+ end
@@ -0,0 +1,64 @@
1
+ module Motion
2
+ module FileUtils
3
+
4
+ def self.private_module_function(name) #:nodoc:
5
+ module_function name
6
+ private_class_method name
7
+ end
8
+
9
+ def mkdir(dir, options = {})
10
+ mkdir_with_intermediate(dir, false, options)
11
+ end
12
+ module_function :mkdir
13
+
14
+ def mkdir_p(dir, options = {})
15
+ mkdir_with_intermediate(dir, true, options)
16
+ end
17
+ module_function :mkdir_p
18
+
19
+ alias :mkpath :mkdir_p
20
+ module_function :mkpath
21
+
22
+ alias :makedirs :mkdir_p
23
+ module_function :makedirs
24
+
25
+ def rm(list, options = {})
26
+ error = Pointer.new(:object)
27
+ m = NSFileManager.defaultManager
28
+ list = [list] unless list.is_a? Array
29
+ list.each do |path|
30
+ r = m.removeItemAtPath path, error:error
31
+ #p error, r unless r
32
+ end
33
+ end
34
+ module_function :rm
35
+
36
+ alias :remove :rm
37
+ module_function :remove
38
+
39
+ private
40
+
41
+ def mkdir_with_intermediate(dir, intermediate, options = {})
42
+ error = Pointer.new(:object)
43
+ m = NSFileManager.defaultManager
44
+ dir = [dir] unless dir.is_a? Array
45
+ paths = []
46
+ dir.each do |path|
47
+ r = m.createDirectoryAtPath path, withIntermediateDirectories:intermediate, attributes:nil, error:error
48
+ paths << path if r
49
+ #p error, r unless r
50
+ end
51
+ case paths.size
52
+ when 0
53
+ nil
54
+ when 1
55
+ paths.first
56
+ else
57
+ paths
58
+ end
59
+ end
60
+ private_module_function :mkdir_with_intermediate
61
+
62
+
63
+ end
64
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: motion-fileutils
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Katsuyoshi Ito
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: ! ' FileUtils for RubyMotion. '
31
+ email:
32
+ - kito@itosoft.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - README.md
38
+ - LICENSE
39
+ - lib/motion-fileutils.rb
40
+ - lib/project/motion-fileutils.rb
41
+ homepage: ''
42
+ licenses:
43
+ - MIT
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 1.8.25
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: The aim is to implement methos in Ruby FileUtils.
66
+ test_files: []