dependencyswapper 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/dependencyswapper/DependencyReplacer.rb +31 -20
- data/lib/dependencyswapper/cli.rb +1 -14
- data/lib/dependencyswapper/version.rb +1 -1
- data/pkg/dependencyswapper-0.3.0.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b373936514939c9ba4f38cb9ad43fad3e4e91e1
|
4
|
+
data.tar.gz: 471edad590870e8bdc9e4dac498eb70eb750bd75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15734e45c6922250e765593a6cea6b39ac09119fe8c5e75c2d7293ffb68abe2fbe290fc6f7fdb81bfcc11bfd0b7292bb424b42fc0f9ad2ceadfdb927504a0411
|
7
|
+
data.tar.gz: 4da67691c32609ff683e8973fcad9c1cc2a3716b4374fd8dd5d73eda7b77fef4399dc91b03399e3457f98eee4a98c76f703c5cdaad4fe55f783c3d27707e4544
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Dependencyswapper also known as `depswapper` is a CocoaPods plugin that allows to switch between "dev/test/prod" environments with just running a simple ruby command.
|
4
4
|
|
5
|
-
As a watchOS, tvOS and iOS Framework developer I often find myself wanting to debug my non source Frameworks to make sure the problem is not in my dependent Application/Framework. It is always time consuming to have to find the `Podfile`, then look for the git repository of the Framework I want to debug and then google the syntax to read from a git repository. With
|
5
|
+
As a watchOS, tvOS and iOS Framework developer I often find myself wanting to debug my non source Frameworks to make sure the problem is not in my dependent Application/Framework. It is always time consuming to have to find the `Podfile`, then look for the git repository of the Framework I want to debug and then google the syntax to read from a git repository. With `depswapper` you will be able to change between source/non source pods with just one command in the terminal.
|
6
6
|
|
7
7
|
|
8
8
|
## Installation
|
@@ -23,9 +23,10 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
First it is very important to run a setup command. This is as simple as running `depswapper setup` in the console.
|
27
26
|
|
28
|
-
|
27
|
+
Whenever you want to swap environments on any of your dependencies, run `depswapper test "NameOfYourFramework"` or `depswapper dev "NameOfYourFramework"` at the root of your Project.
|
28
|
+
- The `dev` subcommand will clone the git repository for the pod and point to it locally.
|
29
|
+
- The `test` subcommand will pull the pod directly from the git repository and pull it as source.
|
29
30
|
|
30
31
|
## Contributing
|
31
32
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'tempfile'
|
4
4
|
require 'json'
|
5
|
+
require 'find'
|
5
6
|
|
6
7
|
module Dependency
|
7
8
|
class DependencyReplacer
|
@@ -20,56 +21,66 @@ module Dependency
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def run
|
23
|
-
|
24
24
|
file_lines = ''
|
25
|
-
file = File.read("#{Dir.home}/.depswapper/depmapper.json")
|
26
|
-
dependency_replacements = JSON.parse(file)
|
25
|
+
# file = File.read("#{Dir.home}/.depswapper/depmapper.json")
|
26
|
+
# dependency_replacements = JSON.parse(file)
|
27
27
|
|
28
28
|
IO.readlines(@podfile_path).each do |line|
|
29
29
|
file_lines += line unless line.include? "'" + dependency_name + "'"
|
30
30
|
if line.include? "'" + dependency_name + "'"
|
31
|
-
# We will look
|
32
|
-
|
31
|
+
# We will look in the cocoapods public/private repos to map each Framework with its git repository.
|
32
|
+
directories = Dir.glob("#{Dir.home}/.cocoapods/repos/**/" + dependency_name + ".podspec.json")
|
33
|
+
file = File.read(directories.last)
|
34
|
+
dependency_replacements = JSON.parse(file)
|
35
|
+
|
36
|
+
remote_url = dependency_replacements["homepage"]
|
33
37
|
if remote_url.to_s.empty?
|
34
|
-
puts "You are missing the dependency mapping for " + dependency_name + ".
|
35
|
-
else
|
38
|
+
puts "You are missing the dependency mapping for " + dependency_name + "."
|
39
|
+
else
|
40
|
+
url_extension = File.extname(remote_url)
|
41
|
+
if url_extension.to_s.empty?
|
42
|
+
remote_url = remote_url + ".git"
|
43
|
+
end
|
36
44
|
file_lines += "pod '" + @dependency_name + "', :git => '" + remote_url + "'\n"
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
40
|
-
|
41
|
-
#<extra string manipulation to file_lines if you wanted>
|
42
|
-
|
43
48
|
File.open(@podfile_path, 'w') do |file|
|
44
49
|
file.puts file_lines
|
45
50
|
end
|
51
|
+
`pod install`
|
46
52
|
end
|
47
53
|
|
48
54
|
def dev
|
49
|
-
|
50
55
|
file_lines = ''
|
51
|
-
file = File.read("#{Dir.home}/.depswapper/depmapper.json")
|
52
|
-
dependency_replacements = JSON.parse(file)
|
53
|
-
|
54
56
|
IO.readlines(@podfile_path).each do |line|
|
55
57
|
file_lines += line unless line.include? "'" + dependency_name + "'"
|
56
58
|
if line.include? "'" + dependency_name + "'"
|
57
|
-
|
58
|
-
|
59
|
+
# We will look in the cocoapods public/private repos to map each Framework with its git repository.
|
60
|
+
directories = Dir.glob("#{Dir.home}/.cocoapods/repos/**/" + dependency_name + ".podspec.json")
|
61
|
+
file = File.read(directories.last)
|
62
|
+
dependency_replacements = JSON.parse(file)
|
63
|
+
|
64
|
+
remote_url = dependency_replacements["homepage"]
|
59
65
|
if remote_url.to_s.empty?
|
60
|
-
puts "You are missing the dependency mapping for " + dependency_name + ".
|
66
|
+
puts "You are missing the dependency mapping for " + dependency_name + "."
|
61
67
|
else
|
62
|
-
|
68
|
+
url_extension = File.extname(remote_url)
|
69
|
+
if url_extension.to_s.empty?
|
70
|
+
remote_url = remote_url + ".git"
|
71
|
+
end
|
72
|
+
unless File.directory?("dev-#{dependency_name}")
|
73
|
+
`git clone #{remote_url} dev-#{dependency_name}`
|
74
|
+
end
|
63
75
|
file_lines += "pod '" + @dependency_name + "', :path => './dev-" + dependency_name + "/'\n"
|
64
76
|
end
|
65
77
|
end
|
66
78
|
end
|
67
79
|
|
68
|
-
#<extra string manipulation to file_lines if you wanted>
|
69
|
-
|
70
80
|
File.open(@podfile_path, 'w') do |file|
|
71
81
|
file.puts file_lines
|
72
82
|
end
|
83
|
+
`pod install`
|
73
84
|
end
|
74
85
|
end
|
75
86
|
end
|
@@ -11,24 +11,11 @@
|
|
11
11
|
end
|
12
12
|
|
13
13
|
desc "development FrameworkName", "Pulls the FrameworkName as development pod(editable source)"
|
14
|
+
option :exclude_repo
|
14
15
|
def dev(name)
|
15
16
|
Dependency::DependencySwapper.new({
|
16
17
|
:dependency_name => name
|
17
18
|
}).dev
|
18
19
|
end
|
19
|
-
|
20
|
-
desc "setup", "Initial setup for depswapper"
|
21
|
-
def setup
|
22
|
-
puts "Make sure to add your dependency mappings in the ~/.depswapper/depmapper.json file!"
|
23
|
-
`if [ ! -d ~/.depswapper ]; then
|
24
|
-
mkdir -p ~/.depswapper;
|
25
|
-
fi
|
26
|
-
|
27
|
-
if [ ! -e ~/.depswapper/depmapper.json ];then
|
28
|
-
touch ~/.depswapper/depmapper.json
|
29
|
-
echo '{\n\t\"DependencyName\":\"git-url\"\n}' > ~/.depswapper/depmapper.json
|
30
|
-
fi
|
31
|
-
`
|
32
|
-
end
|
33
20
|
end
|
34
21
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependencyswapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Terns
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/dependencyswapper/version.rb
|
99
99
|
- pkg/dependencyswapper-0.1.0.gem
|
100
100
|
- pkg/dependencyswapper-0.2.0.gem
|
101
|
+
- pkg/dependencyswapper-0.3.0.gem
|
101
102
|
homepage: https://github.com/pkrmf/dependencyswapper
|
102
103
|
licenses:
|
103
104
|
- MIT
|