lws 0.4.2 → 6.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8a4f59dac348f40f4c5530b07d71147a9c4078e
4
- data.tar.gz: 94615b304d6d65389c35b1ee741cfb5e7d6cdfc3
3
+ metadata.gz: b11d23c335c4b23d73d44dc4da82d94efcc3d73f
4
+ data.tar.gz: 86e4b3e6ea6c9e9113d6f5bbda0202bab47b0c32
5
5
  SHA512:
6
- metadata.gz: afbc173c984051c4577386663d57e31166fcbca9428ef17f8a5a4f293be346061ee9adc35d0a865aff52a005513cca2cf2946174a229d6965999a7ea4836d23f
7
- data.tar.gz: 9ca37c4dc44a665191bf06163f52f340de2e49c1d0cec30b16b3914f9df1f8ffc28f17699db5c82ee279a81aaed11128a040b25fb75bb1e7b14d5cd803457d8f
6
+ metadata.gz: ce4f6fa7a5c48d92ce9c7924148944268f850c6133fad6219d2ff616387768a227e19d17d9561f7fa9f99cbefd95a943f976761822333023887a1ef54a54106c
7
+ data.tar.gz: 8a523b327b062c967210d47ab5d4bfea17978c9404bf9d47f18aaf3cee6f428d9b5009c325c45b0c6daa5b53da088bdc2ad39cc743d1903b4774f816b7954ff8
data/README.rdoc CHANGED
@@ -69,5 +69,7 @@ runtime determined API token as value, for example:
69
69
 
70
70
  end
71
71
 
72
- The +LC_LWS_ENV+ is supported to override the LWS environment.
73
- Allowed values are "production" (default) and "development".
72
+ The +LC_LWS_ENV+ environment variable is supported to override the LWS
73
+ environment. Allowed values are "production" (default) and "development".
74
+ The +LC_LWS_API_TOKEN+ is supported to set the LWS API token default.
75
+ This only works if not a custom API token middleware is used.
data/bin/lwsconsole CHANGED
@@ -4,36 +4,10 @@
4
4
  #
5
5
  # Usage: lwsconsole <LWS API token> [<app>:<endpoint> ...]
6
6
 
7
- require "irb"
8
7
  require "logger"
9
8
  require "lws"
10
9
  require "pp"
11
-
12
- # Module to allow for start an interfactive session at any point
13
- # in a Ruby program.
14
- # Source: http://jasonroelofs.com/2009/04/02/embedding-irb-into-your-ruby-application/
15
- module IRB
16
- def self.start_session(binding)
17
- unless @__initialized
18
- args = ARGV
19
- ARGV.replace(ARGV.dup)
20
- IRB.setup(nil)
21
- ARGV.replace(args)
22
- @__initialized = true
23
- end
24
-
25
- workspace = WorkSpace.new(binding)
26
-
27
- irb = Irb.new(workspace)
28
-
29
- @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
30
- @CONF[:MAIN_CONTEXT] = irb.context
31
-
32
- catch(:IRB_EXIT) do
33
- irb.eval_input
34
- end
35
- end
36
- end
10
+ require "pry"
37
11
 
38
12
  # Parse the command-line arguments
39
13
  if ARGV.length < 1
@@ -51,10 +25,11 @@ end
51
25
  logger = Logger.new($stdout)
52
26
  logger.level = Logger::DEBUG
53
27
  logger.progname = "LWSConsole"
54
- logger.formatter = proc do |sev, datetime, progname, msg|
55
- dt_fmt = logger.datetime_format || "%F %X"
56
- "#{datetime.strftime(dt_fmt)} #{progname}(#$$) [#{sev}]: #{msg}\n"
57
- end
28
+ logger.formatter =
29
+ proc do |sev, datetime, progname, msg|
30
+ dt_fmt = logger.datetime_format || "%F %X"
31
+ "#{datetime.strftime(dt_fmt)} #{progname}(#$$) [#{sev}]: #{msg}\n"
32
+ end
58
33
 
59
34
  # Set up the API
60
35
  LWS.setup do |config|
@@ -65,11 +40,33 @@ LWS.setup do |config|
65
40
  config.logger = logger
66
41
  end
67
42
 
43
+ ### Extra commands/methods
44
+
45
+ # Enables/disables HTTP debugging based
46
+ def http_debug(value)
47
+ LWS.config.http_debug = !!value
48
+ reload!
49
+ LWS.config.http_debug
50
+ end
51
+
52
+ # Enables/disables showing headers in the HTTP debugging information
53
+ def http_debug_headers(value)
54
+ LWS.config.http_debug_headers = !!value
55
+ reload!
56
+ LWS.config.http_debug_headers
57
+ end
58
+
59
+ # Enables/disables JSON object debugging
60
+ def json_debug(value)
61
+ LWS.config.json_debug = !!value
62
+ reload!
63
+ LWS.config.json_debug
64
+ end
65
+
66
+ # Reloads all app modules
68
67
  def reload!
69
68
  LWS.load_app_modules
70
69
  end
71
70
 
72
- # Use the LWS module as default namespace
73
- include LWS
74
-
75
- IRB.start_session(binding)
71
+ # Use the LWS module as the default namespace
72
+ LWS.pry