dyci 0.0.3 → 0.0.4

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.
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use ree" > .rvmrc
9
+ environment_id="ree-1.8.7-2012.02@dyci_compiler"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.13.6 (stable)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi
@@ -4,29 +4,23 @@ require 'dyci/commands/install_command'
4
4
  module DyCI
5
5
  class Runner
6
6
  def initialize args
7
- command_class = self.command_klass args
8
- if command_class
9
- command = command_class.new
10
- command.run
11
- end
7
+ command_class = self.command_klass args.shift
8
+ command_class.run(args) if command_class
12
9
  end
13
10
 
14
- def command_klass args
15
- case args[0]
16
- # when 'setup'
17
- # Setup
11
+ def command_klass arg
12
+ case arg
18
13
  when 'install'
19
14
  InstallCommand
20
- # when 'uninstall'
21
- # Uninstall
22
- # when 'cleanup'
23
- # Cleanup
24
15
  else
25
- # TODO: add usage
26
- puts "print usage"
27
- nil
16
+ usage
17
+ exit 0
28
18
  end
29
19
  end
30
20
 
21
+ def usage
22
+ puts "Usage"
23
+ end
24
+
31
25
  end
32
26
  end
@@ -2,26 +2,93 @@ require 'fileutils'
2
2
 
3
3
  module DyCI
4
4
  class InstallCommand
5
- def run
6
- dyci_helper_plugin = "DyCIHelper"
7
- dyci_fake_clang_plugin = "DyCIFakeClang"
8
- self.install_plugin dyci_helper_plugin
9
- self.install_plugin dyci_fake_clang_plugin
10
- end
5
+ class << self
6
+ def run args
7
+ if args.count.zero?
8
+ usage
9
+ exit 0
10
+ end
11
+ args.each do | arg |
12
+ command = "install_#{arg}".to_sym
13
+ if self.respond_to? command
14
+ self.send command
15
+ else
16
+ puts "Unknown command '#{command}'"
17
+ end
18
+ end
19
+ end
11
20
 
12
- def plugins_dir
13
- user_dir = File.expand_path("~")
14
- plugins_dir = "#{user_dir}/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
15
- FileUtils.mkdir_p plugins_dir
16
- plugins_dir
17
- end
21
+ def usage
22
+ puts "print usage"
23
+ end
18
24
 
19
- def install_plugin plugin_name
20
- puts "Install #{plugin_name}"
21
- root_path = File.expand_path "../../../..", __FILE__
22
- FileUtils.cp_r "#{root_path}/lib/plugins/#{plugin_name}.xcplugin", "#{self.plugins_dir}/"
23
- end
25
+ def install_helper
26
+ self.install_xcode_plugin 'DyCIHelper'
27
+ end
28
+
29
+ def install_as_plugin
30
+ self.install_helper
31
+ self.install_xcode_plugin 'DyCIFakeClang'
32
+ end
33
+
34
+ def install_as_proxy
35
+ self.install_helper
36
+ self.replace_clang
37
+ end
38
+
39
+ def install_app_code
40
+ app_code_path = "#{File.expand_path '~'}/Library/Preferences/appCode10"
41
+ if Dir.exists? app_code_path
42
+ puts "AppCode preferences was not found at path '#{app_code_path}'"
43
+ return
44
+ end
45
+ app_code_plugin_path = "#{app_code_path}/tools/"
46
+ FileUtils.mkdir_p app_code_plugin_path
47
+ app_code_plugin = "#{self.root_path}/pligins/AppCode/DyCIPlugin.xml"
48
+ FileUtils.cp app_code_plugin, app_code_plugin_path
49
+ end
50
+
51
+ def backup_clang
52
+ clang_path = clang_location
53
+ clang_backup_path = "#{clang_path}.backup"
54
+ unless File.exists? clang_backup_path
55
+ puts "Create clang backup"
56
+ puts "#{clang_path} => #{clang_backup_path}"
57
+ %x[ sudo cp #{clang_path} #{clang_backup_path} ]
58
+ end
59
+ end
24
60
 
61
+ def replace_clang
62
+ self.backup_clang
63
+ proxy_path = Gem.bin_path 'dyci-compiler', 'dyci-compiler'
64
+ clang_path = clang_location
65
+ puts "Replace clang with proxy script"
66
+ puts "#{proxy_path} => #{clang_path}"
67
+ %x[ sudo cp #{proxy_path} #{clang_path} ]
68
+ end
69
+
70
+ def install_xcode_plugin plugin_name
71
+ puts "Install #{plugin_name}"
72
+ FileUtils.cp_r "#{self.root_path}/lib/plugins/#{plugin_name}.xcplugin", "#{self.plugins_dir}/"
73
+ end
74
+
75
+ def clang_location
76
+ developer_path = %x[ xcode-select -print-path ].chomp
77
+ "#{developer_path}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
78
+ end
79
+
80
+ def plugins_dir
81
+ user_dir = File.expand_path("~")
82
+ plugins_dir = "#{user_dir}/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
83
+ FileUtils.mkdir_p plugins_dir
84
+ plugins_dir
85
+ end
86
+
87
+ def root_path
88
+ File.expand_path "../../../..", __FILE__
89
+ end
90
+
91
+ end
25
92
  end
26
93
  end
27
94
 
@@ -0,0 +1,13 @@
1
+ module DyCI
2
+ class SetupCommand
3
+ def self.run args
4
+ command = SetupCommand.new args
5
+ end
6
+
7
+ def initialize args = nil
8
+
9
+ end
10
+
11
+ end
12
+ end
13
+
@@ -1,3 +1,3 @@
1
1
  module DyCI
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <toolSet name="Dynamic Code Injection">
3
+ <tool name="Recompile and inject" description="Recompiles current file (.h, .m). And puts it correctly" showInMainMenu="false" showInEditor="true" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" synchronizeAfterRun="false">
4
+ <exec>
5
+ <option name="COMMAND" value="/usr/bin/dyci-compiler" />
6
+ <option name="PARAMETERS" value="recompile &quot;$FilePath$&quot;" />
7
+ <option name="WORKING_DIRECTORY" value="/usr/bin" />
8
+ </exec>
9
+ </tool>
10
+ </toolSet>
11
+
metadata CHANGED
@@ -1,47 +1,42 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dyci
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 3
9
- version: 0.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Alex Denisov
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-11-12 00:00:00 +02:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: dyci-compiler
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 0
30
- - 2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
31
21
  version: 0.0.2
32
22
  type: :runtime
33
- version_requirements: *id001
34
- description: ": Write a gem description"
35
- email:
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.2
30
+ description: ': Write a gem description'
31
+ email:
36
32
  - 1101.debian@gmail.com
37
- executables:
33
+ executables:
38
34
  - dyci
39
35
  extensions: []
40
-
41
36
  extra_rdoc_files: []
42
-
43
- files:
37
+ files:
44
38
  - .gitignore
39
+ - .rvmrc
45
40
  - Gemfile
46
41
  - LICENSE
47
42
  - README.md
@@ -50,41 +45,36 @@ files:
50
45
  - dyci.gemspec
51
46
  - lib/dyci.rb
52
47
  - lib/dyci/commands/install_command.rb
48
+ - lib/dyci/commands/setup_command.rb
53
49
  - lib/dyci/version.rb
54
50
  - lib/plugins/.DS_Store
51
+ - lib/plugins/AppCode/DyCIPlugin.xml
55
52
  - lib/plugins/DyCIFakeClang.xcplugin/Contents/Info.plist
56
53
  - lib/plugins/DyCIFakeClang.xcplugin/Contents/Resources/DyCIFakeClang.xcspec
57
54
  - lib/plugins/DyCIHelper.xcplugin/Contents/Info.plist
58
55
  - lib/plugins/DyCIHelper.xcplugin/Contents/MacOS/SFDCIHelper
59
- has_rdoc: true
60
- homepage: ""
56
+ homepage: ''
61
57
  licenses: []
62
-
63
58
  post_install_message:
64
59
  rdoc_options: []
65
-
66
- require_paths:
60
+ require_paths:
67
61
  - lib
68
- required_ruby_version: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- segments:
73
- - 0
74
- version: "0"
75
- required_rubygems_version: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- segments:
80
- - 0
81
- version: "0"
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
82
74
  requirements: []
83
-
84
75
  rubyforge_project:
85
- rubygems_version: 1.3.6
76
+ rubygems_version: 1.8.24
86
77
  signing_key:
87
78
  specification_version: 3
88
- summary: ": Write a gem summary"
79
+ summary: ': Write a gem summary'
89
80
  test_files: []
90
-