giga-safe-hub 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.

Potentially problematic release.


This version of giga-safe-hub might be problematic. Click here for more details.

Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/giga-safe-hub.gemspec +12 -0
  3. data/spring-4.7.0/LICENSE.txt +23 -0
  4. data/spring-4.7.0/README.md +467 -0
  5. data/spring-4.7.0/bin/spring +49 -0
  6. data/spring-4.7.0/lib/spring/application/boot.rb +25 -0
  7. data/spring-4.7.0/lib/spring/application.rb +597 -0
  8. data/spring-4.7.0/lib/spring/application_manager.rb +145 -0
  9. data/spring-4.7.0/lib/spring/binstub.rb +13 -0
  10. data/spring-4.7.0/lib/spring/boot.rb +10 -0
  11. data/spring-4.7.0/lib/spring/client/binstub.rb +190 -0
  12. data/spring-4.7.0/lib/spring/client/command.rb +18 -0
  13. data/spring-4.7.0/lib/spring/client/help.rb +62 -0
  14. data/spring-4.7.0/lib/spring/client/rails.rb +34 -0
  15. data/spring-4.7.0/lib/spring/client/run.rb +297 -0
  16. data/spring-4.7.0/lib/spring/client/server.rb +18 -0
  17. data/spring-4.7.0/lib/spring/client/status.rb +30 -0
  18. data/spring-4.7.0/lib/spring/client/stop.rb +22 -0
  19. data/spring-4.7.0/lib/spring/client/version.rb +11 -0
  20. data/spring-4.7.0/lib/spring/client.rb +48 -0
  21. data/spring-4.7.0/lib/spring/command_wrapper.rb +82 -0
  22. data/spring-4.7.0/lib/spring/commands/rails.rb +112 -0
  23. data/spring-4.7.0/lib/spring/commands/rake.rb +30 -0
  24. data/spring-4.7.0/lib/spring/commands.rb +57 -0
  25. data/spring-4.7.0/lib/spring/configuration.rb +99 -0
  26. data/spring-4.7.0/lib/spring/env.rb +115 -0
  27. data/spring-4.7.0/lib/spring/errors.rb +36 -0
  28. data/spring-4.7.0/lib/spring/failsafe_thread.rb +14 -0
  29. data/spring-4.7.0/lib/spring/json.rb +623 -0
  30. data/spring-4.7.0/lib/spring/process_title_updater.rb +65 -0
  31. data/spring-4.7.0/lib/spring/server.rb +162 -0
  32. data/spring-4.7.0/lib/spring/version.rb +3 -0
  33. data/spring-4.7.0/lib/spring/watcher/abstract.rb +117 -0
  34. data/spring-4.7.0/lib/spring/watcher/polling.rb +98 -0
  35. data/spring-4.7.0/lib/spring/watcher.rb +30 -0
  36. metadata +75 -0
@@ -0,0 +1,99 @@
1
+ require "spring/errors"
2
+
3
+ module Spring
4
+ @connect_timeout = 5
5
+ @boot_timeout = 20
6
+ @dangerously_allow_disabling_reloading = false
7
+
8
+ class << self
9
+ attr_accessor :application_root, :connect_timeout, :boot_timeout
10
+ attr_writer :quiet
11
+
12
+ # Opt-in: skip the `:ensure_reloading_is_enabled` initializer so Spring
13
+ # boots with `config.enable_reloading = false`. Default `false`. See
14
+ # README "Running Spring with reloading disabled" for what this gives up.
15
+ attr_accessor :dangerously_allow_disabling_reloading
16
+
17
+ def gemfile
18
+ require "bundler"
19
+
20
+ if /\s1.9.[0-9]/ === Bundler.ruby_scope.gsub(/[\/\s]+/,'')
21
+ Pathname.new(ENV["BUNDLE_GEMFILE"] || "Gemfile").expand_path
22
+ else
23
+ Bundler.default_gemfile
24
+ end
25
+ end
26
+
27
+ def gemfile_lock
28
+ case gemfile.to_s
29
+ when /\bgems\.rb\z/
30
+ gemfile.sub_ext('.locked')
31
+ else
32
+ gemfile.sub_ext('.lock')
33
+ end
34
+ end
35
+
36
+ def after_fork_callbacks
37
+ @after_fork_callbacks ||= []
38
+ end
39
+
40
+ def after_fork(&block)
41
+ after_fork_callbacks << block
42
+ end
43
+
44
+ def after_environment_load_callbacks
45
+ @after_environment_load_callbacks ||= []
46
+ end
47
+
48
+ def after_environment_load(&block)
49
+ after_environment_load_callbacks << block
50
+ end
51
+
52
+ def spawn_on_env
53
+ @spawn_on_env ||= []
54
+ end
55
+
56
+ def reset_on_env
57
+ @reset_on_env ||= []
58
+ end
59
+
60
+ def verify_environment
61
+ application_root_path
62
+ end
63
+
64
+ def application_root_path
65
+ @application_root_path ||= begin
66
+ if application_root
67
+ path = Pathname.new(File.expand_path(application_root))
68
+ else
69
+ path = project_root_path
70
+ end
71
+
72
+ raise MissingApplication.new(path) unless path.join("config/application.rb").exist?
73
+ path
74
+ end
75
+ end
76
+
77
+ def project_root_path
78
+ @project_root_path ||= find_project_root(Pathname.new(File.expand_path(Dir.pwd)))
79
+ end
80
+
81
+ def quiet
82
+ @quiet || ENV.key?('SPRING_QUIET')
83
+ end
84
+
85
+ private
86
+
87
+ def find_project_root(current_dir)
88
+ if current_dir.join(gemfile).exist?
89
+ current_dir
90
+ elsif current_dir.root?
91
+ raise UnknownProject.new(Dir.pwd)
92
+ else
93
+ find_project_root(current_dir.parent)
94
+ end
95
+ end
96
+ end
97
+
98
+ self.quiet = false
99
+ end
@@ -0,0 +1,115 @@
1
+ require "pathname"
2
+
3
+ require "spring/version"
4
+ require "spring/configuration"
5
+
6
+ module Spring
7
+ IGNORE_SIGNALS = %w(INT QUIT)
8
+ STOP_TIMEOUT = 2 # seconds
9
+
10
+ class Env
11
+ attr_reader :log_file
12
+
13
+ def initialize(options = {})
14
+ @root = options[:root]
15
+ @project_root = options[:root]
16
+ @log_file = options[:log_file] || File.open(ENV["SPRING_LOG"] || File::NULL, "a")
17
+ end
18
+
19
+ def root
20
+ @root ||= Spring.application_root_path
21
+ end
22
+
23
+ def project_root
24
+ @project_root ||= Spring.project_root_path
25
+ end
26
+
27
+ def version
28
+ Spring::VERSION
29
+ end
30
+
31
+ def tmp_path
32
+ require "tmpdir"
33
+ path = Pathname.new(
34
+ ENV["SPRING_TMP_PATH"] ||
35
+ File.join(ENV['XDG_RUNTIME_DIR'] || Dir.tmpdir, "spring-#{Process.uid}")
36
+ )
37
+ require "fileutils"
38
+ FileUtils.mkdir_p(path) unless path.exist?
39
+ path
40
+ end
41
+
42
+ def application_id
43
+ require "digest/md5"
44
+ ENV["SPRING_APPLICATION_ID"] || Digest::MD5.hexdigest(RUBY_VERSION + project_root.to_s)
45
+ end
46
+
47
+ def socket_path
48
+ Pathname.new(ENV["SPRING_SOCKET"] || tmp_path.join(application_id))
49
+ end
50
+
51
+ def socket_name
52
+ socket_path.to_s
53
+ end
54
+
55
+ def pidfile_path
56
+ Pathname.new(ENV["SPRING_PIDFILE"] || socket_path.dirname.join("#{socket_path.basename(".*")}.pid"))
57
+ end
58
+
59
+ def pid
60
+ pidfile_path.exist? ? pidfile_path.read.to_i : nil
61
+ rescue Errno::ENOENT
62
+ # This can happen if the pidfile is removed after we check it
63
+ # exists
64
+ end
65
+
66
+ def app_name
67
+ root.basename
68
+ end
69
+
70
+ def server_running?
71
+ pidfile = pidfile_path.open('r+')
72
+ !pidfile.flock(File::LOCK_EX | File::LOCK_NB)
73
+ rescue Errno::ENOENT
74
+ false
75
+ ensure
76
+ if pidfile
77
+ pidfile.flock(File::LOCK_UN)
78
+ pidfile.close
79
+ end
80
+ end
81
+
82
+ def log(message)
83
+ log_file.puts "[#{Time.now}] [#{Process.pid}] #{message}"
84
+ log_file.flush
85
+ end
86
+
87
+ def stop
88
+ if server_running?
89
+ timeout = Time.now + STOP_TIMEOUT
90
+ kill 'TERM'
91
+ sleep 0.1 until !server_running? || Time.now >= timeout
92
+
93
+ if server_running?
94
+ kill 'KILL'
95
+ :killed
96
+ else
97
+ :stopped
98
+ end
99
+ else
100
+ :not_running
101
+ end
102
+ end
103
+
104
+ def kill(sig)
105
+ pid = self.pid
106
+ Process.kill(sig, pid) if pid
107
+ rescue Errno::ESRCH
108
+ # already dead
109
+ end
110
+
111
+ def server_command
112
+ ENV["SPRING_SERVER_COMMAND"] || "#{File.expand_path("../../../bin/spring", __FILE__)} server --background"
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,36 @@
1
+ module Spring
2
+ class ClientError < StandardError; end
3
+
4
+ class UnknownProject < StandardError
5
+ attr_reader :current_dir
6
+
7
+ def initialize(current_dir)
8
+ @current_dir = current_dir
9
+ end
10
+
11
+ def message
12
+ "Spring was unable to locate the root of your project. There was no Gemfile " \
13
+ "present in the current directory (#{current_dir}) or any of the parent " \
14
+ "directories."
15
+ end
16
+ end
17
+
18
+ class MissingApplication < ClientError
19
+ attr_reader :project_root
20
+
21
+ def initialize(project_root)
22
+ @project_root = project_root
23
+ end
24
+
25
+ def message
26
+ "Spring was unable to find your config/application.rb file. " \
27
+ "Your project root was detected at #{project_root}, so Spring " \
28
+ "looked for #{project_root}/config/application.rb but it doesn't exist. You can " \
29
+ "configure the root of your application by setting Spring.application_root in " \
30
+ "config/spring.rb."
31
+ end
32
+ end
33
+
34
+ class CommandNotFound < ClientError
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ require 'thread'
2
+
3
+ module Spring
4
+ class << self
5
+ def failsafe_thread
6
+ Thread.new {
7
+ begin
8
+ yield
9
+ rescue
10
+ end
11
+ }
12
+ end
13
+ end
14
+ end