ryb 0.1.3.1 → 0.2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +36 -47
  3. data/NOTES +0 -0
  4. data/README.md +3 -1
  5. data/TODO +4 -0
  6. data/bin/ryb +2 -42
  7. data/lib/ryb.rb +31 -20
  8. data/lib/ryb/cli.rb +103 -0
  9. data/lib/ryb/code.rb +7 -0
  10. data/lib/ryb/configuration.rb +18 -12
  11. data/lib/ryb/configurations.rb +9 -0
  12. data/lib/ryb/dependencies.rb +7 -0
  13. data/lib/ryb/dependency.rb +30 -0
  14. data/lib/ryb/dsl.rb +280 -0
  15. data/lib/ryb/environment.rb +9 -0
  16. data/lib/ryb/flags.rb +17 -0
  17. data/lib/ryb/gem.rb +58 -0
  18. data/lib/ryb/helpers/defaults.rb +26 -0
  19. data/lib/ryb/helpers/pretty_string.rb +47 -0
  20. data/lib/ryb/languages.rb +13 -0
  21. data/lib/ryb/name.rb +3 -5
  22. data/lib/ryb/ninja.rb +257 -200
  23. data/lib/ryb/paths.rb +7 -0
  24. data/lib/ryb/preprocessor.rb +10 -0
  25. data/lib/ryb/product.rb +31 -0
  26. data/lib/ryb/project.rb +6 -29
  27. data/lib/ryb/source_file.rb +62 -0
  28. data/lib/ryb/visual_studio.rb +93 -57
  29. data/lib/rybfile.rb +30 -10
  30. data/lib/rybfile/walker.rb +202 -0
  31. data/lib/yb.rb +4 -0
  32. data/lib/ybfile.rb +3 -0
  33. data/ryb.gemspec +18 -13
  34. data/ryb.sublime-project +18 -17
  35. metadata +45 -31
  36. data/lib/ryb/application.rb +0 -24
  37. data/lib/ryb/architecture.rb +0 -16
  38. data/lib/ryb/architectures/x86.rb +0 -11
  39. data/lib/ryb/architectures/x86_64.rb +0 -11
  40. data/lib/ryb/library.rb +0 -29
  41. data/lib/ryb/properties.rb +0 -10
  42. data/lib/ryb/properties/architectures.rb +0 -32
  43. data/lib/ryb/properties/configurations.rb +0 -29
  44. data/lib/ryb/properties/defines.rb +0 -31
  45. data/lib/ryb/properties/dependencies.rb +0 -23
  46. data/lib/ryb/properties/files.rb +0 -25
  47. data/lib/ryb/properties/flags.rb +0 -33
  48. data/lib/ryb/properties/named.rb +0 -17
  49. data/lib/ryb/properties/paths.rb +0 -37
  50. data/lib/ryb/properties/suffix.rb +0 -17
  51. data/lib/ryb/properties/targets.rb +0 -36
  52. data/lib/ryb/target.rb +0 -16
  53. data/lib/ryb/targets/linux.rb +0 -11
  54. data/lib/ryb/targets/macosx.rb +0 -33
  55. data/lib/ryb/targets/windows.rb +0 -13
  56. data/lib/ryb/version.rb +0 -11
  57. data/lib/ryb/windows.rb +0 -40
  58. data/lib/ryb/xcode.rb +0 -145
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c37eb74ab4aa31a58071a356dff44041cfa4000d
4
- data.tar.gz: 1116619e3d5385d7790a94dfe93ac20caa12f7a1
3
+ metadata.gz: 63cc2afcc3bcab179722908bb5c2911804211e2b
4
+ data.tar.gz: a17dcbb8a42d284a855c0edc0e48640933cbdc19
5
5
  SHA512:
6
- metadata.gz: a8c98f3febbc6728f0b45dbf424c61cfcbcde68323fc6106768587dba05cb7297459f791a1db7f50d97c42ca3c97a7baa8ba294a135da9b6b742ea6905d79ecc
7
- data.tar.gz: 481325cc2ffcd087664cf7137ca807a15cec70152013b50b32aa6c5d729d5b1804c7200ed61d1e2879b352429d65e458ffd4dc7d7228b00ad4fdcf839608821b
6
+ metadata.gz: de79d590fb5c07e18a3ed6acb8574174a970e6b00d0df7f1c7244fe304dd80db13277523c6c0271e0b35ff2f1c2e5f82098ab52bdffa7faeecd52f8dbf992d02
7
+ data.tar.gz: b200c8f3fd29689fa70962ce4fe3d3003c197f6c26ea2793a4e9c88277a14b4a29f8b03e58b71b8b0ef820a0ed8fad3731f6d39059968794d0bbc3936d6f68fb
@@ -1,76 +1,65 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ryb (0.0.0.dev)
5
- facets
6
- gli
4
+ ryb (0.2.0.1)
5
+ gli (~> 2)
6
+ hashie
7
7
  ninja-gen
8
- xcodeproj
8
+ pour
9
+ visual_studio
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- activesupport (4.2.3)
14
- i18n (~> 0.7)
15
- json (~> 1.7, >= 1.7.7)
16
- minitest (~> 5.1)
17
- thread_safe (~> 0.3, >= 0.3.4)
18
- tzinfo (~> 1.1)
19
- aruba (0.8.1)
14
+ aruba (0.13.0)
20
15
  childprocess (~> 0.5.6)
21
16
  contracts (~> 0.9)
22
17
  cucumber (>= 1.3.19)
18
+ ffi (~> 1.9.10)
23
19
  rspec-expectations (>= 2.99)
20
+ thor (~> 0.19)
24
21
  builder (3.2.2)
25
- childprocess (0.5.6)
22
+ childprocess (0.5.9)
26
23
  ffi (~> 1.0, >= 1.0.11)
27
- claide (0.9.1)
28
- colored (1.2)
29
- contracts (0.11.0)
30
- cucumber (2.0.2)
24
+ contracts (0.13.0)
25
+ cucumber (2.3.2)
31
26
  builder (>= 2.1.2)
32
- cucumber-core (~> 1.2.0)
27
+ cucumber-core (~> 1.4.0)
28
+ cucumber-wire (~> 0.0.1)
33
29
  diff-lcs (>= 1.1.3)
34
- gherkin (~> 2.12)
30
+ gherkin (~> 3.2.0)
35
31
  multi_json (>= 1.7.5, < 2.0)
36
32
  multi_test (>= 0.1.2)
37
- cucumber-core (1.2.0)
38
- gherkin (~> 2.12.0)
33
+ cucumber-core (1.4.0)
34
+ gherkin (~> 3.2.0)
35
+ cucumber-wire (0.0.1)
39
36
  diff-lcs (1.2.5)
40
- facets (3.0.0)
41
37
  ffi (1.9.10)
42
38
  ffi (1.9.10-x86-mingw32)
43
- gherkin (2.12.2)
44
- multi_json (~> 1.3)
45
- gherkin (2.12.2-x86-mingw32)
46
- multi_json (~> 1.3)
47
- gli (2.13.1)
48
- i18n (0.7.0)
49
- json (1.8.3)
50
- minitest (5.8.0)
39
+ gherkin (3.2.0)
40
+ gli (2.13.4)
41
+ hashie (3.4.3)
51
42
  multi_json (1.11.2)
52
43
  multi_test (0.1.2)
53
44
  ninja-gen (0.1.1.1)
54
- rspec (3.3.0)
55
- rspec-core (~> 3.3.0)
56
- rspec-expectations (~> 3.3.0)
57
- rspec-mocks (~> 3.3.0)
58
- rspec-core (3.3.2)
59
- rspec-support (~> 3.3.0)
60
- rspec-expectations (3.3.1)
45
+ pour (0.0.3.1)
46
+ typespec
47
+ rspec (3.4.0)
48
+ rspec-core (~> 3.4.0)
49
+ rspec-expectations (~> 3.4.0)
50
+ rspec-mocks (~> 3.4.0)
51
+ rspec-core (3.4.3)
52
+ rspec-support (~> 3.4.0)
53
+ rspec-expectations (3.4.0)
61
54
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.3.0)
63
- rspec-mocks (3.3.2)
55
+ rspec-support (~> 3.4.0)
56
+ rspec-mocks (3.4.1)
64
57
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.3.0)
66
- rspec-support (3.3.0)
67
- thread_safe (0.3.5)
68
- tzinfo (1.2.2)
69
- thread_safe (~> 0.1)
70
- xcodeproj (0.26.3)
71
- activesupport (>= 3)
72
- claide (~> 0.9.1)
73
- colored (~> 1.2)
58
+ rspec-support (~> 3.4.0)
59
+ rspec-support (3.4.1)
60
+ thor (0.19.1)
61
+ typespec (0.1.0.8)
62
+ visual_studio (0.1.0.2)
74
63
 
75
64
  PLATFORMS
76
65
  ruby
data/NOTES ADDED
File without changes
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # [Rubify Your Build!](http://rubifyyourbuild.com/)
1
+ # [Rubify Your Build!](http://rubifyyourbuild.com/)
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/ryb.svg)](https://rubygems.org/gems/ryb)
4
4
  [![Build Status](https://img.shields.io/travis/mtwilliams/ryb/master.svg)](https://travis-ci.org/mtwilliams/ryb)
5
5
  [![Code Climate](https://img.shields.io/codeclimate/github/mtwilliams/ryb.svg)](https://codeclimate.com/github/mtwilliams/ryb)
6
6
  [![Dependency Status](https://img.shields.io/gemnasium/mtwilliams/ryb.svg)](https://gemnasium.com/mtwilliams/ryb)
7
+
8
+ :meat_on_bone: Delicious!
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ - How should we handle conflicts between say, a Ryb::Configuration and a Ryb::Platform?
2
+ - Memoization.
3
+ - http://www.justinweiss.com/articles/4-simple-memoization-patterns-in-ruby-and-one-gem/
4
+ - http://gavinmiller.io/2013/basics-of-ruby-memoization/
data/bin/ryb CHANGED
@@ -1,46 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- $:.push File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
3
-
4
- require 'rubygems'
5
- require 'facets'
6
- require 'gli'
7
- require 'xcodeproj'
8
- require 'ninja'
9
2
 
3
+ $:.push File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
10
4
  require 'ryb'
11
- # TODO(mtwilliams): Refactor into Ryb::Runner.
12
- require 'rybfile'
13
-
14
- include GLI::App
15
-
16
- # TODO(mtwilliams): Refactor this ugliness into lib/ryb.rb?
17
- spec = Gem::Specification::load(File.expand_path(File.join(File.dirname(__FILE__), '..', 'ryb.gemspec')))
18
- # program_name spec.name
19
- version spec.version.to_s
20
- program_desc spec.summary
21
- program_long_desc spec.description
22
-
23
- desc 'Generate project file(s)'
24
- # TODO(mtwilliams): Improve command-specific help.
25
- long_desc 'Generates project files for a specific toolset based on a Rybfile.'
26
- command [:g, :gen, :generate] do |c|
27
- c.desc 'Automatically regenerate project file(s)'
28
-
29
- c.action do |global_opts, opts, args|
30
- # TODO(mtwilliams): Sanity checks on `args'.
31
- toolset = args.shift
32
- # TODO(mtwilliams): Custom exception types.
33
- raise "No toolset specified!" if toolset.nil?
34
- raise "Unknown toolset `#{toolset}'!" unless %w{ninja}.include? toolset
35
- rybfile = args.shift || 'Rybfile'
36
- raise "No such file `#{rybfile}' exists!" unless File.exists?(rybfile)
37
- rybfile = Rybfile.load(rybfile)
38
- puts "Generating project file(s) for `#{toolset}'..."
39
- case toolset
40
- when 'ninja'
41
- Ryb::Ninja.generate_build_file_for rybfile.project, root: '.', built: '_build'
42
- end
43
- end
44
- end
45
5
 
46
- exit run(ARGV)
6
+ exit Ryb::CommandLineInterface.run(ARGV)
data/lib/ryb.rb CHANGED
@@ -1,28 +1,39 @@
1
1
  require 'rbconfig'
2
+ require 'delegate'
3
+ require 'hashie'
4
+ require 'pour'
5
+ require 'visual_studio'
6
+ require 'ninja'
2
7
 
3
8
  module Ryb
4
- def self.platform
5
- @platform ||= begin
6
- case RbConfig::CONFIG['host_os']
7
- when /mswin|msys|mingw/
8
- :windows
9
- when /mac os|darwin/
10
- :macosx
11
- when /linux/
12
- :linux
13
- when /bsd/
14
- :bsd
15
- else
16
- raise 'Unknown or unsupported platform!'
17
- end
18
- end
19
- end
20
-
21
- require 'ryb/version'
9
+ require 'ryb/gem'
22
10
 
11
+ require 'ryb/helpers/defaults'
12
+ require 'ryb/helpers/pretty_string'
13
+
14
+ require 'ryb/name'
15
+ require 'ryb/paths'
16
+ require 'ryb/languages'
17
+ require 'ryb/source_file'
18
+
19
+ require 'ryb/environment'
20
+ require 'ryb/flags'
21
+ require 'ryb/preprocessor'
22
+ require 'ryb/code'
23
+ require 'ryb/dependency'
24
+ require 'ryb/dependencies'
25
+ require 'ryb/configuration'
26
+ require 'ryb/configurations'
27
+ require 'ryb/product'
23
28
  require 'ryb/project'
24
- require 'ryb/library'
25
- require 'ryb/application'
26
29
 
30
+ require 'ryb/dsl'
31
+
32
+ require 'rybfile'
33
+ require 'rybfile/walker'
34
+
35
+ require 'ryb/visual_studio'
27
36
  require 'ryb/ninja'
37
+
38
+ require 'ryb/cli'
28
39
  end
@@ -0,0 +1,103 @@
1
+ module Ryb
2
+ # TODO(mtwilliams): Collate these somewhere else.
3
+ PLATFORMS = %w{windows macosx linux}
4
+ TOOLCHAINS = %w{msvc clang+llvm gcc}
5
+
6
+ module CommandLineInterface
7
+ # TODO(mtwilliams): Look into using Thor?
8
+ require 'gli'
9
+ include GLI::App
10
+ extend self
11
+
12
+ # program_name Ryb::Gem.name
13
+ version Ryb::Gem.version.to_s
14
+ program_desc Ryb::Gem.summary
15
+ program_long_desc Ryb::Gem.description
16
+
17
+ desc ''
18
+ flag [:root], :default_value => '.'
19
+
20
+ desc ''
21
+ flag [:build], :default_value => '_build'
22
+
23
+ # TODO(mtwilliams): Use a proper logger.
24
+ # switch :verbose, :default => false,
25
+ # :negatable => false
26
+
27
+ desc 'Generate project file(s)'
28
+ long_desc 'Generates project files for a specific toolset, based on a Rybfile.'
29
+ command [:g, :gen, :generate] do |gen|
30
+ gen.action do |global_opts, opts, args|
31
+ # TODO(mtwilliams): Use custom exception types and refactor out error
32
+ # messages. This will allow us to localize, among other things.
33
+ raise "You failed to specify a toolset!" if args.empty?
34
+ toolset = args.shift
35
+ raise "You specified an unknown toolset `#{toolset}'!"
36
+ end
37
+
38
+ gen.command :visual_studio do |vs|
39
+ # BUG(mtwilliams): Descriptions aren't being made available.
40
+ vs.desc 'Generate Visual Studio project files'
41
+ vs.long_desc 'Generates Visual Studio projects files, based on a Rybfile.'
42
+ vs.action do |global_opts, opts, args|
43
+ rybfile = Rybfile.load(args.shift || "Rybfile")
44
+ raise "Not implemented, yet."
45
+ end
46
+ end
47
+
48
+ gen.command :xcode do |xcode|
49
+ # BUG(mtwilliams): Descriptions aren't being made available.
50
+ xcode.desc 'Generate XCode project files'
51
+ xcode.long_desc 'Generates XCode projects files, based on a Rybfile.'
52
+ xcode.action do |global_opts, opts, args|
53
+ rybfile = Rybfile.load(args.shift || "Rybfile")
54
+ raise "Not implemented, yet."
55
+ end
56
+ end
57
+
58
+ gen.command :gmake do |gmake|
59
+ # BUG(mtwilliams): Descriptions aren't being made available.
60
+ gmake.desc 'Generate GNU Makefiles'
61
+ gmake.long_desc 'Generates GNU Makefiles, based on a Rybfile.'
62
+ gmake.action do |global_opts, opts, args|
63
+ rybfile = Rybfile.load(args.shift || "Rybfile")
64
+ raise "Not implemented, yet."
65
+ end
66
+ end
67
+
68
+ gen.command :ninja do |ninja|
69
+ # BUG(mtwilliams): Descriptions aren't being made available.
70
+ ninja.desc 'Generate Ninja build files'
71
+ ninja.long_desc 'Generates a build.ninja file for a specific toolchain, based on a Rybfile.'
72
+ ninja.flag 'for', :default_value => 'latest',
73
+ :type => String,
74
+ :arg_name => 'for',
75
+ :desc => 'The toolchain to use'
76
+
77
+ ninja.action do |global_opts, opts, args|
78
+ rybfile = Rybfile.load(args.shift || "Rybfile")
79
+
80
+ # # TODO(mtwilliams): Refactor out.
81
+ # # TODO(mtwilliams): Verify every platform+architecture is supported.
82
+ # targets = [*global_opts[:targets].split(';')].flat_map { |platform, architectures|
83
+ # architectures = [*(architectures.split(',') || ['*'])]
84
+ # [].fill(platform, 0, architectures.length).zip(architectures)
85
+ # }
86
+
87
+ # toolchains = begin
88
+ # pairings = global_opts[:toolchains].split(',')
89
+ # Hash[pairings.map { |pairing|
90
+ # platform, toolchain = *pairing.split(':')
91
+ # [platform, toolchain]
92
+ # }]
93
+ # end
94
+
95
+ Ryb::Ninja.generate_from(rybfile, root: global_opts[:root],
96
+ build: global_opts[:build],
97
+ targets: ['windows'],
98
+ toolchains: ['msvc'])
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,7 @@
1
+ module Ryb
2
+ module Code
3
+ include Pour::Pourable
4
+
5
+ property :sources, Typespec.array[Typespec.t[SourceFile]]
6
+ end
7
+ end
@@ -1,16 +1,22 @@
1
- require 'ryb/name'
2
- require 'ryb/properties'
3
-
4
1
  module Ryb
5
- class Configuration
6
- include Properties::Named
7
- include Properties::Suffix
8
- include Properties::Defines
9
- include Properties::Flags
2
+ class Configuration < Pour::Mould
3
+ property :name, Typespec.t[Name]
4
+
5
+ property :prefix, Typespec.string
6
+ property :suffix, Typespec.string
7
+
8
+ pour Environment
9
+ pour Preprocessor
10
+ pour Flags
11
+
12
+ pour Code
13
+
14
+ pour Dependencies
15
+ end
16
+
17
+ class Platform < Configuration
18
+ end
10
19
 
11
- def initialize(name, opts={})
12
- @name = Name.new(name, opts[:pretty])
13
- yield self if block_given?
14
- end
20
+ class Architecture < Configuration
15
21
  end
16
22
  end
@@ -0,0 +1,9 @@
1
+ module Ryb
2
+ module Configurations
3
+ include Pour::Pourable
4
+
5
+ property :configurations, Typespec.array[Typespec.t[Configuration]]
6
+ property :platforms, Typespec.array[Typespec.t[Platform]]
7
+ property :architectures, Typespec.array[Typespec.t[Architecture]]
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Ryb
2
+ module Dependencies
3
+ include Pour::Pourable
4
+
5
+ property :dependencies, Typespec.array[Typespec.t[Dependency]]
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ module Ryb
2
+ class Dependency < Pour::Mould
3
+ end
4
+
5
+ class InternalDependency < Dependency
6
+ property :product, Typespec.symbol
7
+
8
+ def initialize(product)
9
+ self.product = product
10
+ end
11
+
12
+ alias :eql? :==
13
+ def ==(other)
14
+ self.product == other.product
15
+ end
16
+ end
17
+
18
+ class ExternalDependency < Dependency
19
+ property :lib_or_framework, Typespec.string
20
+
21
+ def initialize(lib_or_framework)
22
+ self.lib_or_framework = lib_or_framework
23
+ end
24
+
25
+ alias :eql? :==
26
+ def ==(other)
27
+ self.lib_or_framework == other.lib_or_framework
28
+ end
29
+ end
30
+ end