cocoapods-keys 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +52 -3
- data/README.md +2 -0
- data/Rakefile +10 -2
- data/lib/cocoapods_keys.rb +1 -1
- data/lib/keyring_liberator.rb +33 -33
- data/lib/plugin.rb +36 -41
- data/lib/pod/command/keys.rb +0 -1
- data/lib/pod/command/keys/get.rb +2 -2
- data/lib/pod/command/keys/set.rb +3 -1
- data/spec/fixtures/Keys_empty.h +1 -1
- data/spec/fixtures/Keys_empty.m +1 -1
- data/spec/fixtures/Podfile +8 -0
- data/spec/fixtures/dump-key.m +45 -0
- data/spec/functional_spec.rb +72 -0
- data/spec/key_master_spec.rb +4 -2
- data/spec/spec_helper.rb +4 -0
- data/templates/Keys.h.erb +1 -1
- data/templates/Keys.m.erb +1 -1
- data/templates/Keys.podspec.json +23 -0
- metadata +10 -3
- data/lib/pod/command/keys/generate.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7c5d62383ab9ac2287735144c277f3099d90f36
|
4
|
+
data.tar.gz: dab1b6a1541c32ba40e8c6ad38663a2b34feff4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d539ff6b1552ea3961339bd953454b5c44667355d984859c60f15a5f05df58eed5b54df7d6eff2086bfa13423ba86fa4b958174c45a5aa7c23b8d0d09763b3
|
7
|
+
data.tar.gz: 2774d1839f1726299ed43b92dc5317ec7ff31735cb9e2c53ea049d4ef4d0768d300c078ef8bc8c4fc7d5fce025af7c2e78e2f7d740ebc0de24c48cfe571d21cd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
## Master
|
2
|
+
|
3
|
+
## 1.2.0
|
4
|
+
|
5
|
+
* Support for correctly scoping Keys to a target [orta]
|
6
|
+
* Support CocoaPods 0.37+ via CocoaPods development Pods [orta]
|
7
|
+
|
8
|
+
## 1.1.0
|
9
|
+
|
10
|
+
* Don't integrate in a project unless keys is declared in the `plugin` [orta]
|
11
|
+
|
12
|
+
## 1.0.2
|
13
|
+
|
14
|
+
* Support both :key and "key" in user settings [alloy]
|
15
|
+
* Use ERB templates for the .m & .h [lyricsboy]
|
16
|
+
* Frameworks support [ashfurrow]
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,59 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocoapods-keys (1.
|
4
|
+
cocoapods-keys (1.2.0)
|
5
5
|
osx_keychain
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
RubyInline (3.12.
|
10
|
+
RubyInline (3.12.4)
|
11
11
|
ZenTest (~> 4.3)
|
12
12
|
ZenTest (4.11.0)
|
13
|
+
activesupport (4.2.1)
|
14
|
+
i18n (~> 0.7)
|
15
|
+
json (~> 1.7, >= 1.7.7)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
18
|
+
tzinfo (~> 1.1)
|
19
|
+
claide (0.8.1)
|
20
|
+
cocoapods (0.36.3)
|
21
|
+
activesupport (>= 3.2.15)
|
22
|
+
claide (~> 0.8.1)
|
23
|
+
cocoapods-core (= 0.36.3)
|
24
|
+
cocoapods-downloader (~> 0.9.0)
|
25
|
+
cocoapods-plugins (~> 0.4.1)
|
26
|
+
cocoapods-trunk (~> 0.6.0)
|
27
|
+
cocoapods-try (~> 0.4.3)
|
28
|
+
colored (~> 1.2)
|
29
|
+
escape (~> 0.0.4)
|
30
|
+
molinillo (~> 0.2.1)
|
31
|
+
nap (~> 0.8)
|
32
|
+
open4 (~> 1.3)
|
33
|
+
xcodeproj (~> 0.23.1)
|
34
|
+
cocoapods-core (0.36.3)
|
35
|
+
activesupport (>= 3.2.15)
|
36
|
+
fuzzy_match (~> 2.0.4)
|
37
|
+
nap (~> 0.8.0)
|
38
|
+
cocoapods-downloader (0.9.0)
|
39
|
+
cocoapods-plugins (0.4.2)
|
40
|
+
nap
|
41
|
+
cocoapods-trunk (0.6.0)
|
42
|
+
nap (>= 0.8)
|
43
|
+
netrc (= 0.7.8)
|
44
|
+
cocoapods-try (0.4.3)
|
45
|
+
colored (1.2)
|
13
46
|
diff-lcs (1.2.5)
|
14
|
-
|
47
|
+
escape (0.0.4)
|
48
|
+
fuzzy_match (2.0.4)
|
49
|
+
i18n (0.7.0)
|
50
|
+
json (1.8.2)
|
51
|
+
minitest (5.5.1)
|
52
|
+
molinillo (0.2.3)
|
53
|
+
nap (0.8.0)
|
54
|
+
netrc (0.7.8)
|
55
|
+
open4 (1.3.4)
|
56
|
+
osx_keychain (1.0.1)
|
15
57
|
RubyInline (~> 3)
|
16
58
|
rake (10.3.2)
|
17
59
|
rspec (3.2.0)
|
@@ -27,12 +69,19 @@ GEM
|
|
27
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
70
|
rspec-support (~> 3.2.0)
|
29
71
|
rspec-support (3.2.2)
|
72
|
+
thread_safe (0.3.5)
|
73
|
+
tzinfo (1.2.2)
|
74
|
+
thread_safe (~> 0.1)
|
75
|
+
xcodeproj (0.23.1)
|
76
|
+
activesupport (>= 3)
|
77
|
+
colored (~> 1.2)
|
30
78
|
|
31
79
|
PLATFORMS
|
32
80
|
ruby
|
33
81
|
|
34
82
|
DEPENDENCIES
|
35
83
|
bundler (~> 1.3)
|
84
|
+
cocoapods
|
36
85
|
cocoapods-keys!
|
37
86
|
rake
|
38
87
|
rspec
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
![Build Status](https://travis-ci.org/orta/cocoapods-keys.svg)
|
2
|
+
|
1
3
|
A key value store for enviroment and application keys.
|
2
4
|
|
3
5
|
Its good security practice to keep production keys out of developer hands. CocoaPods-keys makes it easy to have per-user config settings stored securely in the developer's keychain, and not in the application source. It is a plugin that once installed will run on every `pod install` or `pod update`.
|
data/Rakefile
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
-
require "rspec/core/rake_task"
|
3
2
|
|
4
|
-
|
3
|
+
dump_keys_tool = 'spec/fixtures/dump-key'
|
4
|
+
dump_keys_source_file = "#{dump_keys_tool}.m"
|
5
|
+
file dump_keys_tool => dump_keys_source_file do
|
6
|
+
sh "xcrun clang -framework Foundation #{dump_keys_source_file} -o #{dump_keys_tool}"
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Run tests"
|
10
|
+
task :spec => dump_keys_tool do
|
11
|
+
sh "bundle exec rspec spec/*_spec.rb"
|
12
|
+
end
|
5
13
|
|
6
14
|
task :default => :spec
|
data/lib/cocoapods_keys.rb
CHANGED
data/lib/keyring_liberator.rb
CHANGED
@@ -3,48 +3,48 @@ require "yaml"
|
|
3
3
|
require "pathname"
|
4
4
|
|
5
5
|
module CocoaPodsKeys
|
6
|
-
|
6
|
+
class KeyringLiberator
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
# Gets given a gives back a Keyring for the project
|
9
|
+
# by basically parsing it out of ~/.cocoapods/keys/"pathMD5".yml
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def self.keys_dir
|
12
|
+
Pathname.new("~/.cocoapods/keys/").expand_path.to_s
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def self.yaml_path_for_path(path)
|
16
|
+
sha = Digest::MD5.hexdigest(path)
|
17
|
+
File.join(keys_dir, sha + '.yml')
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
def self.get_keyring(path)
|
21
|
+
get_keyring_at_path(yaml_path_for_path(path))
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.get_keyring_named(name)
|
25
|
+
self.get_all_keyrings.find { |k| k.name == name }
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
def self.save_keyring(keyring)
|
29
|
+
`mkdir -p #{keys_dir}`
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
File.open(yaml_path_for_path(keyring.path), 'w') {|f| f.write(YAML::dump(keyring.to_hash)) }
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
rings
|
34
|
+
def self.get_all_keyrings
|
35
|
+
return [] unless Dir.exist? keys_dir
|
36
|
+
rings = []
|
37
|
+
Dir.glob(keys_dir + "/*.yml").each do |path|
|
38
|
+
rings << get_keyring_at_path(path)
|
41
39
|
end
|
40
|
+
rings
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
def self.get_keyring_at_path(path)
|
46
|
-
Keyring.from_hash(YAML.load(File.read(path))) if File.exist?(path)
|
47
|
-
end
|
43
|
+
private
|
48
44
|
|
45
|
+
def self.get_keyring_at_path(path)
|
46
|
+
Keyring.from_hash(YAML.load(File.read(path))) if File.exist?(path)
|
49
47
|
end
|
48
|
+
|
49
|
+
end
|
50
50
|
end
|
data/lib/plugin.rb
CHANGED
@@ -2,23 +2,48 @@ require 'cocoapods-core'
|
|
2
2
|
|
3
3
|
module CocoaPodsKeys
|
4
4
|
class << self
|
5
|
-
|
5
|
+
|
6
|
+
def setup
|
7
|
+
require 'preinstaller'
|
8
|
+
|
9
|
+
PreInstaller.new(user_options).setup
|
10
|
+
|
11
|
+
# move our podspec in to the Pods
|
12
|
+
`mkdir Pods/CocoaPodsKeys` unless Dir.exists? "Pods/CocoaPodsKeys"
|
13
|
+
podspec_path = File.join(__dir__, "../templates", "Keys.podspec.json")
|
14
|
+
`cp "#{podspec_path}" Pods/CocoaPodsKeys`
|
15
|
+
|
16
|
+
# Get all the keys
|
6
17
|
local_user_options = user_options || {}
|
7
18
|
project = local_user_options.fetch("project") { CocoaPodsKeys::NameWhisperer.get_project_name }
|
8
19
|
keyring = KeyringLiberator.get_keyring_named(project) || KeyringLiberator.get_keyring(Dir.getwd)
|
9
20
|
raise Pod::Informative, "Could not load keyring" unless keyring
|
21
|
+
|
22
|
+
# Create the h & m files in the same folder as the podspec
|
10
23
|
key_master = KeyMaster.new(keyring)
|
24
|
+
interface_file = File.join("Pods/CocoaPodsKeys", key_master.name + '.h')
|
25
|
+
implementation_file = File.join("Pods/CocoaPodsKeys", key_master.name + '.m')
|
26
|
+
|
27
|
+
File.write(interface_file, key_master.interface)
|
28
|
+
File.write(implementation_file, key_master.implementation)
|
29
|
+
|
30
|
+
# Add our template podspec
|
31
|
+
if user_options["target"]
|
32
|
+
# Support correct scoping for a target
|
33
|
+
target = podfile.root_target_definitions.map(&:children).flatten.find do |target|
|
34
|
+
target.label == "Pods-" + user_options["target"].to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
if target
|
38
|
+
target.store_pod 'Keys', :path => 'Pods/CocoaPodsKeys/'
|
39
|
+
else
|
40
|
+
puts "Could not find a target named '#{user_options["target"]}' in your Podfile. Stopping Keys.".red
|
41
|
+
end
|
11
42
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def setup
|
17
|
-
require 'preinstaller'
|
18
|
-
|
19
|
-
PreInstaller.new(user_options).setup
|
20
|
-
# Add our template podspec (needs to be remote, not local).
|
21
|
-
podfile.pod 'Keys', :git => 'https://github.com/ashfurrow/empty-podspec.git'
|
43
|
+
else
|
44
|
+
# otherwise let it go in global
|
45
|
+
podfile.pod 'Keys', :path => 'Pods/CocoaPodsKeys/'
|
46
|
+
end
|
22
47
|
end
|
23
48
|
|
24
49
|
private
|
@@ -45,41 +70,11 @@ module Pod
|
|
45
70
|
|
46
71
|
def install!
|
47
72
|
CocoaPodsKeys.setup if validates_for_keys
|
48
|
-
|
49
73
|
install_before_cocoapods_keys!
|
50
74
|
end
|
51
75
|
|
52
76
|
def validates_for_keys
|
53
77
|
Pod::Config.instance.podfile.plugins["cocoapods-keys"] != nil
|
54
78
|
end
|
55
|
-
|
56
|
-
class Analyzer
|
57
|
-
class SandboxAnalyzer
|
58
|
-
alias_method :pod_state_before_cocoapods_keys, :pod_state
|
59
|
-
|
60
|
-
def pod_state(pod)
|
61
|
-
if pod == 'Keys'
|
62
|
-
# return :added if we were, otherwise assume the Keys have :changed since last install, following my mother's "Better Safe than Sorry" principle.
|
63
|
-
return :added if pod_added?(pod)
|
64
|
-
:changed
|
65
|
-
else
|
66
|
-
pod_state_before_cocoapods_keys(pod)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
class Specification
|
74
|
-
class << self
|
75
|
-
alias_method :from_string_before_cocoapods_keys, :from_string
|
76
|
-
|
77
|
-
def from_string(spec_contents, path, subspec_name = nil)
|
78
|
-
if path.basename.to_s =~ /\AKeys.podspec(?:.json)\Z/
|
79
|
-
CocoaPodsKeys.podspec_for_current_project(spec_contents)
|
80
|
-
end
|
81
|
-
from_string_before_cocoapods_keys(spec_contents, path, subspec_name)
|
82
|
-
end
|
83
|
-
end
|
84
79
|
end
|
85
80
|
end
|
data/lib/pod/command/keys.rb
CHANGED
data/lib/pod/command/keys/get.rb
CHANGED
data/lib/pod/command/keys/set.rb
CHANGED
@@ -6,6 +6,8 @@ module Pod
|
|
6
6
|
class Keys
|
7
7
|
|
8
8
|
class Set < Keys
|
9
|
+
include Config::Mixin
|
10
|
+
|
9
11
|
self.summary = "A set values for keys."
|
10
12
|
|
11
13
|
self.description = <<-DESC
|
@@ -43,7 +45,7 @@ module Pod
|
|
43
45
|
|
44
46
|
keyring.save @key_name, @key_value
|
45
47
|
|
46
|
-
puts "Saved #{@key_name} to #{keyring.name}."
|
48
|
+
puts "Saved #{@key_name} to #{keyring.name}." unless config.silent?
|
47
49
|
end
|
48
50
|
|
49
51
|
def current_keyring
|
data/spec/fixtures/Keys_empty.h
CHANGED
data/spec/fixtures/Keys_empty.m
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
// Dumps a key from a fixture bundle created like so:
|
2
|
+
//
|
3
|
+
// $ xcrun clang -framework Foundation -bundle ArtsyKeys.m -o ArtsyKeys.bundle
|
4
|
+
|
5
|
+
#import <Foundation/Foundation.h>
|
6
|
+
#include <dlfcn.h>
|
7
|
+
#include <stdio.h>
|
8
|
+
|
9
|
+
int main(int argc, char **argv) {
|
10
|
+
if (argc != 3) {
|
11
|
+
fprintf(stderr, "Usage: dump-key path/to/fixture.bundle [KEY]\n");
|
12
|
+
return 1;
|
13
|
+
}
|
14
|
+
|
15
|
+
char *fixturePath = argv[1];
|
16
|
+
char *keyName = argv[2];
|
17
|
+
|
18
|
+
if (dlopen(fixturePath, RTLD_NOW) == NULL) {
|
19
|
+
fprintf(stderr, "[!] Unable to load bundle at path `%s`: %s\n", fixturePath, strerror(errno));
|
20
|
+
return 2;
|
21
|
+
}
|
22
|
+
|
23
|
+
NSString *fixtureClassName = [[[NSString stringWithUTF8String:fixturePath] lastPathComponent] stringByDeletingPathExtension];
|
24
|
+
Class fixtureClass = NSClassFromString(fixtureClassName);
|
25
|
+
if (fixtureClass == nil) {
|
26
|
+
fprintf(stderr, "[!] Unable to load fixture class `%s` from bundle at `%s`\n", [fixtureClassName UTF8String], fixturePath);
|
27
|
+
return 3;
|
28
|
+
}
|
29
|
+
|
30
|
+
SEL keySelector = sel_registerName(keyName);
|
31
|
+
if (![fixtureClass instancesRespondToSelector:keySelector]) {
|
32
|
+
fprintf(stderr, "[!] Unable to find key `%s` in fixture class `%s` from bundle at `%s`\n", keyName, [fixtureClassName UTF8String], fixturePath);
|
33
|
+
return 4;
|
34
|
+
}
|
35
|
+
|
36
|
+
NSString *key = [[fixtureClass new] performSelector:keySelector];
|
37
|
+
// TODO Or is a `nil` entry fine?
|
38
|
+
if (key == nil) {
|
39
|
+
fprintf(stderr, "[!] Got `nil` for key `%s` in fixture class `%s` from bundle at `%s`\n", keyName, [fixtureClassName UTF8String], fixturePath);
|
40
|
+
return 5;
|
41
|
+
}
|
42
|
+
|
43
|
+
printf("%s\n", [key UTF8String]);
|
44
|
+
return 0;
|
45
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
describe 'CocoaPodsKeys functional tests' do
|
6
|
+
before :all do
|
7
|
+
@tmpdir = Dir.mktmpdir
|
8
|
+
Dir.chdir(@tmpdir) do
|
9
|
+
FileUtils.mkdir('TestProject.xcodeproj')
|
10
|
+
File.open('Podfile', 'w') do |podfile|
|
11
|
+
podfile.puts <<-PODFILE
|
12
|
+
platform :ios, '7'
|
13
|
+
plugin 'cocoapods-keys', {
|
14
|
+
:project => 'TestProject',
|
15
|
+
:keys => [
|
16
|
+
'KeyWithData',
|
17
|
+
'AnotherKeyWithData',
|
18
|
+
# This is not included!
|
19
|
+
# 'UnusedKey'
|
20
|
+
]
|
21
|
+
}
|
22
|
+
PODFILE
|
23
|
+
end
|
24
|
+
|
25
|
+
system("pod keys set KeyWithData such-data --silent")
|
26
|
+
system("pod keys set AnotherKeyWithData other-data --silent")
|
27
|
+
system("pod keys set UnusedKey - --silent")
|
28
|
+
system("pod install --silent --no-repo-update --no-integrate")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "does not directly encode the keys into the implementation file" do
|
33
|
+
source = File.read(File.join(@tmpdir, 'Pods/CocoaPodsKeys/TestProjectKeys.m'))
|
34
|
+
expect(source).to_not include('such-data')
|
35
|
+
expect(source).to_not include('other-data')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "is able to retrieve the correct keys from the command-line" do
|
39
|
+
Dir.chdir(@tmpdir) do
|
40
|
+
expect(`pod keys get KeyWithData`.strip).to eq('such-data')
|
41
|
+
expect(`pod keys get AnotherKeyWithData`.strip).to eq('other-data')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "with a built keys implementation" do
|
46
|
+
before :all do
|
47
|
+
name = 'TestProjectKeys'
|
48
|
+
dir = File.join(@tmpdir, 'Pods/CocoaPodsKeys')
|
49
|
+
Dir.chdir(dir) do
|
50
|
+
system("xcrun clang -framework Foundation -bundle #{name}.m -o #{name}.bundle")
|
51
|
+
end
|
52
|
+
@bundle = File.join(dir, "#{name}.bundle")
|
53
|
+
end
|
54
|
+
|
55
|
+
it "produces an implementation that is able to return the correct keys" do
|
56
|
+
expect(fetch_key('keyWithData')).to eq('such-data')
|
57
|
+
expect(fetch_key('anotherKeyWithData')).to eq('other-data')
|
58
|
+
end
|
59
|
+
|
60
|
+
xit "does not include keys that were not specified in the Podfile" do
|
61
|
+
expect(lambda { fetch_key('unusedKey') }).to raise_error
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def fetch_key(key)
|
67
|
+
result = `'#{fixture('dump-key')}' '#{@bundle}' #{key}`.strip
|
68
|
+
raise 'Failed to fetch key from bundle' unless $?.success?
|
69
|
+
result
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/spec/key_master_spec.rb
CHANGED
@@ -4,11 +4,11 @@ require 'tmpdir'
|
|
4
4
|
|
5
5
|
describe CocoaPodsKeys::KeyMaster do
|
6
6
|
let(:empty_keys_interface) {
|
7
|
-
|
7
|
+
File.read(fixture("Keys_empty.h"))
|
8
8
|
}
|
9
9
|
|
10
10
|
let(:empty_keys_implementation) {
|
11
|
-
|
11
|
+
File.read(fixture("Keys_empty.m"))
|
12
12
|
}
|
13
13
|
|
14
14
|
it "should work with an empty keyring" do
|
@@ -39,6 +39,8 @@ describe CocoaPodsKeys::KeyMaster do
|
|
39
39
|
expect(keymaster.generate_implementation).to include('"\\""')
|
40
40
|
end
|
41
41
|
|
42
|
+
private
|
43
|
+
|
42
44
|
def validate_syntax(keymaster)
|
43
45
|
# write out the interface and the implementation to temp files
|
44
46
|
Dir.mktmpdir do |dir|
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,10 @@ def clang_available
|
|
5
5
|
system("which -s clang")
|
6
6
|
end
|
7
7
|
|
8
|
+
def fixture(name)
|
9
|
+
File.join(__dir__, "fixtures", name)
|
10
|
+
end
|
11
|
+
|
8
12
|
RSpec.configure do |c|
|
9
13
|
# exclude tests requiring clang when it's unavailable
|
10
14
|
c.filter_run_excluding requires_clang: true unless clang_available
|
data/templates/Keys.h.erb
CHANGED
data/templates/Keys.m.erb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"name": "Keys",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"summary": "Injected podspec used by CocoaPods-Keys plugin.",
|
5
|
+
"description": "This is intended to be used as an injected podspec template \n used by the [CocoaPods-Keys plugin](https://github.com/orta/cocoapods-keys).\n\n It should *not* be referenced outside of that context. \n",
|
6
|
+
"homepage": "https://github.com/orta/cocoapods-keys",
|
7
|
+
"license": {
|
8
|
+
"type": "MIT",
|
9
|
+
"text": "MIT LICENSE Found in the repo"
|
10
|
+
},
|
11
|
+
"authors": {
|
12
|
+
"Orta Therox": "orta.therox@gmail.com",
|
13
|
+
"Samuel Giddins": "segiddins@segiddins.me",
|
14
|
+
"Ash Furrow": "ash@ashfurrow.com"
|
15
|
+
},
|
16
|
+
"source": {
|
17
|
+
"git": "https://github.com/orta/cocoapods-keys.git",
|
18
|
+
"tag": "23"
|
19
|
+
},
|
20
|
+
"source_files": "*",
|
21
|
+
"frameworks": "Foundation",
|
22
|
+
"requires_arc": true
|
23
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: osx_keychain
|
@@ -77,6 +77,7 @@ extra_rdoc_files: []
|
|
77
77
|
files:
|
78
78
|
- ".gitignore"
|
79
79
|
- ".travis.yml"
|
80
|
+
- CHANGELOG.md
|
80
81
|
- Gemfile
|
81
82
|
- Gemfile.lock
|
82
83
|
- LICENSE.txt
|
@@ -91,7 +92,6 @@ files:
|
|
91
92
|
- lib/name_whisperer.rb
|
92
93
|
- lib/plugin.rb
|
93
94
|
- lib/pod/command/keys.rb
|
94
|
-
- lib/pod/command/keys/generate.rb
|
95
95
|
- lib/pod/command/keys/get.rb
|
96
96
|
- lib/pod/command/keys/list.rb
|
97
97
|
- lib/pod/command/keys/rm.rb
|
@@ -99,12 +99,16 @@ files:
|
|
99
99
|
- lib/preinstaller.rb
|
100
100
|
- spec/fixtures/Keys_empty.h
|
101
101
|
- spec/fixtures/Keys_empty.m
|
102
|
+
- spec/fixtures/Podfile
|
103
|
+
- spec/fixtures/dump-key.m
|
104
|
+
- spec/functional_spec.rb
|
102
105
|
- spec/key_master_spec.rb
|
103
106
|
- spec/keyring_liberator_spec.rb
|
104
107
|
- spec/plugin_spec.rb
|
105
108
|
- spec/spec_helper.rb
|
106
109
|
- templates/Keys.h.erb
|
107
110
|
- templates/Keys.m.erb
|
111
|
+
- templates/Keys.podspec.json
|
108
112
|
homepage: https://github.com/cocoapods/cocoapods-keys
|
109
113
|
licenses:
|
110
114
|
- MIT
|
@@ -134,6 +138,9 @@ summary: CocoaPods Keys will store sensitive data in your Mac's keychain. Then o
|
|
134
138
|
test_files:
|
135
139
|
- spec/fixtures/Keys_empty.h
|
136
140
|
- spec/fixtures/Keys_empty.m
|
141
|
+
- spec/fixtures/Podfile
|
142
|
+
- spec/fixtures/dump-key.m
|
143
|
+
- spec/functional_spec.rb
|
137
144
|
- spec/key_master_spec.rb
|
138
145
|
- spec/keyring_liberator_spec.rb
|
139
146
|
- spec/plugin_spec.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'keyring_liberator'
|
2
|
-
require 'key_master'
|
3
|
-
|
4
|
-
module Pod
|
5
|
-
class Command
|
6
|
-
class Keys
|
7
|
-
class Generate < Keys
|
8
|
-
include CocoaPodsKeys
|
9
|
-
|
10
|
-
self.summary = "Generates the .h and .m files representing the keys."
|
11
|
-
|
12
|
-
self.description = <<-DESC
|
13
|
-
Generates the Objective-C class containing obfuscated keys for the project
|
14
|
-
in the current working directory (if it exists). The .h and .m files are
|
15
|
-
generated in the current working directory.
|
16
|
-
DESC
|
17
|
-
|
18
|
-
def initialize(argv)
|
19
|
-
@project_name = argv.shift_argument
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
def run
|
24
|
-
key_master = KeyMaster.new(@keyring)
|
25
|
-
|
26
|
-
interface_file = key_master.name + '.h'
|
27
|
-
implementation_file = key_master.name + '.m'
|
28
|
-
|
29
|
-
File.write(interface_file, key_master.interface)
|
30
|
-
File.write(implementation_file, key_master.implementation)
|
31
|
-
end
|
32
|
-
|
33
|
-
def validate!
|
34
|
-
super
|
35
|
-
verify_podfile_exists!
|
36
|
-
|
37
|
-
@keyring = KeyringLiberator.get_keyring_named(@project_name) || KeyringLiberator.get_keyring(Dir.getwd)
|
38
|
-
help! "No keys associated with this directory or project name." unless @keyring
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|