irt 1.2.10 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.markdown +4 -1
- data/VERSION +1 -1
- data/bin/irt +10 -9
- data/irt.gemspec +18 -25
- data/lib/irt/extensions/rails.rb +3 -64
- data/lib/irt/extensions/rails_server.rb +68 -0
- metadata +71 -75
- data/Rakefile +0 -60
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -716,6 +716,9 @@ to be fully reloaded, so it is slower, but guaranteed.
|
|
716
716
|
|
717
717
|
### Rails Server Sessions
|
718
718
|
|
719
|
+
Notice: this feature is optional. If you want to enable it you must `require 'irt/extensions/rails_server'` after
|
720
|
+
the irt gem gets loaded.
|
721
|
+
|
719
722
|
The server sessions are a quick way to interact with your application while your server is running,
|
720
723
|
without the need to launch a the irt executable: you can do almost everything you can from a regular IRT session
|
721
724
|
launched from the irt executable, besides you have access to the server internals.
|
@@ -796,4 +799,4 @@ Please, send me a line if this issue is bugging you, so I will try to fix it fas
|
|
796
799
|
|
797
800
|
## Copyright
|
798
801
|
|
799
|
-
Copyright (c) 2010-
|
802
|
+
Copyright (c) 2010-2012 Domizio Demichelis. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.11
|
data/bin/irt
CHANGED
@@ -34,15 +34,15 @@ EOB
|
|
34
34
|
options[:irb_options] = opt
|
35
35
|
end
|
36
36
|
|
37
|
-
options[:rails_env] = 'development'
|
37
|
+
options[:rails_env] = ENV['RAILS_ENV'] || 'development'
|
38
38
|
opts.on( '-e', '--rails-env [ENVIRONMENT]', 'Sets the Rails Environment' ) do |env|
|
39
39
|
options[:rails_env] = env
|
40
40
|
end
|
41
41
|
|
42
42
|
options[:no_rails] = false
|
43
43
|
opts.on( '-n', '--no-rails', 'Does not autoload the Rails Environment' ) do
|
44
|
-
|
45
|
-
|
44
|
+
options[:no_rails] = true
|
45
|
+
end
|
46
46
|
|
47
47
|
opts.on( '-v', '--version', 'Shows the version and exits' ) do
|
48
48
|
puts IRT.version
|
@@ -85,7 +85,7 @@ if files.empty?
|
|
85
85
|
end
|
86
86
|
|
87
87
|
cmd_format = if File.exists?('./config/environment.rb') && !options[:no_rails]
|
88
|
-
ENV['RAILS_ENV'] = options[:rails_env]
|
88
|
+
ENV['RAILS_ENV'] = options[:rails_env] if options[:rails_env]
|
89
89
|
if File.exists?('./script/rails')
|
90
90
|
gemfile = File.read('Gemfile')
|
91
91
|
unless gemfile.match(/\bgem\b.+\birt\b/)
|
@@ -96,10 +96,11 @@ cmd_format = if File.exists?('./config/environment.rb') && !options[:no_rails]
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
minor, patch = gemfile.match(/\bgem\b.+\brails\b.+3\.(\d+)\.(\d+)/).captures
|
100
|
+
rails_version = (minor.to_i > 0 || patch.to_i > 9) ? :new : :old
|
100
101
|
'rails c %s %s %s'
|
101
102
|
elsif File.exists?('./script/console')
|
102
|
-
rails_version =
|
103
|
+
rails_version = :old
|
103
104
|
'ruby script/console --irb="irt_rails2 %2$s" %1$s %3$s'
|
104
105
|
end
|
105
106
|
else
|
@@ -110,10 +111,10 @@ ENV['IRT_INTERACTIVE_EOF'] = options[:interactive_eof].inspect if options[:inter
|
|
110
111
|
|
111
112
|
files.each do |file|
|
112
113
|
ENV['IRT_COMMAND'] = case rails_version
|
113
|
-
when
|
114
|
-
sprintf cmd_format, options[:irb_options], file, options[:rails_env]
|
115
|
-
when '>=3.1.*'
|
114
|
+
when :new
|
116
115
|
sprintf cmd_format, options[:rails_env], options[:irb_options], file
|
116
|
+
when :old
|
117
|
+
sprintf cmd_format, options[:irb_options], file, options[:rails_env]
|
117
118
|
else
|
118
119
|
sprintf cmd_format, options[:irb_options], file
|
119
120
|
end
|
data/irt.gemspec
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
name = File.basename( __FILE__, '.gemspec' )
|
2
|
-
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
3
1
|
require 'date'
|
4
2
|
require File.expand_path('../lib/irt/ruby_version.rb', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
|
-
|
8
|
-
s.authors
|
9
|
-
s.email
|
10
|
-
s.homepage
|
11
|
-
s.summary
|
12
|
-
s.description
|
13
|
-
|
14
|
-
s.
|
15
|
-
s.
|
16
|
-
s.
|
17
|
-
|
18
|
-
s.
|
19
|
-
s.
|
20
|
-
s.
|
5
|
+
s.name = 'irt'
|
6
|
+
s.authors = ["Domizio Demichelis"]
|
7
|
+
s.email = 'dd.nexus@gmail.com'
|
8
|
+
s.homepage = 'http://github.com/ddnexus/irt'
|
9
|
+
s.summary = 'Interactive Ruby Tools - Very improved irb and Rails Console with a lot of cool features.'
|
10
|
+
s.description = 'If you use IRT in place of irb or Rails Console, you will have more tools that will make your life a lot easier.'
|
11
|
+
s.executables = ['irt', 'irt_irb', 'irt_rails2']
|
12
|
+
s.extra_rdoc_files = ["README.markdown"]
|
13
|
+
s.require_paths = ["lib"]
|
14
|
+
s.files = `git ls-files -z`.split("\0") - %w[irt-tutorial.pdf]
|
15
|
+
s.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
16
|
+
s.date = Date.today.to_s
|
17
|
+
s.required_rubygems_version = ">= 1.3.6"
|
18
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
19
|
+
s.post_install_message = <<EOM
|
21
20
|
________________________________________________________________________________
|
22
21
|
|
23
22
|
IMPORTANT NOTES
|
@@ -41,13 +40,7 @@ ________________________________________________________________________________
|
|
41
40
|
________________________________________________________________________________
|
42
41
|
|
43
42
|
EOM
|
44
|
-
s.
|
45
|
-
s.
|
46
|
-
s.
|
47
|
-
|
48
|
-
s.required_rubygems_version = ">= 1.3.6"
|
49
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
50
|
-
s.extra_rdoc_files = ["README.markdown"]
|
51
|
-
s.require_paths = ["lib"]
|
52
|
-
|
43
|
+
s.add_runtime_dependency('differ', [">= 0.1.1"])
|
44
|
+
s.add_runtime_dependency('dye', [">= 0.1.3"])
|
45
|
+
s.add_runtime_dependency('prompter', [">= 0.1.4"])
|
53
46
|
end
|
data/lib/irt/extensions/rails.rb
CHANGED
@@ -3,12 +3,13 @@ class ActiveSupport::BufferedLogger
|
|
3
3
|
alias_method :original_add, :add
|
4
4
|
|
5
5
|
def add(*args)
|
6
|
-
|
6
|
+
original_add(*args)
|
7
|
+
message = args[1]
|
7
8
|
# no inline log when in rails server and not interactive mode
|
8
9
|
return message if IRB.CurrentContext.nil? || IRT.rails_server && IRB.CurrentContext.irt_mode != :interactive
|
9
10
|
if IRT.rails_log
|
10
11
|
if IRT.dye_rails_log
|
11
|
-
plain_message = Dye.strip_ansi(message).chomp
|
12
|
+
plain_message = message.match(/\e\[[\d;]+m/) ? Dye.strip_ansi(message).chomp : message
|
12
13
|
irt_message = IRT.dye(plain_message, :log_color) + "\n"
|
13
14
|
end
|
14
15
|
puts irt_message || message
|
@@ -18,71 +19,9 @@ class ActiveSupport::BufferedLogger
|
|
18
19
|
|
19
20
|
end
|
20
21
|
|
21
|
-
module Kernel
|
22
|
-
|
23
|
-
alias_method :original_irt, :irt
|
24
|
-
def irt(bind)
|
25
|
-
raise IRT::ArgumentTypeError, "You must pass binding instead of #{bind.class.name} object" unless bind.is_a?(Binding)
|
26
|
-
IRT.send(:rails_server_notice_wrap) do
|
27
|
-
IRT.start
|
28
|
-
IRT::Session.enter :binding, bind
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
require 'rack/server'
|
35
|
-
module Rack
|
36
|
-
class Server
|
37
|
-
alias_method :original_server, :server
|
38
|
-
def server
|
39
|
-
# override the SIGINT trap in the Rack::Server.start method allowing multiple choices
|
40
|
-
# since #server is also called after the Rack::Server.start trap
|
41
|
-
IRT.start
|
42
|
-
IRT.rails_server_sigint_trap = trap('SIGINT') { IRT.rails_signal_handle }
|
43
|
-
IRT.rails_server = original_server
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
22
|
|
48
23
|
module IRT
|
49
24
|
|
50
|
-
def rails_signal_handle
|
51
|
-
puts
|
52
|
-
rails_server_notice_wrap do
|
53
|
-
trap('SIGINT'){}
|
54
|
-
input = IRT::Prompter.choose " [s]hutdown, [i]rt or [c]ancel?", /^(s|i|c)$/i,
|
55
|
-
:hint => '[<enter>=s|i|c]', :default => 's'
|
56
|
-
trap('SIGINT') { rails_signal_handle }
|
57
|
-
case input
|
58
|
-
when 's'
|
59
|
-
IRT.rails_server_sigint_trap.call
|
60
|
-
when 'i'
|
61
|
-
Session.enter :interactive
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def rails_server_notice_wrap
|
69
|
-
return yield unless rails_server
|
70
|
-
IRT::Prompter.say_notice "Server suspended"
|
71
|
-
yield
|
72
|
-
IRT::Prompter.say_notice "Server resumed"
|
73
|
-
end
|
74
|
-
|
75
|
-
module Utils
|
76
|
-
alias_method :original_ask_run_new_file, :ask_run_new_file
|
77
|
-
# skips asking to run the save file if it is a tmp file in a server session
|
78
|
-
# because the server is exiting so no rerun is possible
|
79
|
-
def ask_run_new_file(new_file_path, source_path, tmp)
|
80
|
-
return if tmp && IRT.rails_server
|
81
|
-
original_ask_run_new_file(new_file_path, source_path, tmp)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
25
|
module Commands
|
87
26
|
module Core
|
88
27
|
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# this file patches the rack server and irt in order to enter irt from the server execution
|
2
|
+
# you should require this file after loading irt.rb
|
3
|
+
|
4
|
+
module Kernel
|
5
|
+
|
6
|
+
alias_method :original_irt, :irt
|
7
|
+
def irt(bind)
|
8
|
+
raise IRT::ArgumentTypeError, "You must pass binding instead of #{bind.class.name} object" unless bind.is_a?(Binding)
|
9
|
+
IRT.send(:rails_server_notice_wrap) do
|
10
|
+
IRT.start
|
11
|
+
IRT::Session.enter :binding, bind
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'rack/server'
|
18
|
+
module Rack
|
19
|
+
class Server
|
20
|
+
alias_method :original_server, :server
|
21
|
+
def server
|
22
|
+
# override the SIGINT trap in the Rack::Server.start method allowing multiple choices
|
23
|
+
# since #server is also called after the Rack::Server.start trap
|
24
|
+
IRT.start
|
25
|
+
IRT.rails_server_sigint_trap = trap('SIGINT') { IRT.rails_signal_handle }
|
26
|
+
IRT.rails_server = original_server
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module IRT
|
32
|
+
|
33
|
+
def rails_signal_handle
|
34
|
+
puts
|
35
|
+
rails_server_notice_wrap do
|
36
|
+
trap('SIGINT'){}
|
37
|
+
input = IRT::Prompter.choose " [s]hutdown, [i]rt or [c]ancel?", /^(s|i|c)$/i,
|
38
|
+
:hint => '[<enter>=s|i|c]', :default => 's'
|
39
|
+
trap('SIGINT') { rails_signal_handle }
|
40
|
+
case input
|
41
|
+
when 's'
|
42
|
+
IRT.rails_server_sigint_trap.call
|
43
|
+
when 'i'
|
44
|
+
Session.enter :interactive
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def rails_server_notice_wrap
|
52
|
+
return yield unless rails_server
|
53
|
+
IRT::Prompter.say_notice "Server suspended"
|
54
|
+
yield
|
55
|
+
IRT::Prompter.say_notice "Server resumed"
|
56
|
+
end
|
57
|
+
|
58
|
+
module Utils
|
59
|
+
alias_method :original_ask_run_new_file, :ask_run_new_file
|
60
|
+
# skips asking to run the save file if it is a tmp file in a server session
|
61
|
+
# because the server is exiting so no rerun is possible
|
62
|
+
def ask_run_new_file(new_file_path, source_path, tmp)
|
63
|
+
return if tmp && IRT.rails_server
|
64
|
+
original_ask_run_new_file(new_file_path, source_path, tmp)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
metadata
CHANGED
@@ -1,66 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: irt
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.11
|
4
5
|
prerelease:
|
5
|
-
version: 1.2.10
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Domizio Demichelis
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: differ
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 0.1.1
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: dye
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: dye
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
31
33
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
35
37
|
version: 0.1.3
|
36
38
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: prompter
|
40
39
|
prerelease: false
|
41
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: prompter
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
46
53
|
version: 0.1.4
|
47
54
|
type: :runtime
|
48
|
-
|
49
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.4
|
62
|
+
description: If you use IRT in place of irb or Rails Console, you will have more tools
|
63
|
+
that will make your life a lot easier.
|
50
64
|
email: dd.nexus@gmail.com
|
51
|
-
executables:
|
65
|
+
executables:
|
52
66
|
- irt
|
53
67
|
- irt_irb
|
54
68
|
- irt_rails2
|
55
69
|
extensions: []
|
56
|
-
|
57
|
-
extra_rdoc_files:
|
70
|
+
extra_rdoc_files:
|
58
71
|
- README.markdown
|
59
|
-
files:
|
72
|
+
files:
|
60
73
|
- .gitignore
|
61
74
|
- LICENSE
|
62
75
|
- README.markdown
|
63
|
-
- Rakefile
|
64
76
|
- VERSION
|
65
77
|
- bin/irt
|
66
78
|
- bin/irt_irb
|
@@ -87,6 +99,7 @@ files:
|
|
87
99
|
- lib/irt/extensions/method.rb
|
88
100
|
- lib/irt/extensions/object.rb
|
89
101
|
- lib/irt/extensions/rails.rb
|
102
|
+
- lib/irt/extensions/rails_server.rb
|
90
103
|
- lib/irt/helpers/rails.rb
|
91
104
|
- lib/irt/history.rb
|
92
105
|
- lib/irt/hunks.rb
|
@@ -96,55 +109,38 @@ files:
|
|
96
109
|
- lib/irt/ruby_version.rb
|
97
110
|
- lib/irt/session.rb
|
98
111
|
- lib/irt/utils.rb
|
99
|
-
has_rdoc: true
|
100
112
|
homepage: http://github.com/ddnexus/irt
|
101
113
|
licenses: []
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
IRT.fix_readline_prompt = true
|
113
|
-
|
114
|
-
(see the README file for details)
|
115
|
-
|
116
|
-
________________________________________________________________________________
|
117
|
-
|
118
|
-
2. In order to use the IRT contextual ri command, one of the following gems
|
119
|
-
must be installed:
|
120
|
-
|
121
|
-
"bri" if you run ruby >= 1.9.2
|
122
|
-
"fastri" if you run ruby < 1.9.2
|
123
|
-
|
124
|
-
________________________________________________________________________________
|
125
|
-
|
126
|
-
rdoc_options:
|
114
|
+
post_install_message: ! "________________________________________________________________________________\n\n
|
115
|
+
\ IMPORTANT NOTES\n________________________________________________________________________________\n\n
|
116
|
+
\ 1. If you notice a messed prompt while navigating the history, you must\n enable
|
117
|
+
the 'fix_readline_prompt' option in the ~/.irtrc file:\n\n IRT.fix_readline_prompt
|
118
|
+
= true\n\n (see the README file for details)\n\n________________________________________________________________________________\n\n
|
119
|
+
\ 2. In order to use the IRT contextual ri command, one of the following gems\n
|
120
|
+
\ must be installed:\n\n \"bri\" if you run ruby >= 1.9.2\n \"fastri\"
|
121
|
+
if you run ruby < 1.9.2\n\n________________________________________________________________________________\n\n"
|
122
|
+
rdoc_options:
|
127
123
|
- --charset=UTF-8
|
128
|
-
require_paths:
|
124
|
+
require_paths:
|
129
125
|
- lib
|
130
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
127
|
none: false
|
132
|
-
requirements:
|
133
|
-
- -
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version:
|
136
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
133
|
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
141
137
|
version: 1.3.6
|
142
138
|
requirements: []
|
143
|
-
|
144
139
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.
|
140
|
+
rubygems_version: 1.8.24
|
146
141
|
signing_key:
|
147
142
|
specification_version: 3
|
148
|
-
summary: Interactive Ruby Tools - Very improved irb and Rails Console with a lot of
|
143
|
+
summary: Interactive Ruby Tools - Very improved irb and Rails Console with a lot of
|
144
|
+
cool features.
|
149
145
|
test_files: []
|
150
|
-
|
146
|
+
has_rdoc:
|
data/Rakefile
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
name = 'irt'
|
2
|
-
|
3
|
-
def ensure_clean(action, force=false)
|
4
|
-
if !force && ! `git status -s`.empty?
|
5
|
-
puts <<-EOS.gsub(/^ {6}/, '')
|
6
|
-
Rake task aborted: the working tree is dirty!
|
7
|
-
If you know what you are doing you can use \`rake #{action}[force]\`"
|
8
|
-
EOS
|
9
|
-
exit(1)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
desc "Install the gem"
|
14
|
-
task :install, :force do |t, args|
|
15
|
-
ensure_clean(:install, args.force)
|
16
|
-
orig_version = version = File.read('VERSION').strip
|
17
|
-
begin
|
18
|
-
commit_id = `git log -1 --format="%h" HEAD`.strip
|
19
|
-
version = "#{orig_version}.#{commit_id}"
|
20
|
-
File.open('VERSION', 'w') {|f| f.puts version }
|
21
|
-
gem_name = "#{name}-#{version}.gem"
|
22
|
-
sh %(gem build #{name}.gemspec)
|
23
|
-
sh %(gem install #{gem_name} --local --no-rdoc --no-ri)
|
24
|
-
puts <<-EOS.gsub(/^ {6}/, '')
|
25
|
-
|
26
|
-
*******************************************************************************
|
27
|
-
* NOTICE *
|
28
|
-
*******************************************************************************
|
29
|
-
* The version id of locally installed gems is comparable to a --pre version: *
|
30
|
-
* i.e. it is alphabetically ordered (not numerically ordered), besides it *
|
31
|
-
* includes the sah1 commit id which is not aphabetically ordered, so be sure *
|
32
|
-
* your application picks the version you really intend to use *
|
33
|
-
*******************************************************************************
|
34
|
-
|
35
|
-
EOS
|
36
|
-
ensure
|
37
|
-
remove_entry_secure gem_name, true
|
38
|
-
File.open('VERSION', 'w') {|f| f.puts orig_version }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
desc %(Remove all the "#{name}" installed gems and executables and install this version)
|
43
|
-
task :clean_install, :force do |t, args|
|
44
|
-
ensure_clean(:install, args.force)
|
45
|
-
sh %(gem uninstall #{name} --all --ignore-dependencies --executables)
|
46
|
-
Rake::Task['install'].invoke(args.force)
|
47
|
-
end
|
48
|
-
|
49
|
-
desc "Push the gem to rubygems.org"
|
50
|
-
task :push, :force do |t, args|
|
51
|
-
begin
|
52
|
-
ensure_clean(:push, args.force)
|
53
|
-
version = File.read('VERSION').strip
|
54
|
-
gem_name = "#{name}-#{version}.gem"
|
55
|
-
sh %(gem build #{name}.gemspec)
|
56
|
-
sh %(gem push #{gem_name})
|
57
|
-
ensure
|
58
|
-
remove_entry_secure gem_name, true
|
59
|
-
end
|
60
|
-
end
|