ro_commands 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +54 -0
- data/bin/ro +32 -0
- data/bin/ro_client +6 -0
- data/bin/ro_server +8 -0
- data/config/rorc.rb +2 -0
- data/lib/bash_builder.rb +92 -0
- data/lib/bash_builder_helper.rb +34 -0
- data/lib/bash_debug.rb +55 -0
- data/lib/bash_templates/git.sh +10 -0
- data/lib/bash_templates/gitflow.sh +0 -0
- data/lib/bash_templates/misc.sh +66 -0
- data/lib/bash_templates/rails.sh +0 -0
- data/lib/bash_templates/rubymine_idea.sh +5 -0
- data/lib/bash_templates/shortcuts.sh +1 -0
- data/lib/builder_templates/completions.erb +18 -0
- data/lib/builder_templates/git_flow.erb +3 -0
- data/lib/builder_templates/rails.erb +3 -0
- data/lib/builder_templates/set_envs.erb +9 -0
- data/lib/drb/client.rb +22 -0
- data/lib/drb/server.rb +33 -0
- data/lib/git_flow_builder_helper.rb +34 -0
- data/lib/methods.rb +19 -0
- data/lib/rails_builder_helper.rb +41 -0
- data/lib/ro_commands.rb +34 -0
- data/lib/ro_commands/base.rb +95 -0
- data/lib/ro_commands/core_ext/hash.rb +5 -0
- data/lib/ro_commands/core_ext/string.rb +14 -0
- data/lib/ro_commands/core_ext/symbol.rb +0 -0
- data/lib/ro_commands/core_ext/thor.rb +71 -0
- data/lib/ro_commands/dsl/file.rb +25 -0
- data/lib/ro_commands/file_actions.rb +128 -0
- data/lib/ro_commands/generate.rb +32 -0
- data/lib/ro_commands/generators/base_generator.rb +68 -0
- data/lib/ro_commands/generators/ex.rb +56 -0
- data/lib/ro_commands/generators/lib.rb +25 -0
- data/lib/ro_commands/generators/spec_file.rb +74 -0
- data/lib/ro_commands/generators/templates/ex.erb +30 -0
- data/lib/ro_commands/generators/templates/spec.erb +2 -0
- data/lib/ro_commands/git.rb +89 -0
- data/lib/ro_commands/git_flow.rb +111 -0
- data/lib/ro_commands/helpers/all.rb +8 -0
- data/lib/ro_commands/helpers/all_files.rb +21 -0
- data/lib/ro_commands/helpers/bash.rb +33 -0
- data/lib/ro_commands/helpers/out.rb +29 -0
- data/lib/ro_commands/hook.rb +102 -0
- data/lib/ro_commands/info.rb +55 -0
- data/lib/ro_commands/misc.rb +77 -0
- data/lib/ro_commands/navigate.rb +56 -0
- data/lib/ro_commands/processes.rb +12 -0
- data/lib/ro_commands/rails.rb +210 -0
- data/lib/ro_commands/refactor.rb +78 -0
- data/lib/ro_commands/ro_helper.rb +76 -0
- data/lib/ro_commands/ro_procs.rb +106 -0
- data/lib/ro_commands/rubymine.rb +17 -0
- data/lib/ro_commands/shortcuts.rb +67 -0
- data/lib/ro_commands/try.rb +11 -0
- data/lib/ro_commands/version.rb +3 -0
- data/lib/ro_commands/zeus.rb +18 -0
- data/lib/ro_commands/zeus_templates/custom_plan.rb +18 -0
- data/lib/ro_commands/zeus_templates/zeus.json +24 -0
- data/lib/ro_helper.rb +25 -0
- data/lib/shortcuts.rb +43 -0
- data/lib/spec_element.rb +24 -0
- data/lib/spec_element/describe.rb.erb +9 -0
- data/lib/tasks/roro_commands_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/roro_commands_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +235 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b8ab04e140f249b37be7aadf29a8c9629f084a70
|
4
|
+
data.tar.gz: 6983b74563ab46faa825c8548e3653dc0ee72a57
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1991878e840d4a40a3491f6cce19b942869ab8948f83c9f393d9ed1630b228509f90632c73caafb072b48cc28c06bf3402196bd5c0b4d67865e64a89208913b6
|
7
|
+
data.tar.gz: 522b6130bbc5fe654e338211f128c1809722114cac0b66a3b7a84210ec16090d6272d279a5a9ef3210858f08ae12301f9b982f5540cd44b6de32558616eefca9
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
namespace :guard do
|
2
|
+
desc 'start'
|
3
|
+
task :start do
|
4
|
+
`bundle exec guard`
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'bundler/setup'
|
10
|
+
rescue LoadError
|
11
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_func(ctn)
|
15
|
+
ctn.scan(%r{((_|\w)+)\s\(\)})
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :bash do
|
19
|
+
task :install do
|
20
|
+
ro_commands = File.expand_path("../ro_commands.sh", __FILE__)
|
21
|
+
system "echo 'source #{ro_commands}' >> ~/.bashrc"
|
22
|
+
end
|
23
|
+
|
24
|
+
task :check do
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
#require 'rdoc/task'
|
30
|
+
#
|
31
|
+
#RDoc::Task.new(:rdoc) do |rdoc|
|
32
|
+
# rdoc.rdoc_dir = 'rdoc'
|
33
|
+
# rdoc.title = 'RoroCommands'
|
34
|
+
# rdoc.options << '--line-numbers'
|
35
|
+
# rdoc.rdoc_files.include('README.rdoc')
|
36
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
+
#end
|
38
|
+
|
39
|
+
Bundler::GemHelper.install_tasks
|
40
|
+
|
41
|
+
require 'rake/testtask'
|
42
|
+
|
43
|
+
Rake::TestTask.new(:test) do |t|
|
44
|
+
t.libs << 'lib'
|
45
|
+
t.libs << 'test'
|
46
|
+
t.pattern = 'test/**/*_test.rb'
|
47
|
+
t.verbose = false
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
task default: :test
|
52
|
+
|
53
|
+
require 'rspec/core/rake_task'
|
54
|
+
RSpec::Core::RakeTask.new
|
data/bin/ro
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "active_support"
|
2
|
+
module RoCommands
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../..", __FILE__)
|
4
|
+
require "config/rorc"
|
5
|
+
|
6
|
+
arg = ARGV.shift
|
7
|
+
|
8
|
+
if arg
|
9
|
+
require 'ro_commands/base'
|
10
|
+
require "ro_commands/#{arg}"
|
11
|
+
RoCommands.const_get(arg.camelize).start
|
12
|
+
|
13
|
+
elsif arg.nil?
|
14
|
+
lib = File.expand_path("../../lib", __FILE__)
|
15
|
+
args = Dir["#{lib}/ro_commands/*"].map do |file|
|
16
|
+
if file[/\.rb$/]
|
17
|
+
File.basename(file.gsub /\.rb$/, '')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.is_helper?(str)
|
22
|
+
str.match(%r{version})
|
23
|
+
end
|
24
|
+
|
25
|
+
puts "Usage:"
|
26
|
+
args.compact.each do |arg|
|
27
|
+
unless is_helper?(arg)
|
28
|
+
puts " ro #{arg}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/bin/ro_client
ADDED
data/bin/ro_server
ADDED
data/config/rorc.rb
ADDED
data/lib/bash_builder.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../", __FILE__)
|
2
|
+
$root = File.expand_path("../..", __FILE__)
|
3
|
+
require "ro_commands/base"
|
4
|
+
require "method_source"
|
5
|
+
require "ro_commands/rails"
|
6
|
+
require "ro_commands/ro_helper"
|
7
|
+
require_relative "bash_builder_helper"
|
8
|
+
require_relative "rails_builder_helper"
|
9
|
+
require_relative "git_flow_builder_helper"
|
10
|
+
|
11
|
+
class BashBuilder
|
12
|
+
include BashBuilderHelper
|
13
|
+
include RailsBuilderHelper
|
14
|
+
include GitFlowBuilderHelper
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def build
|
18
|
+
reset_ivars
|
19
|
+
set_env
|
20
|
+
build_rails_cmds
|
21
|
+
build_rails_completions
|
22
|
+
build_git_flow_cmds
|
23
|
+
build_git_flow_completions
|
24
|
+
dir = File.expand_path("../bash_templates", __FILE__)
|
25
|
+
Dir[File.join(dir, '**')].each do |file|
|
26
|
+
tt(file)
|
27
|
+
end
|
28
|
+
|
29
|
+
write_into_bash_file
|
30
|
+
end
|
31
|
+
|
32
|
+
def _build_git_flow_cmds
|
33
|
+
build_template('git_flow')
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_git_flow_completions
|
37
|
+
@cmds = git_flows
|
38
|
+
build_completion
|
39
|
+
end
|
40
|
+
|
41
|
+
def _tt(path)
|
42
|
+
@ctn = ERB.new(File.read(path)).result(binding)
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_rails_completions
|
46
|
+
@cmds = rails_cmds
|
47
|
+
build_completion
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_template(name)
|
51
|
+
path = File.expand_path("../builder_templates/#{name}.erb", __FILE__)
|
52
|
+
|
53
|
+
@ctn = ERB.new(File.read(path)).result(binding)
|
54
|
+
puts "Building templates #{File.basename path}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def _build_completion
|
58
|
+
build_template('completions')
|
59
|
+
end
|
60
|
+
|
61
|
+
def _build_rails_cmds
|
62
|
+
build_template('rails')
|
63
|
+
end
|
64
|
+
|
65
|
+
def _set_env
|
66
|
+
build_template('set_envs')
|
67
|
+
end
|
68
|
+
|
69
|
+
def write_bash(file, ctn)
|
70
|
+
path = File.join(File.expand_path("../bash_templates", __FILE__), "#{file}.sh")
|
71
|
+
|
72
|
+
file_write(path, ctn)
|
73
|
+
end
|
74
|
+
|
75
|
+
def file_write(file, ctn)
|
76
|
+
puts "writing #{file}"
|
77
|
+
File.write(file, ctn)
|
78
|
+
end
|
79
|
+
|
80
|
+
def reset_ivars
|
81
|
+
instance_variables.each do |i|
|
82
|
+
if instance_variable_get(i).is_a?(Array)
|
83
|
+
instance_variable_set i, []
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def write_into_bash_file
|
89
|
+
file_write(target, content.join("\n"))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module BashBuilderHelper
|
2
|
+
include RoCommands::RoHelper
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def included(base)
|
6
|
+
base.extend(ClsMeths)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClsMeths
|
11
|
+
include RoCommands::RoHelper::ClassMethods
|
12
|
+
|
13
|
+
def is_helper?(meth)
|
14
|
+
::BashBuilderHelper.meths.include?(meth)
|
15
|
+
end
|
16
|
+
|
17
|
+
def ctn
|
18
|
+
@ctn ||= ""
|
19
|
+
end
|
20
|
+
|
21
|
+
def after_each
|
22
|
+
content << @ctn
|
23
|
+
end
|
24
|
+
|
25
|
+
def content
|
26
|
+
@content.uniq! if @content.respond_to?(:uniq!)
|
27
|
+
@content ||= []
|
28
|
+
end
|
29
|
+
|
30
|
+
def target
|
31
|
+
File.join($root, 'ro_commands.sh')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/bash_debug.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
$root = File.expand_path("../..", __FILE__)
|
2
|
+
class BashDebug
|
3
|
+
class << self
|
4
|
+
def get_functions
|
5
|
+
functions << ctn.scan(function_regexp)
|
6
|
+
end
|
7
|
+
|
8
|
+
def function_regexp
|
9
|
+
%r{^(?<function>(_|\w)+)\s\(\)\s}
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_shortcuts
|
13
|
+
ctn.scan(shortcut_regexp)
|
14
|
+
end
|
15
|
+
|
16
|
+
def shortcut_regexp
|
17
|
+
%r{alias (?<shortcut>)}
|
18
|
+
end
|
19
|
+
|
20
|
+
def check_repeat
|
21
|
+
repeat = shortcuts - (shortcuts - functions)
|
22
|
+
unless repeat.empty?
|
23
|
+
puts repeat
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def functions
|
28
|
+
@funcitons.flatten! if @funcitons.respond_to?(:flatten!)
|
29
|
+
@funcitons.uniq! if @funcitons.respond_to?(:uniq!)
|
30
|
+
@funcitons ||= []
|
31
|
+
end
|
32
|
+
|
33
|
+
def shortcuts
|
34
|
+
@shortcuts.uniq! if @shortcuts.respond_to?(:uniq!)
|
35
|
+
@shortcuts ||= []
|
36
|
+
end
|
37
|
+
|
38
|
+
def check
|
39
|
+
get_ctn
|
40
|
+
get_functions
|
41
|
+
get_shortcuts
|
42
|
+
check_repeat
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_ctn
|
46
|
+
path = File.join($root, 'ro_commands.sh')
|
47
|
+
@ctn = File.read(path)
|
48
|
+
end
|
49
|
+
|
50
|
+
def ctn
|
51
|
+
@ctn.uniq! if @ctn.respond_to?(:uniq!)
|
52
|
+
@ctn ||= ''
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
alias ga='git add'
|
2
|
+
alias gaa='ga .'
|
3
|
+
alias gb='git branch'
|
4
|
+
alias gco='git checkout'
|
5
|
+
alias gc='git commit -am'
|
6
|
+
alias gi='git add -i'
|
7
|
+
alias gl='git log --oneline --all --color --graph --decorate'
|
8
|
+
alias gm='git merge'
|
9
|
+
alias gp='git push -u origin master'
|
10
|
+
alias gst='git status'
|
File without changes
|
@@ -0,0 +1,66 @@
|
|
1
|
+
alias spec="ro_client generate spec_file"
|
2
|
+
alias ex="ro_client generate ex"
|
3
|
+
alias dl="cd ~/Downloads"
|
4
|
+
# cd to dir
|
5
|
+
goto () {
|
6
|
+
path=`ro_client navigate get_dir $1`
|
7
|
+
echo "cd $path"
|
8
|
+
cd "$path"
|
9
|
+
}
|
10
|
+
|
11
|
+
opendir () {
|
12
|
+
goto $1
|
13
|
+
rubymine .
|
14
|
+
}
|
15
|
+
|
16
|
+
# cd to project path
|
17
|
+
cpj () {
|
18
|
+
path=`ro_client navigate get_project $1`
|
19
|
+
echo "cd $path"
|
20
|
+
cd "$path"
|
21
|
+
}
|
22
|
+
|
23
|
+
pj () {
|
24
|
+
cpj $1
|
25
|
+
rubymine "$path"
|
26
|
+
}
|
27
|
+
|
28
|
+
cjpj () {
|
29
|
+
path=`ro_client navigate get_project $1 java`
|
30
|
+
echo "opening $path"
|
31
|
+
cd "$path"
|
32
|
+
}
|
33
|
+
|
34
|
+
jpj () {
|
35
|
+
path=`ro_client navigate get_project $1 java`
|
36
|
+
echo "opening $path"
|
37
|
+
cd "$path"
|
38
|
+
idea "$path"
|
39
|
+
}
|
40
|
+
|
41
|
+
rp () {
|
42
|
+
cd "$ruby_projects"
|
43
|
+
}
|
44
|
+
|
45
|
+
dp () {
|
46
|
+
cd "~/Dropbox"
|
47
|
+
}
|
48
|
+
|
49
|
+
# js java project
|
50
|
+
alias jp="cd $js_java_projects"
|
51
|
+
|
52
|
+
alias fas="ro_client file_actions"
|
53
|
+
alias rps="ro_client ro_procs"
|
54
|
+
alias rclocal="sudo rubymine /etc/rc.local"
|
55
|
+
alias wp='working_project'
|
56
|
+
|
57
|
+
alias work_project="cd $work_project"
|
58
|
+
alias l="cd $learn"
|
59
|
+
|
60
|
+
#find railscasts
|
61
|
+
alias rc="ro_client file_actions find_railscasts"
|
62
|
+
|
63
|
+
# reload ~/.bashrc
|
64
|
+
alias rb="source ~/.bashrc"
|
65
|
+
|
66
|
+
alias proxy="http_proxy='socks5://127.0.0.1:1080'"
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
alias work="ro_client shortcuts work"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% @cmds.each do |o| %>
|
2
|
+
<% if o.suggestion %>
|
3
|
+
_<%= o.shortcut %> () {
|
4
|
+
local cur options command commands
|
5
|
+
_get_comp_words_by_ref cur
|
6
|
+
commands=$(<%= o.suggestion %>)
|
7
|
+
local cur="${COMP_WORDS[$COMP_CWORD]}"
|
8
|
+
|
9
|
+
if [ -z "($commands)" ]; then
|
10
|
+
echo '' >> /dev/null
|
11
|
+
else
|
12
|
+
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
|
13
|
+
fi
|
14
|
+
}
|
15
|
+
|
16
|
+
complete -o default -F _<%= o.shortcut %> <%= o.shortcut %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|