teapot 3.2.1 → 3.5.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/bin/teapot +1 -37
  4. data/lib/teapot/command/build.rb +1 -2
  5. data/lib/teapot/command/clean.rb +1 -1
  6. data/lib/teapot/command/clone.rb +2 -2
  7. data/lib/teapot/command/create.rb +4 -4
  8. data/lib/teapot/command/fetch.rb +4 -4
  9. data/lib/teapot/command/list.rb +5 -5
  10. data/lib/teapot/command/selection.rb +1 -1
  11. data/lib/teapot/command.rb +32 -6
  12. data/lib/teapot/definition.rb +4 -4
  13. data/lib/teapot/loader.rb +8 -8
  14. data/lib/teapot/select.rb +1 -1
  15. data/lib/teapot/version.rb +1 -1
  16. data.tar.gz.sig +0 -0
  17. metadata +97 -83
  18. metadata.gz.sig +0 -0
  19. data/.gitignore +0 -18
  20. data/.rspec +0 -4
  21. data/.travis.yml +0 -33
  22. data/Gemfile +0 -4
  23. data/Gemfile.local +0 -23
  24. data/README.md +0 -171
  25. data/Rakefile +0 -19
  26. data/materials/kurocha.png +0 -0
  27. data/materials/kurocha.svg +0 -101
  28. data/materials/teapot.png +0 -0
  29. data/materials/teapot.svg +0 -82
  30. data/spec/spec_helper.rb +0 -11
  31. data/spec/teapot/command/clone_spec.rb +0 -57
  32. data/spec/teapot/command/fetch_spec/repositories/thing/README.md +0 -3
  33. data/spec/teapot/command/fetch_spec/repositories/thing/teapot.rb +0 -2
  34. data/spec/teapot/command/fetch_spec/test-project/teapot.rb +0 -8
  35. data/spec/teapot/command/fetch_spec.rb +0 -107
  36. data/spec/teapot/command_spec.rb +0 -59
  37. data/spec/teapot/configuration_spec/teapot.rb +0 -13
  38. data/spec/teapot/configuration_spec.rb +0 -33
  39. data/spec/teapot/context_spec/teapot.rb +0 -40
  40. data/spec/teapot/context_spec.rb +0 -61
  41. data/spec/teapot/target_spec/teapot.rb +0 -52
  42. data/spec/teapot/target_spec.rb +0 -55
  43. data/teapot.gemspec +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 629d7c7614d378aca1f52df03b7f94fbbbd75bf99c60a2171d5cba2ab63b17ae
4
- data.tar.gz: 443aa45d4d4f4d732bb7fce592b35f9312d3a8abadabcd5c4b4a4191f82e3ff9
3
+ metadata.gz: d58b6f1be99cfff7bcaa495193453f704e8b01a5285f15c22fec6ea2e05aa918
4
+ data.tar.gz: 753c3a24cb73ab459af7b200914a58624c668eaa59bc343b10a3b0ac3a307535
5
5
  SHA512:
6
- metadata.gz: 40486dc53b3a879a786209091b2adc8d70a32c66baac7b12b830bd58dd8917cd5df8c2814621978f41351c0b128b9cc0fb92191b54d10d09c1de3d2483abf767
7
- data.tar.gz: 2d29b7ae0f9735121cebcb2b1f887257a2982035b258f50331e9787d47fbbcd2aa89f3ffaab4a9a50de4a9140412985875c000e8d269e60b989eb1d685e35fdc
6
+ metadata.gz: 607c931ec0e01cc6b5c79a14cda5bb99d7bef7710a61357ccaef1a9c73f6f26e5ada13654bff11c0c7335993b41dd998f3879ec881c2a45578ea3354a33d4469
7
+ data.tar.gz: e25dcade6d83f87e70ac24ee83c79857c9cb718f0d1a5c82334550be027cf1ab0fadb9ca07b25608899fe46e1481a472758bc73052f41bf3e7f535ee0ae74e8b
checksums.yaml.gz.sig ADDED
Binary file
data/bin/teapot CHANGED
@@ -22,40 +22,4 @@
22
22
 
23
23
  require_relative '../lib/teapot/command'
24
24
 
25
- if command = Teapot::Command.parse(ARGV)
26
- logger = command.logger
27
-
28
- begin
29
- command.invoke
30
- rescue Teapot::IncompatibleTeapotError => error
31
- logger.error(command, error) do
32
- "Supported minimum version #{Teapot::MINIMUM_LOADER_VERSION.dump} to #{Teapot::LOADER_VERSION.dump}."
33
- end
34
-
35
- exit 1
36
- rescue Build::Dependency::UnresolvedDependencyError => error
37
- logger.error(command, error) do |buffer|
38
- buffer.puts "Unresolved dependencies:"
39
-
40
- error.chain.unresolved.each do |name, parent|
41
- buffer.puts "#{parent} depends on #{name.inspect}"
42
-
43
- conflicts = error.chain.conflicts[name]
44
-
45
- if conflicts
46
- conflicts.each do |conflict|
47
- buffer.puts " - provided by #{conflict.name}"
48
- end
49
- end
50
- end
51
-
52
- buffer.puts "Cannot continue due to unresolved dependencies!"
53
- end
54
-
55
- exit 2
56
- rescue StandardError => error
57
- logger.error(command, error)
58
-
59
- exit 3
60
- end
61
- end
25
+ Teapot::Command::Top.call
@@ -38,7 +38,7 @@ module Teapot
38
38
  many :targets, "Build these targets, or use them to help the dependency resolution process."
39
39
  split :argv, "Arguments passed to child process(es) of build if any."
40
40
 
41
- def invoke
41
+ def call
42
42
  context = parent.context
43
43
 
44
44
  # The targets to build:
@@ -52,7 +52,6 @@ module Teapot
52
52
  environment = context.configuration.environment
53
53
 
54
54
  controller = ::Build::Controller.new(logger: parent.logger, limit: @options[:limit]) do |controller|
55
-
56
55
  controller.add_chain(chain, self.argv, environment)
57
56
  end
58
57
 
@@ -25,7 +25,7 @@ module Teapot
25
25
  class Clean < Samovar::Command
26
26
  self.description = "Delete everything in the teapot directory."
27
27
 
28
- def invoke
28
+ def call
29
29
  context = parent.context
30
30
  logger = parent.logger
31
31
  configuration = context.configuration
@@ -33,7 +33,7 @@ module Teapot
33
33
 
34
34
  one :source, "The source repository to clone.", required: true
35
35
 
36
- def invoke
36
+ def call
37
37
  logger = parent.logger
38
38
 
39
39
  name = File.basename(::Build::URI[@source].path, ".git")
@@ -49,7 +49,7 @@ module Teapot
49
49
  _repository = Rugged::Repository.clone_at(@source, root.to_s, credentials: self.method(:credentials))
50
50
 
51
51
  # Fetch the initial packages:
52
- Fetch[parent: nested].invoke
52
+ Fetch[parent: nested].call
53
53
  end
54
54
 
55
55
  def credentials(url, username, types)
@@ -33,7 +33,7 @@ module Teapot
33
33
  one :source, "The source repository to use for fetching packages, e.g. https://github.com/kurocha.", required: true
34
34
  many :packages, "Any packages you'd like to include in the project.", default: ["generate-project"]
35
35
 
36
- def invoke
36
+ def call
37
37
  logger = parent.logger
38
38
 
39
39
  nested = parent['--root', parent.options[:root] || name.gsub(/\s+/, '-').downcase]
@@ -52,7 +52,7 @@ module Teapot
52
52
  generate_project(root, @name, @source, @packages)
53
53
 
54
54
  # Fetch the initial packages:
55
- Fetch[parent: nested].invoke
55
+ Fetch[parent: nested].call
56
56
 
57
57
  context = nested.context
58
58
  selection = context.select
@@ -60,10 +60,10 @@ module Teapot
60
60
 
61
61
  if target_names.any?
62
62
  # Generate the initial project files:
63
- Build[*target_names, parent: nested].invoke
63
+ Build[*target_names, parent: nested].call
64
64
 
65
65
  # Fetch any additional packages:
66
- Fetch[parent: nested].invoke
66
+ Fetch[parent: nested].call
67
67
  end
68
68
 
69
69
  # Stage all files:
@@ -51,7 +51,7 @@ module Teapot
51
51
  parent.context
52
52
  end
53
53
 
54
- def invoke
54
+ def call
55
55
  selection = context.select
56
56
 
57
57
  packages = selection.configuration.packages
@@ -135,7 +135,7 @@ module Teapot
135
135
  base_uri = URI "file://" + File.expand_path(base_uri.path, context.root) + "/"
136
136
  end
137
137
 
138
- branch_name = package.options.fetch(:branch, 'master')
138
+ branch_name = package.options[:branch]
139
139
 
140
140
  if package_lock
141
141
  logger.info "Package locked to commit: #{package_lock[:branch]}/#{package_lock[:commit]}"
@@ -145,7 +145,7 @@ module Teapot
145
145
  end
146
146
 
147
147
  if destination_path.exist?
148
- logger.info "Updating package at path #{destination_path}..." #.color(:cyan)
148
+ logger.info "Updating package at path #{destination_path}..."
149
149
 
150
150
  repository = Rugged::Repository.new(destination_path.to_s)
151
151
 
@@ -155,7 +155,7 @@ module Teapot
155
155
  end
156
156
 
157
157
  repository.fetch('origin', credentials: self.method(:credentials))
158
- repository.checkout(branch_name)
158
+ repository.checkout(branch_name) if branch_name
159
159
 
160
160
  # Essentially implement git pull:
161
161
  if commit_id
@@ -49,14 +49,14 @@ module Teapot
49
49
  begin
50
50
  script = context.load(package)
51
51
  definitions = script.defined
52
-
52
+
53
53
  definitions.each do |definition|
54
54
  terminal.puts "\t#{definition}", style: :definition
55
-
55
+
56
56
  definition.description.each_line do |line|
57
57
  terminal.puts "\t\t#{line.chomp}", style: :description
58
58
  end if definition.description
59
-
59
+
60
60
  case definition
61
61
  when Project
62
62
  terminal.puts "\t\t- Summary: #{definition.summary}" if definition.summary
@@ -72,7 +72,7 @@ module Teapot
72
72
  definition.dependencies.each do |dependency|
73
73
  terminal.puts "\t\t- #{dependency}", style: :dependency
74
74
  end
75
-
75
+
76
76
  definition.provisions.each do |name, provision|
77
77
  terminal.puts "\t\t- #{provision}", style: :provision
78
78
  end
@@ -80,7 +80,7 @@ module Teapot
80
80
  definition.packages.each do |package|
81
81
  terminal.puts "\t\t- #{package}", style: :package
82
82
  end
83
-
83
+
84
84
  definition.imports.select(&:explicit).each do |import|
85
85
  terminal.puts "\t\t- import #{import.name}", style: :import
86
86
  end
@@ -41,7 +41,7 @@ module Teapot
41
41
  end
42
42
  end
43
43
 
44
- def invoke
44
+ def call
45
45
  context = parent.context
46
46
 
47
47
  self.process(selection(parent.context))
@@ -39,10 +39,6 @@ require 'console'
39
39
 
40
40
  module Teapot
41
41
  module Command
42
- def self.parse(*args)
43
- Top.parse(*args)
44
- end
45
-
46
42
  class Top < Samovar::Command
47
43
  self.description = "A decentralised package manager and build tool."
48
44
 
@@ -97,14 +93,44 @@ module Teapot
97
93
  Context.new(root, configuration: configuration)
98
94
  end
99
95
 
100
- def invoke
96
+ def call
101
97
  if @options[:version]
102
98
  puts "teapot v#{Teapot::VERSION}"
103
99
  elsif @options[:help]
104
100
  print_usage(output: $stdout)
105
101
  else
106
- @command.invoke
102
+ @command.call
103
+ end
104
+ rescue Teapot::IncompatibleTeapotError => error
105
+ logger.error(command, error) do
106
+ "Supported minimum version #{Teapot::MINIMUM_LOADER_VERSION.dump} to #{Teapot::LOADER_VERSION.dump}."
107
+ end
108
+
109
+ raise
110
+ rescue ::Build::Dependency::UnresolvedDependencyError => error
111
+ logger.error(command, error) do |buffer|
112
+ buffer.puts "Unresolved dependencies:"
113
+
114
+ error.chain.unresolved.each do |name, parent|
115
+ buffer.puts "#{parent} depends on #{name.inspect}"
116
+
117
+ conflicts = error.chain.conflicts[name]
118
+
119
+ if conflicts
120
+ conflicts.each do |conflict|
121
+ buffer.puts " - provided by #{conflict.name}"
122
+ end
123
+ end
124
+ end
125
+
126
+ buffer.puts "Cannot continue due to unresolved dependencies!"
107
127
  end
128
+
129
+ raise
130
+ rescue StandardError => error
131
+ logger.error(command, error)
132
+
133
+ raise
108
134
  end
109
135
  end
110
136
  end
@@ -35,11 +35,11 @@ module Teapot
35
35
 
36
36
  super
37
37
  end
38
-
39
- def pretty_print(pp)
40
- pp.text self.inspect
38
+
39
+ def inspect
40
+ "\#<#{self.class.name} #{@name}>"
41
41
  end
42
-
42
+
43
43
  # The context in which the definition was loaded:
44
44
  attr :context
45
45
 
data/lib/teapot/loader.rb CHANGED
@@ -97,8 +97,8 @@ module Teapot
97
97
 
98
98
  alias required_version teapot_version
99
99
 
100
- def define_project(*args)
101
- project = Project.new(@context, @package, *args)
100
+ def define_project(*arguments, **options)
101
+ project = Project.new(@context, @package, *arguments, **options)
102
102
 
103
103
  yield project
104
104
 
@@ -106,8 +106,8 @@ module Teapot
106
106
  @defined << project
107
107
  end
108
108
 
109
- def define_target(*args)
110
- target = Target.new(@context, @package, *args)
109
+ def define_target(*arguments, **options)
110
+ target = Target.new(@context, @package, *arguments, **options)
111
111
 
112
112
  yield target
113
113
 
@@ -116,8 +116,8 @@ module Teapot
116
116
  @defined << target
117
117
  end
118
118
 
119
- def define_configuration(*args)
120
- configuration = Configuration.new(@context, @package, *args)
119
+ def define_configuration(*arguments, **options)
120
+ configuration = Configuration.new(@context, @package, *arguments, **options)
121
121
 
122
122
  yield configuration
123
123
 
@@ -127,11 +127,11 @@ module Teapot
127
127
  end
128
128
 
129
129
  # Checks the host patterns and executes the block if they match.
130
- def host(*args, &block)
130
+ def host(*arguments, **options, &block)
131
131
  name = @context.options[:host_platform] || RUBY_PLATFORM
132
132
 
133
133
  if block_given?
134
- if args.find{|arg| arg === name}
134
+ if arguments.find{|argument| argument === name}
135
135
  yield
136
136
  end
137
137
  else
data/lib/teapot/select.rb CHANGED
@@ -42,7 +42,7 @@ module Teapot
42
42
  class Select
43
43
  def initialize(context, configuration, names = [])
44
44
  @context = context
45
- @configuration = Configuration.new(context, configuration.package, configuration.name, [], configuration.options)
45
+ @configuration = Configuration.new(context, configuration.package, configuration.name, [], **configuration.options)
46
46
 
47
47
  @targets = {}
48
48
  @configurations = {}
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "3.2.1"
22
+ VERSION = "3.5.0"
23
23
  end
data.tar.gz.sig ADDED
Binary file