rkit 0.0.1
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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/rkit +4 -0
- data/lib/rkit.rb +68 -0
- data/lib/rkit/version.rb +3 -0
- data/rkit.gemspec +24 -0
- metadata +72 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/rkit
ADDED
data/lib/rkit.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
#require "rkit/version"
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
class OptParse
|
7
|
+
def self.parse(args)
|
8
|
+
options = OpenStruct.new
|
9
|
+
options.path = "~/Projects/my"
|
10
|
+
options.delay_for_browser = 15
|
11
|
+
|
12
|
+
opts = OptionParser.new do |opts|
|
13
|
+
opts.on("--path PATH", "Path to your Rails app") do |s|
|
14
|
+
options.path = s
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on("-p", "--project NAME", "Project name of your Rails app") do |s|
|
18
|
+
options.project = s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.parse!(args)
|
23
|
+
options.path = File.expand_path(options.path)
|
24
|
+
options.full_path = [options.path, options.project].join("/")
|
25
|
+
options
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Rkit
|
30
|
+
def initialize(args)
|
31
|
+
@options = args
|
32
|
+
|
33
|
+
unless File.directory?(@options.full_path)
|
34
|
+
puts "Err: Invalid path #{@options.full_path}"
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
|
38
|
+
unless @options.project
|
39
|
+
puts "Err: Specify project name with -p"
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
run_programs
|
44
|
+
end
|
45
|
+
|
46
|
+
def open_gedit
|
47
|
+
system("gedit --new-window #{@options.full_path}/Gemfile &")
|
48
|
+
end
|
49
|
+
|
50
|
+
def open_terminal
|
51
|
+
system("gnome-terminal --working-directory #{@options.full_path} --command='rails s' &")
|
52
|
+
end
|
53
|
+
|
54
|
+
def open_browser
|
55
|
+
sleep(@options.delay_for_browser)
|
56
|
+
system("firefox --new-window http://localhost:3000 &")
|
57
|
+
end
|
58
|
+
|
59
|
+
def run_programs
|
60
|
+
open_gedit
|
61
|
+
open_terminal
|
62
|
+
open_browser
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
options = OptParse.parse(ARGV)
|
67
|
+
rkit = Rkit.new(options)
|
68
|
+
|
data/lib/rkit/version.rb
ADDED
data/rkit.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rkit/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rkit"
|
7
|
+
s.version = Rkit::VERSION
|
8
|
+
s.authors = ["Stefan Huska"]
|
9
|
+
s.email = ["stefan.huska@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Rails related programs opener}
|
12
|
+
s.description = %q{Opens gedit with Gemfile, terminal with rails server command and browser with localhost:3000}
|
13
|
+
|
14
|
+
s.rubyforge_project = "rkit"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rkit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Stefan Huska
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-09-01 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Opens gedit with Gemfile, terminal with rails server command and browser with localhost:3000
|
22
|
+
email:
|
23
|
+
- stefan.huska@gmail.com
|
24
|
+
executables:
|
25
|
+
- rkit
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
32
|
+
- Gemfile
|
33
|
+
- Rakefile
|
34
|
+
- bin/rkit
|
35
|
+
- lib/rkit.rb
|
36
|
+
- lib/rkit/version.rb
|
37
|
+
- rkit.gemspec
|
38
|
+
homepage: ""
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project: rkit
|
67
|
+
rubygems_version: 1.8.10
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Rails related programs opener
|
71
|
+
test_files: []
|
72
|
+
|