mfxcode 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 54f54f3d10b733030ffd280d889a0b6b546f039f
4
+ data.tar.gz: 2397cf44e8d8944faa1ce94da623c73bc382ec8f
5
+ SHA512:
6
+ metadata.gz: 8328733146d10d98ac3d2d445afd699679991b4b405a246323fb63b1f1f990fe37f8ad39a6bb01a8cdf98eda61b36b4e5b627b0a3996b7a661b98cb09ea2b005
7
+ data.tar.gz: 9db5ba54678c394cf96ac9e6fa5618f587932b27211b5e46a137d8035942fea8f858fcdfade3f979d23122488777a1c4dec1628dc9b07dfd0ffc0d7961624ca8
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Mfxcode
2
+
3
+ This gem allows to add or delete files references to an XCode project or workspace.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'mfxcode'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install mfxcode
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
data/bin/mfxcode ADDED
@@ -0,0 +1,15 @@
1
+ #!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
2
+ #
3
+ # This file was generated by RubyGems.
4
+ #
5
+ # The application 'mfxcode' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'rubygems'
10
+ require 'mfxcode'
11
+
12
+ plugin = ARGV.shift
13
+ plugin = 'help' unless MFXcode::Plugins.all.include? plugin
14
+ MFXcode::Plugins.run(plugin, ARGV)
15
+
data/lib/mfxcode.rb ADDED
@@ -0,0 +1,20 @@
1
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
2
+
3
+ # This file is part of Movalys MDK.
4
+ # Movalys MDK is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Lesser General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ # Movalys MDK is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ # You should have received a copy of the GNU Lesser General Public License
13
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
14
+
15
+ require 'mfxcode/version'
16
+
17
+ require 'mfxcode/plugins/core/core.rb'
18
+
19
+ require 'mfxcode/shortcuts.rb'
20
+
@@ -0,0 +1,117 @@
1
+ # Adds files to a group in the Xcode project
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+ require 'rubygems'
18
+ require 'xcodeproj'
19
+
20
+ # :nodoc: namespace
21
+ module MFXcode::Plugins
22
+
23
+
24
+ # Adds files to a group in the Xcode project
25
+ class Addfile
26
+
27
+ def help
28
+ {:short => 'adds files to a group in Xcode project',
29
+ :long => <<"END" }
30
+ Usage: addfile project_path group file [file file ...]
31
+
32
+ Adds files to a group, in the project at the given path.
33
+ END
34
+ end
35
+
36
+ def run(args)
37
+
38
+ if args.count >= 3
39
+
40
+ project_path = args.shift
41
+ group_name_arg = args.shift
42
+ files = args
43
+
44
+ project = Xcodeproj::Project.open(project_path)
45
+
46
+ # filter files which are already included
47
+ project_files = []
48
+ project.files.each { |f| project_files << f.path }
49
+ files = files.select { |f| ! project_files.include? f }
50
+
51
+ create_group_hierarchy_if_not_present(project.main_group, group_name_arg.split("/"))
52
+
53
+ group = project[group_name_arg]
54
+
55
+ main_target_name = project_path.split("/").last.split(".").first
56
+ test_target_name = main_target_name + "Tests"
57
+
58
+ #puts "Main target is #{main_target_name}. files will be added to this target."
59
+ #puts "#{project.targets}"
60
+ #puts "#{project.pretty_print}"
61
+
62
+ main_target = project.targets.select {|t| t.name == main_target_name}.first
63
+ test_target = project.targets.select {|t| t.name == test_target_name}.first
64
+
65
+ files.each do |file|
66
+ #puts "current file: #{file}"
67
+ f = group.new_file(file,'SOURCE_ROOT')
68
+ #puts "current file: #{f}"
69
+ #puts "current file: #{f.name}"
70
+ #puts "#{group_name_arg}"
71
+ fext = f.name.split(".").last
72
+
73
+ case fext
74
+ when "h"
75
+ when "pch"
76
+ when "contents"
77
+ when "m"
78
+ #puts "Adding source file #{f.name}"
79
+ main_target.add_file_references [f]
80
+ test_target.add_file_references [f]
81
+ else
82
+ #puts "Adding ressource file #{f.name}"
83
+ main_target.build_phases.select {|bp| bp.isa == 'PBXResourcesBuildPhase'}.first.add_file_reference f
84
+ end
85
+ end
86
+
87
+ #puts "#{project_path}"
88
+ project.save(project_path)
89
+
90
+ else
91
+ puts "Too few arguments"
92
+ puts help[:long]
93
+ exit 1
94
+ end
95
+ end
96
+
97
+ # create a hierarchy of group if not present
98
+ def create_group_hierarchy_if_not_present(main_group, sub_groups)
99
+ g = sub_groups.shift
100
+
101
+ if main_group[g].nil?
102
+ main_group.new_group(g)
103
+
104
+ if main_group.path.nil?
105
+ main_group[g].path = g
106
+ else
107
+ main_group[g].path = main_group.path + "/" + g
108
+ end
109
+
110
+ end
111
+
112
+ create_group_hierarchy_if_not_present(main_group[g], sub_groups) unless sub_groups.empty?
113
+ end
114
+
115
+ end # class MFXcode::Plugins::Addfile
116
+
117
+ end # namespace MFXcode::Plugins
@@ -0,0 +1,56 @@
1
+ # Plugin management logic.
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+ require 'set'
18
+
19
+ # :nodoc: namespace
20
+ module MFXcode
21
+
22
+
23
+ # Plugin management logic.
24
+ module Plugins
25
+
26
+ def self.all
27
+ plugin_dir = File.join(File.dirname(__FILE__), '..')
28
+ plugins = Dir.entries(plugin_dir).select { |entry|
29
+ /^[^_].*\.rb$/ =~ entry
30
+ }.map { |entry| entry[0..-4] }
31
+ return Set.new(plugins)
32
+ end
33
+
34
+ def self.require_all
35
+ all.each { |plugin| self.require plugin }
36
+ end
37
+
38
+ def self.require(plugin_name)
39
+ Kernel.require "mfxcode/plugins/#{plugin_name}.rb"
40
+ end
41
+
42
+ def self.get(plugin_name)
43
+ self.require plugin_name
44
+ Plugins.const_get(plugin_name.capitalize).new
45
+ end
46
+
47
+ def self.run(plugin_name, args)
48
+ self.get(plugin_name).run args
49
+ end
50
+
51
+ def self.help(plugin_name)
52
+ self.get(plugin_name).help
53
+ end
54
+ end # module MFXcode::Plugins
55
+
56
+ end # namespace MFXcode
@@ -0,0 +1,60 @@
1
+ # Delete files references in the Xcode project
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+ require 'rubygems'
18
+ require 'xcodeproj'
19
+
20
+ # :nodoc: namespace
21
+ module MFXcode::Plugins
22
+
23
+
24
+ # Delete files references in the Xcode project
25
+ class Delfileref
26
+
27
+ def help
28
+ {:short => 'delete files references in the Xcode project',
29
+ :long => <<"END" }
30
+ Usage: delfileref project_path file [file file ...]
31
+
32
+ Delete files references in the project at the given path.
33
+ END
34
+ end
35
+
36
+ def run(args)
37
+ if args.count >= 2
38
+
39
+ project_path = args.shift
40
+
41
+ project = Xcodeproj::Project.open(project_path)
42
+
43
+ filesToDeleteIfReferenced = args.to_a
44
+
45
+ project.files.select { |f| filesToDeleteIfReferenced.include? f.name}.each {|f| f.remove_from_project}
46
+
47
+ project.save(project_path)
48
+
49
+ else
50
+ puts "Too few arguments"
51
+ puts help[:long]
52
+
53
+ exit 1
54
+ end
55
+
56
+ end
57
+
58
+ end # class MFXcode::Plugins::Delfileref
59
+
60
+ end # namespace MFXcode::Plugins
@@ -0,0 +1,61 @@
1
+ # Generate a new default empty Xcode project
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+ require 'rubygems'
18
+ require 'xcodeproj'
19
+
20
+ # :nodoc: namespace
21
+ module MFXcode::Plugins
22
+
23
+
24
+ # Adds files to a group in the Xcode project
25
+ class Generateproj
26
+
27
+ def help
28
+ {:short => 'Generate a new default empty Xcode project',
29
+ :long => <<"END" }
30
+ Usage: generateproj project_name
31
+
32
+ Generate a new empty Xcode project
33
+ END
34
+ end
35
+
36
+ def run(args)
37
+
38
+ if args.count == 1
39
+
40
+ project_name = args.shift
41
+
42
+ if project_name.end_with? ".xcodeproj"
43
+ project_name.chomp! ".xcodeproj"
44
+ end
45
+
46
+ project_basedir = project_name
47
+ project_path = project_basedir + "/" + project_name + ".xcodeproj"
48
+
49
+ project = Xcodeproj::Project.new
50
+
51
+
52
+ project.save(project_path)
53
+
54
+ else
55
+ puts "Wrong number of arguments"
56
+ puts help[:long]
57
+ end
58
+ end
59
+ end # class MFXcode::Plugins::Addfile
60
+
61
+ end # namespace MFXcode::Plugins
@@ -0,0 +1,53 @@
1
+ # Displays the help strings for other plugins.
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+ # :nodoc: namespace
18
+ module MFXcode::Plugins
19
+
20
+
21
+ # Displays the help strings for other plugins.
22
+ class Help
23
+ def help
24
+ {:short => 'command-line usage instructions',
25
+ :long => <<"END" }
26
+ Usage: help [command]
27
+
28
+ Shows the usage for the given command. If no command is given, shows a list of
29
+ commands with a short description for each command.
30
+ END
31
+ end
32
+
33
+ def run(args)
34
+ helpstr = "MFXcode brought to you by SopraSteria.\n"
35
+
36
+ plugin = args.shift
37
+ if MFXcode::Plugins.all.include? plugin
38
+ help = MFXcode::Plugins.get(plugin).help
39
+ helpstr << "#{plugin} - #{help[:short]}\n#{help[:long]}"
40
+ else
41
+ helpstr << "Available commands:\n"
42
+ MFXcode::Plugins.all.each do |plugin|
43
+ short_help = MFXcode::Plugins.get(plugin).help[:short]
44
+ helpstr << " #{plugin}: #{short_help}\n"
45
+ end
46
+ end
47
+
48
+ print helpstr
49
+ helpstr
50
+ end
51
+ end # class MFXcode::Plugins::Help
52
+
53
+ end # namespace MFXcode::Plugins
@@ -0,0 +1,41 @@
1
+ # Prints version
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+
18
+ # :nodoc: namespace
19
+ module MFXcode::Plugins
20
+
21
+
22
+ # Prints version
23
+ class Version
24
+
25
+ def help
26
+ {:short => 'Prints version',
27
+ :long => <<"END" }
28
+ Usage: version
29
+
30
+ Prints version
31
+ END
32
+ end
33
+
34
+ def run(args)
35
+
36
+ puts "MFXcode version: #{MFXcode::VERSION}"
37
+
38
+ end
39
+ end # class MFXcode::Plugins::Addfile
40
+
41
+ end # namespace MFXcode::Plugins
@@ -0,0 +1,25 @@
1
+ # Convenience methods for core MFXcode functionality.
2
+ #
3
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
4
+
5
+ # This file is part of Movalys MDK.
6
+ # Movalys MDK is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ # Movalys MDK is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public License
15
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
16
+
17
+
18
+ # :nodoc: namespace
19
+ module MFXcode
20
+
21
+ # Instantiate a plug-in.
22
+ def self.plugin(plugin_name)
23
+ MFXcode::Plugins.get(plugin_name)
24
+ end
25
+ end # namespace MFXcode
@@ -0,0 +1,17 @@
1
+ # Copyright (C) 2010 Sopra Steria Group (movalys.support@soprasteria.com)
2
+
3
+ # This file is part of Movalys MDK.
4
+ # Movalys MDK is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Lesser General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ # Movalys MDK is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+ # You should have received a copy of the GNU Lesser General Public License
13
+ # along with Movalys MDK. If not, see <http://www.gnu.org/licenses />.
14
+
15
+ module MFXcode
16
+ VERSION = "1.0.1" unless defined?(::MFXcode::VERSION)
17
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mfxcode
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sopra Steria Group
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xcodeproj
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.28.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.28.2
27
+ description: Command line tool to work with Xcode projects and Workspaces.
28
+ email:
29
+ - movalys.support@soprasteria.com
30
+ executables:
31
+ - mfxcode
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - README.md
36
+ - bin/mfxcode
37
+ - lib/mfxcode.rb
38
+ - lib/mfxcode/plugins/addfile.rb
39
+ - lib/mfxcode/plugins/core/core.rb
40
+ - lib/mfxcode/plugins/delfileref.rb
41
+ - lib/mfxcode/plugins/generateproj.rb
42
+ - lib/mfxcode/plugins/help.rb
43
+ - lib/mfxcode/plugins/version.rb
44
+ - lib/mfxcode/shortcuts.rb
45
+ - lib/mfxcode/version.rb
46
+ homepage: http://movalys.org/
47
+ licenses:
48
+ - LGPL-3.0
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.4.6
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: This command line tool allows to add, delete files references to an Xcode
70
+ project or workspace, and to generate an new empty XCode project
71
+ test_files: []