ripl-profiles 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.summary = "This ripl plugin adds a --profile option to ripl that loads profile files in ~/.ripl/profiles."
14
14
  s.description = "This ripl plugin adds a --profile option to ripl that loads profile files in ~/.ripl/profiles before starting ripl."
15
15
  s.required_rubygems_version = ">= 1.3.6"
16
- s.add_dependency 'ripl', '>= 0.2.8'
16
+ s.add_dependency 'ripl', '>= 0.3.6'
17
17
  s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
18
18
  s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
19
19
  s.license = 'MIT'
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.2.0
2
+ * Load profiles before Shell#before_loop (be compatible with ripl-multi_line 0.3.0).
3
+
1
4
  == 0.1.4
2
5
  * Load profiles before irbrc.
3
6
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT LICENSE
2
2
 
3
- Copyright (c) 2010 Jan Lelis
3
+ Copyright (c) 2010-2011 Jan Lelis
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/lib/ripl/profiles.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'ripl'
2
2
 
3
3
  module Ripl::Profiles
4
- VERSION = '0.1.4'
4
+ VERSION = '0.2.0'
5
5
 
6
6
  @loaded = []
7
7
 
8
- Ripl::Runner::OPTIONS << ['-p', '--profile NAME', 'Use a profile']
8
+ Ripl::Runner::OPTIONS << ['-p, --profile NAME', 'Use a profile']
9
9
 
10
10
  class << self
11
11
  attr_reader :loaded
@@ -28,6 +28,17 @@ module Ripl::Profiles
28
28
  end
29
29
  }
30
30
  end
31
+
32
+ def load_from_config
33
+ if Ripl.config[:profiles_default] && Ripl::Profiles.loaded.empty?
34
+ Ripl::Profiles.load Ripl.config[:profiles_default]
35
+ end
36
+
37
+ if Ripl.config[:profiles_base]
38
+ Ripl::Profiles.load Ripl.config[:profiles_base]
39
+ end
40
+ end
41
+
31
42
  end
32
43
 
33
44
  # command shortcuts
@@ -45,22 +56,6 @@ module Ripl::Profiles
45
56
  end
46
57
  end
47
58
 
48
- module Shell
49
- # load default profile if non is set
50
- def before_loop
51
- if Ripl.config[:profiles_default] && Ripl::Profiles.loaded.empty?
52
- Ripl::Profiles.load Ripl.config[:profiles_default]
53
- end
54
-
55
- if Ripl.config[:profiles_base]
56
- Ripl::Profiles.load Ripl.config[:profiles_base]
57
- end
58
-
59
- # next plugins, load irbrc and make Ripl::Commands available
60
- super
61
- end
62
- end
63
-
64
59
  module Runner
65
60
  # add command line option
66
61
  def parse_option( option, argv )
@@ -73,9 +68,18 @@ module Ripl::Profiles
73
68
  end
74
69
  end
75
70
 
76
- Ripl::Runner.send :extend, Ripl::Profiles::Runner
77
- Ripl::Shell.send :include, Ripl::Profiles::Shell
78
- Ripl::Commands.send :include, Ripl::Profiles::Commands
71
+ # hack into Shell#loop to get extra rights (run before before_loop)
72
+ class Ripl::Shell
73
+ def loop
74
+ Ripl::Profiles.load_from_config
75
+ before_loop
76
+ catch(:ripl_exit) { while(true) do; loop_once; end }
77
+ after_loop
78
+ end
79
+ end
80
+
81
+ Ripl::Runner.extend Ripl::Profiles::Runner
82
+ Ripl::Commands.include Ripl::Profiles::Commands
79
83
 
80
84
  Ripl.config[:profiles_prefix] ||= "~/.ripl/profiles/"
81
85
  Ripl.config[:profiles_verbose] ||= false
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripl-profiles
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
4
+ prerelease:
5
+ version: 0.2.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Jan Lelis
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-12-20 00:00:00 +01:00
18
- default_executable:
13
+ date: 2011-04-28 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: ripl
@@ -25,11 +20,7 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 2
31
- - 8
32
- version: 0.2.8
23
+ version: 0.3.6
33
24
  type: :runtime
34
25
  version_requirements: *id001
35
26
  description: This ripl plugin adds a --profile option to ripl that loads profile files in ~/.ripl/profiles before starting ripl.
@@ -49,7 +40,6 @@ files:
49
40
  - deps.rip
50
41
  - Rakefile
51
42
  - .gemspec
52
- has_rdoc: true
53
43
  homepage: http://github.com/janlelis/ripl-profiles
54
44
  licenses:
55
45
  - MIT
@@ -63,23 +53,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
53
  requirements:
64
54
  - - ">="
65
55
  - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
56
  version: "0"
69
57
  required_rubygems_version: !ruby/object:Gem::Requirement
70
58
  none: false
71
59
  requirements:
72
60
  - - ">="
73
61
  - !ruby/object:Gem::Version
74
- segments:
75
- - 1
76
- - 3
77
- - 6
78
62
  version: 1.3.6
79
63
  requirements: []
80
64
 
81
65
  rubyforge_project:
82
- rubygems_version: 1.3.7
66
+ rubygems_version: 1.7.2
83
67
  signing_key:
84
68
  specification_version: 3
85
69
  summary: This ripl plugin adds a --profile option to ripl that loads profile files in ~/.ripl/profiles.