crtrunner 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -27
- data/bin/crtrunner +2 -62
- data/crtrunner.gemspec +14 -11
- data/lib/crtrunner.rb +25 -55
- data/lib/crtrunner/carthage.rb +23 -0
- data/lib/crtrunner/version.rb +1 -1
- data/lib/crtrunner/xcode.rb +52 -0
- metadata +48 -7
- data/CODE_OF_CONDUCT.md +0 -13
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd36c43b42c92bd5be0442aba57c7d49a6c8b762
|
4
|
+
data.tar.gz: e7a90efbfebe9f0adf660da67605f93078f27bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ba3f9b0a0617d59354e9a433066aeda9e467ddcb7ecb83b605ab083c546966067d20c8287b04c4a67609c6d93c6192cc9a46b9f5eb1e7598e9136e12451d90
|
7
|
+
data.tar.gz: 7d2241f75cba67aad4f936371133ee6e409a80a2b2f8e0bdc16c68d30bf6b0d3b844740fd6538143b66b70f6b634f3c96678fb9a06fafb97b6c0619ce6c43031
|
data/README.md
CHANGED
@@ -1,41 +1,25 @@
|
|
1
1
|
# Crtrunner
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/crtrunner`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
2
|
## Installation
|
8
3
|
|
9
|
-
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'crtrunner'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
4
|
+
Install it yourself as:
|
20
5
|
|
21
6
|
$ gem install crtrunner
|
22
7
|
|
23
8
|
## Usage
|
24
9
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/crtrunner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
10
|
+
Run the following command in your project dir
|
36
11
|
|
12
|
+
$ crtrunner
|
37
13
|
|
38
14
|
## License
|
39
15
|
|
40
16
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
17
|
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
1. Fork it ( https://github.com/icapps/Crtrunner/fork )
|
21
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
22
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
23
|
+
4. Run `rubycop` in order to be compliant to our coding style.
|
24
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
6. Create a new Pull Request
|
data/bin/crtrunner
CHANGED
@@ -1,65 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "xcodeproj"
|
3
2
|
|
4
|
-
|
5
|
-
projects = Dir[Dir.pwd << "/*.xcodeproj"]
|
6
|
-
project_name = ""
|
7
|
-
if projects.count > 1
|
8
|
-
project_id = ""
|
9
|
-
loop do
|
10
|
-
puts "\nSelect Project:"
|
11
|
-
count = 1
|
12
|
-
projects.each { |project|
|
13
|
-
project.slice! Dir.pwd << "/"
|
14
|
-
puts count.to_s << " " << project
|
15
|
-
count = count + 1
|
16
|
-
}
|
17
|
-
print "> "
|
18
|
-
project_id = gets
|
19
|
-
project_id = project_id.chomp
|
20
|
-
break if project_id.to_i <= projects.count
|
21
|
-
end
|
22
|
-
project_name = projects[project_id.to_i - 1]
|
23
|
-
elsif projects.count == 1
|
24
|
-
project_name = projects[0]
|
25
|
-
else
|
26
|
-
print "No Xcode Project found!\n"
|
27
|
-
exit
|
28
|
-
end
|
3
|
+
require "crtrunner"
|
29
4
|
|
30
|
-
|
31
|
-
system 'carthage update'
|
32
|
-
#
|
33
|
-
|
34
|
-
# Get frameworks from directory
|
35
|
-
frameworks = (Dir.entries('Carthage/Build/iOS').select {|entry| File.directory? File.join('Carthage/Build/iOS',entry) and !(entry =='.' || entry == '..') })
|
36
|
-
frameworks.each { |framework|
|
37
|
-
if framework.include? ".dSYM"
|
38
|
-
frameworks.delete(framework)
|
39
|
-
end
|
40
|
-
}
|
41
|
-
|
42
|
-
# Open Xcode Project
|
43
|
-
project = Xcodeproj::Project.open(project_name);
|
44
|
-
framework_buildphase = project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXFrameworksBuildPhase}[0];
|
45
|
-
shellscript_buildphase = project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXShellScriptBuildPhase};
|
46
|
-
|
47
|
-
|
48
|
-
print Xcodeproj::Project::UUIDGenerator.generate!
|
49
|
-
# carthage_shellscript = Xcodeproj::Project::Object::PBXShellScriptBuildPhase.new(project_name, uuid_generator.generate!)
|
50
|
-
# print carthage_shellscript
|
51
|
-
|
52
|
-
addToProject = true
|
53
|
-
frameworks.each { |framework|
|
54
|
-
framework_buildphase.files.each { |file|
|
55
|
-
if file.display_name == framework
|
56
|
-
addToProject = false
|
57
|
-
end
|
58
|
-
}
|
59
|
-
if addToProject
|
60
|
-
lib_path = "Carthage/Build/iOS/" << (framework)
|
61
|
-
lib_ref = project.new_file(lib_path);
|
62
|
-
framework_buildphase.add_file_reference(lib_ref);
|
63
|
-
end
|
64
|
-
}
|
65
|
-
project.save();
|
5
|
+
Crtrunner::run
|
data/crtrunner.gemspec
CHANGED
@@ -3,16 +3,19 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'crtrunner/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.authors = ["Dylan Gyesbreghs"]
|
8
|
+
spec.email = ["dgyesbreghs@gmail.com"]
|
9
|
+
spec.description = %q{Auto import frameworks into a project}
|
10
|
+
spec.summary = %q{Auto import frameworks into a project}
|
11
|
+
spec.homepage = "https://github.com/icapps/crtrunner/"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
spec.files = `git ls-files`.split($\)
|
14
|
+
spec.executables = ["crtrunner"]
|
15
|
+
spec.name = "crtrunner"
|
16
|
+
spec.version = Crtrunner::VERSION
|
17
|
+
|
18
|
+
spec.add_dependency 'colorize', '~> 0.7'
|
19
|
+
spec.add_dependency 'xcodeproj'
|
20
|
+
spec.add_dependency 'plist'
|
18
21
|
end
|
data/lib/crtrunner.rb
CHANGED
@@ -1,65 +1,35 @@
|
|
1
1
|
require "crtrunner/version"
|
2
|
-
require "
|
2
|
+
require "crtrunner/carthage"
|
3
|
+
require "crtrunner/xcode"
|
4
|
+
|
5
|
+
require "colorize"
|
3
6
|
|
4
7
|
module Crtrunner
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
puts
|
16
|
-
count = 1
|
17
|
-
projects.each { |project|
|
18
|
-
project.slice! Dir.pwd << "/"
|
19
|
-
puts count.to_s << " " << project
|
20
|
-
count = count + 1
|
21
|
-
}
|
22
|
-
print "> "
|
23
|
-
project_id = gets
|
24
|
-
project_id = project_id.chomp
|
25
|
-
break if project_id.to_i <= projects.count
|
8
|
+
class << self
|
9
|
+
def run
|
10
|
+
puts '[INFO] Import started.'.colorize(:green)
|
11
|
+
if xcode?
|
12
|
+
if xcode_count == 1
|
13
|
+
puts '[VERBOSE] Detected an Xcode project.'.colorize(:green)
|
14
|
+
end
|
15
|
+
Carthage::update
|
16
|
+
Xcode::save_project xcode_project[0]
|
17
|
+
else
|
18
|
+
puts '[VERBOSE] No Xcode project Detected.'.colorize(:red)
|
26
19
|
end
|
27
|
-
project_name = projects[project_id.to_i - 1]
|
28
|
-
else
|
29
|
-
project_name = projects[0]
|
30
20
|
end
|
31
21
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
frameworks.delete(framework)
|
37
|
-
end
|
38
|
-
}
|
39
|
-
|
40
|
-
# Open Xcode Project
|
41
|
-
project = Xcodeproj::Project.open(project_name);
|
42
|
-
framework_buildphase = project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXFrameworksBuildPhase}[0];
|
43
|
-
shellscript_buildphase = project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXShellScriptBuildPhase};
|
44
|
-
|
22
|
+
private
|
23
|
+
def xcode?
|
24
|
+
xcode_count > 0
|
25
|
+
end
|
45
26
|
|
46
|
-
|
47
|
-
|
48
|
-
|
27
|
+
def xcode_count
|
28
|
+
return xcode_project.count
|
29
|
+
end
|
49
30
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if file.display_name == framework
|
54
|
-
addToProject = false
|
55
|
-
end
|
56
|
-
}
|
57
|
-
if addToProject
|
58
|
-
lib_path = "Carthage/Build/iOS/" << (framework)
|
59
|
-
lib_ref = project.new_file(lib_path);
|
60
|
-
framework_buildphase.add_file_reference(lib_ref);
|
61
|
-
end
|
62
|
-
}
|
63
|
-
project.save();
|
31
|
+
def xcode_project
|
32
|
+
return Dir[Dir.pwd << "/*.xcodeproj"]
|
33
|
+
end
|
64
34
|
end
|
65
35
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
module Crtrunner
|
4
|
+
class Carthage
|
5
|
+
class << self
|
6
|
+
def update
|
7
|
+
puts "[VERBOSE] Update carthage.".colorize(:white)
|
8
|
+
if carthage_file?
|
9
|
+
`carthage update`
|
10
|
+
puts "[INFO] Carthage: Successfull".colorize(:green)
|
11
|
+
else
|
12
|
+
puts "[INFO] No carthage file found.".colorize(:red)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def carthage_file?
|
19
|
+
Dir.glob('**/Cartfile').count > 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/crtrunner/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
require 'xcodeproj'
|
3
|
+
require 'plist'
|
4
|
+
|
5
|
+
module Crtrunner
|
6
|
+
class Xcode
|
7
|
+
class << self
|
8
|
+
def save_project(project_name)
|
9
|
+
puts "[VERBOSE] Update Xcode Project.".colorize(:white)
|
10
|
+
project = open_project(project_name)
|
11
|
+
add_projects(project, frameworks, framework_buildphase(project))
|
12
|
+
puts "[INFO] Xcode: Successfull".colorize(:green)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def add_projects(project, frameworks, framework_buildphase)
|
17
|
+
addToProject = true
|
18
|
+
frameworks.each do |framework|
|
19
|
+
framework_buildphase.files.each do |file|
|
20
|
+
if file.display_name == framework
|
21
|
+
addToProject = false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
if addToProject
|
25
|
+
lib_path = "Carthage/Build/iOS/" << (framework)
|
26
|
+
lib_ref = project.new_file(lib_path);
|
27
|
+
framework_buildphase.add_file_reference(lib_ref);
|
28
|
+
end
|
29
|
+
end
|
30
|
+
project.save()
|
31
|
+
end
|
32
|
+
|
33
|
+
def open_project(project_name)
|
34
|
+
return Xcodeproj::Project.open(project_name);
|
35
|
+
end
|
36
|
+
|
37
|
+
def framework_buildphase(project)
|
38
|
+
return project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXFrameworksBuildPhase}[0];
|
39
|
+
end
|
40
|
+
|
41
|
+
def frameworks
|
42
|
+
frameworks = (Dir.entries('Carthage/Build/iOS').select {|entry| File.directory? File.join('Carthage/Build/iOS',entry) and !(entry =='.' || entry == '..') })
|
43
|
+
frameworks.each do |framework|
|
44
|
+
if framework.include? ".dSYM"
|
45
|
+
frameworks.delete(framework)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
return frameworks
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crtrunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Gyesbreghs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10
|
12
|
-
dependencies:
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: xcodeproj
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: plist
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
13
55
|
description: Auto import frameworks into a project
|
14
56
|
email:
|
15
57
|
- dgyesbreghs@gmail.com
|
@@ -19,18 +61,17 @@ extensions: []
|
|
19
61
|
extra_rdoc_files: []
|
20
62
|
files:
|
21
63
|
- ".gitignore"
|
22
|
-
- CODE_OF_CONDUCT.md
|
23
64
|
- Gemfile
|
24
65
|
- LICENSE.txt
|
25
66
|
- README.md
|
26
67
|
- Rakefile
|
27
|
-
- bin/console
|
28
68
|
- bin/crtrunner
|
29
|
-
- bin/setup
|
30
69
|
- crtrunner.gemspec
|
31
70
|
- lib/crtrunner.rb
|
71
|
+
- lib/crtrunner/carthage.rb
|
32
72
|
- lib/crtrunner/version.rb
|
33
|
-
|
73
|
+
- lib/crtrunner/xcode.rb
|
74
|
+
homepage: https://github.com/icapps/crtrunner/
|
34
75
|
licenses: []
|
35
76
|
metadata: {}
|
36
77
|
post_install_message:
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
-
|
5
|
-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
-
|
7
|
-
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
-
|
9
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
-
|
11
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
-
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "crtrunner"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|