alki-console 0.7.0 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d9eabe5119553aecf3850b96338916969e246f3
4
- data.tar.gz: c687692abdfd509d8a30f9739f25bef487d7d6fb
3
+ metadata.gz: 9e163e9e5fa64b3a7f81d49199b530b4ca8ac1c2
4
+ data.tar.gz: 178461f9fa0de6f226c50af371bab401c20dcf52
5
5
  SHA512:
6
- metadata.gz: b03fb366ad6ef826f975f33005395c10289f13a3aefa8569c4756db5f1b06befeb93fdef95e83951c37d43e067217d65b6b26841ff6c2c4229d3cddc10951e7c
7
- data.tar.gz: c1d0c4116c86d85a7c372857c769f58b213d676552f966d9f856c0b17a707e687b7fd1bc6f1430aa6332fde25991d768c6dc80deb55dff35fae02fbec15fe61f
6
+ metadata.gz: ff4dac5cf634f4dc7d40587fe4bfa9c4105316aa007ac6e2717f9815eea9ad756949cdcfbe75d334a4c820352231d0cbca6915ce48a5e2ac819046cfdb1a2eb6
7
+ data.tar.gz: d37fad95ae11085e367581c7edfc59dc2e1f694e89b9e7bbdf4f2edeff8a752c7d72f5301454f34fb6389b72a261ee9add97a5fbde4c5cfc384928c52409adf0
data/.gitignore CHANGED
@@ -52,4 +52,5 @@ Gemfile.lock
52
52
  .rvmrc
53
53
 
54
54
  .idea/
55
- *.iml
55
+ *.iml
56
+ /bin/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.10
4
+ - 2.5.1
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem 'alki-testing'
6
+ gem 'rake'
@@ -1,5 +1,7 @@
1
1
  = Alki::Console
2
2
 
3
+ image:https://travis-ci.org/alki-project/alki-console.svg?branch=master["Build Status", link="https://travis-ci.org/alki-project/alki-console"]
4
+
3
5
  Provides a console to work with https://github.com/alki-project/alki[Alki] assemblies.
4
6
  Built on https://github.com/pry/pry[Pry].
5
7
 
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
- require "bundler/gem_tasks"
1
+ require "alki/testing/tasks"
2
+
3
+ task default: [:test]
@@ -9,8 +9,9 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Matt Edlefsen"]
10
10
  spec.email = ["matt.edlefsen@gmail.com"]
11
11
  spec.summary = %q{Developer console for Alki applications}
12
- spec.homepage = "https://github.com/medlefsen/alki-console"
12
+ spec.homepage = "http://alki.io/projects/alki-console"
13
13
  spec.license = "MIT"
14
+ spec.required_ruby_version = '>= 2.1.0'
14
15
 
15
16
  spec.files = `git ls-files -z`.split("\x0")
16
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -18,6 +19,6 @@ Gem::Specification.new do |spec|
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- spec.add_dependency "alki", "~> 0.13.0"
22
+ spec.add_dependency "alki", "~> 0.14.0"
22
23
  spec.add_dependency "pry", "~> 0.11"
23
24
  end
@@ -1,6 +1,14 @@
1
1
  Alki do
2
+ set :mounted? do
3
+ respond_to? :parent
4
+ end
5
+
2
6
  set :prompt do
3
- assembly_name&.gsub('/','-') || 'app'
7
+ if mounted? && parent.assembly_name
8
+ parent.assembly_name.gsub('/','-')
9
+ else
10
+ 'app'
11
+ end
4
12
  end
5
13
 
6
14
  func :run do
@@ -8,7 +16,11 @@ Alki do
8
16
  end
9
17
 
10
18
  set :context do
11
- parent
19
+ if mounted?
20
+ parent
21
+ else
22
+ nil
23
+ end
12
24
  end
13
25
 
14
26
  tag :main_loop
@@ -1,5 +1,5 @@
1
1
  module Alki
2
2
  module Console
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.1'
4
4
  end
5
5
  end
@@ -0,0 +1,17 @@
1
+ require 'alki/feature_test'
2
+
3
+ describe 'Mounted' do
4
+ before do
5
+ start_console fixture_path 'mounted.rb'
6
+ end
7
+
8
+ it 'should set prompt to parent assembly name' do
9
+ @read.expect(/mounted>/,1).wont_be_nil
10
+ end
11
+
12
+ it 'should forward methods to parent assembly' do
13
+ @write.puts('foo')
14
+ @read.expect(/:foo/,1).wont_be_nil
15
+ end
16
+ end
17
+
@@ -0,0 +1,17 @@
1
+ require 'alki/feature_test'
2
+
3
+ describe 'Standalone' do
4
+ before do
5
+ start_console fixture_path 'standalone.rb'
6
+ end
7
+
8
+ it 'should set prompt to app by default' do
9
+ @read.expect(/app>/,1).wont_be_nil
10
+ end
11
+
12
+ it 'should forward methods to context' do
13
+ @write.puts('foo')
14
+ @read.expect(/:foo/,1).wont_be_nil
15
+ end
16
+ end
17
+
@@ -0,0 +1,20 @@
1
+ require 'alki/feature_test'
2
+
3
+ $LOAD_PATH << Alki::Test.fixture_path('wrapper','lib')
4
+
5
+ describe 'Wrapper' do
6
+ before do
7
+ Dir.chdir fixture_path('wrapper')
8
+ start_console File.expand_path('../../../exe/alki-console',__FILE__)
9
+ end
10
+
11
+ it 'should set prompt to wrapped assembly name' do
12
+ @read.expect(/wrapper>/,1).wont_be_nil
13
+ end
14
+
15
+ it 'should forward methods to wrapped assembly' do
16
+ @write.puts('foo')
17
+ @read.expect(/:foo/,1).wont_be_nil
18
+ end
19
+ end
20
+
@@ -0,0 +1,15 @@
1
+ require 'alki/console'
2
+ require 'pty'
3
+ require 'expect'
4
+
5
+ Alki::Test.feature_exec do
6
+ def start_console(cmd)
7
+ @read, @write, @pid = PTY.spawn "ruby #{cmd}"
8
+ end
9
+
10
+ after do
11
+ @read.close
12
+ @write.close
13
+ Process.kill('TERM',@pid)
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ require 'alki/console'
2
+
3
+ app = Alki.new name: 'mounted' do
4
+ mount :console, 'alki/console'
5
+
6
+ set :foo do
7
+ :foo
8
+ end
9
+ end
10
+
11
+ app.console.run
@@ -0,0 +1,10 @@
1
+ require 'alki/console'
2
+
3
+ class App
4
+ def foo
5
+ :foo
6
+ end
7
+ end
8
+
9
+ console = Alki::Console.new context: App.new
10
+ console.run
@@ -0,0 +1,3 @@
1
+ Alki do
2
+ set :foo, :foo
3
+ end
@@ -0,0 +1,2 @@
1
+ require 'alki'
2
+ Alki.project_assembly!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alki-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Edlefsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-11 00:00:00.000000000 Z
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alki
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.13.0
19
+ version: 0.14.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.13.0
26
+ version: 0.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -47,6 +47,7 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - ".gitignore"
50
+ - ".travis.yml"
50
51
  - Gemfile
51
52
  - README.adoc
52
53
  - Rakefile
@@ -57,7 +58,15 @@ files:
57
58
  - lib/alki/console/pry_console.rb
58
59
  - lib/alki/console/version.rb
59
60
  - lib/alki/console/wrapper.rb
60
- homepage: https://github.com/medlefsen/alki-console
61
+ - test/feature/mounted_test.rb
62
+ - test/feature/standalone_test.rb
63
+ - test/feature/wrapper_test.rb
64
+ - test/feature_test_helper.rb
65
+ - test/fixtures/mounted.rb
66
+ - test/fixtures/standalone.rb
67
+ - test/fixtures/wrapper/config/assembly.rb
68
+ - test/fixtures/wrapper/lib/wrapper.rb
69
+ homepage: http://alki.io/projects/alki-console
61
70
  licenses:
62
71
  - MIT
63
72
  metadata: {}
@@ -69,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
78
  requirements:
70
79
  - - ">="
71
80
  - !ruby/object:Gem::Version
72
- version: '0'
81
+ version: 2.1.0
73
82
  required_rubygems_version: !ruby/object:Gem::Requirement
74
83
  requirements:
75
84
  - - ">="
@@ -81,4 +90,12 @@ rubygems_version: 2.6.12
81
90
  signing_key:
82
91
  specification_version: 4
83
92
  summary: Developer console for Alki applications
84
- test_files: []
93
+ test_files:
94
+ - test/feature/mounted_test.rb
95
+ - test/feature/standalone_test.rb
96
+ - test/feature/wrapper_test.rb
97
+ - test/feature_test_helper.rb
98
+ - test/fixtures/mounted.rb
99
+ - test/fixtures/standalone.rb
100
+ - test/fixtures/wrapper/config/assembly.rb
101
+ - test/fixtures/wrapper/lib/wrapper.rb