fhir-crucible / fhir_client

Ruby FHIR Client
Apache License 2.0
163 stars 61 forks source link

bundle exec rake fhir:console (error) #101

Open dbbooke opened 6 years ago

dbbooke commented 6 years ago

When I try to run that command I get the following error....

rake aborted! Don't know how to build task 'fhir:console' (see --tasks) /Users/darrenbooker/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/exe/rake:27:in<top (required)>' /Users/darrenbooker/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in eval' /Users/darrenbooker/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in

' (See full trace by running task with --trace)`

jawalonoski commented 6 years ago

While in the fhir_client folder, after running bundle install... when you run bundle exec rake --tasks you should see something like this:

$ bundle exec rake --tasks
rake build                                     # Build fhir_client-3.0.5.gem into the pkg directory
rake clean                                     # Remove any temporary products
rake clobber                                   # Remove any generated files
rake fhir:clean[url]                           # delete all resources for a given server
rake fhir:console                              # console
rake fhir:count[url,display_zero]              # count all resources for a given server
rake fhir:oauth2[url,client_id,client_secret]  # OAuth2 Example
rake install                                   # Build and install fhir_client-3.0.5.gem into system gems
rake install:local                             # Build and install fhir_client-3.0.5.gem into system gems without network access
rake release[remote]                           # Create tag v3.0.5 and build and push fhir_client-3.0.5.gem to rubygems.org
rake rubocop                                   # Run rubocop
rake test                                      # Run tests

Can you confirm?

dbbooke commented 6 years ago

so after running bundle install

`Your Gemfile lists the gem listen (< 3.2, >= 3.0.5) more than once.`
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.1.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.1.6
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.4
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.1.6
Using rack 2.0.5
Using rack-test 1.1.0
Using actionpack 5.1.6
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.6
Using globalid 0.4.1
Using activejob 5.1.6
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.1.6
Using activemodel 5.1.6
Using arel 8.0.0
Using activerecord 5.1.6
Using public_suffix 3.0.2
Using addressable 2.5.2
Using net-ssh 5.0.2
Using net-scp 1.2.1
Using sshkit 1.17.0
Using airbrussh 1.3.0
Using bcp47 0.3.3
Using bcrypt 3.1.12
Using bindex 0.5.0
Using bundler 1.16.3
Using byebug 10.0.2
Using capistrano 3.11.0
Using capistrano-bundler 1.3.0
Using capistrano-rails 1.4.0
Using capistrano-rbenv 2.1.3
Using puma 3.12.0
Using capistrano3-puma 3.1.1
Using xpath 3.1.0
Using capybara 2.18.0
Using ffi 1.9.25
Using childprocess 0.9.0
Using cliver 0.3.2
Using cocoon 1.2.11
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.1.6
Using coffee-rails 4.2.2
Using date_time_precision 0.8.1
Using orm_adapter 0.5.0
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.4.3
Using unf_ext 0.0.7.5
Using unf 0.1.4
Using domain_name 0.5.20180417
Using faker 1.9.1
Using multipart-post 2.0.0
Using faraday 0.12.2
Using mime-types 2.99.3
Using fhir_dstu2_models 1.0.4
Using fhir_models 3.0.3
Using jwt 1.5.6
Using multi_json 1.13.1
Using multi_xml 0.6.0
Using oauth2 1.4.0
Using http-cookie 1.0.3
Using netrc 0.11.0
Using rest-client 2.0.2
Using tilt 2.0.8
Using fhir_client 3.0.5
Using jbuilder 2.7.0
Using kaminari-core 1.1.1
Using kaminari-actionview 1.1.1
Using kaminari-activerecord 1.1.1
Using kaminari 1.1.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using ruby_dep 1.5.0
Using listen 3.1.5
Using safe_shell 1.1.0
Using pdf-forms 1.1.2
Using pundit 2.0.0
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.1.6
Using rubyzip 1.2.1
Using sass-listen 4.0.0
Using sass 3.5.7
Using sass-rails 5.0.7
Using selenium-webdriver 3.14.0
Using spring 2.0.2
Using spring-watcher-listen 2.0.1
Using sqlite3 1.3.13
Using turbolinks-source 5.1.0
Using turbolinks 5.1.1
Using twilio-ruby 5.10.7
Using uglifier 4.1.18
Using web-console 3.6.2
Bundle complete! 30 Gemfile dependencies, 112 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.`

AFTER I RUN THE COMMAND bundle exec rake --tasks I get this in return. I am running rails 5 by the way and I am trying to use this gem inside of an existing rails app

`rake about                              # List versions of all Rails frameworks...
rake app:template                       # Applies the template supplied by LOCA...
rake app:update                         # Update configs and some other initial...
rake assets:clean[keep]                 # Remove old compiled assets
rake assets:clobber                     # Remove compiled assets
rake assets:environment                 # Load asset compile environment
rake assets:precompile                  # Compile all the assets named in confi...
rake cache_digests:dependencies         # Lookup first-level dependencies for T...
rake cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLA...
rake db:create                          # Creates the database from DATABASE_UR...
rake db:drop                            # Drops the database from DATABASE_URL ...
rake db:environment:set                 # Set the environment value for the dat...
rake db:fixtures:load                   # Loads fixtures into the current envir...
rake db:migrate                         # Migrate the database (options: VERSIO...
rake db:migrate:status                  # Display status of migrations
rake db:rollback                        # Rolls the schema back to the previous...
rake db:schema:cache:clear              # Clears a db/schema_cache.yml file
rake db:schema:cache:dump               # Creates a db/schema_cache.yml file
rake db:schema:dump                     # Creates a db/schema.rb file that is p...
rake db:schema:load                     # Loads a schema.rb file into the database
rake db:seed                            # Loads the seed data from db/seeds.rb
rake db:setup                           # Creates the database, loads the schem...
rake db:structure:dump                  # Dumps the database structure to db/st...
rake db:structure:load                  # Recreates the databases from the stru...
rake db:version                         # Retrieves the current schema version ...
rake dev:cache                          # Toggle development mode caching on/off
rake initializers                       # Print out all defined initializers in...
rake log:clear                          # Truncates all/specified *.log files i...
rake middleware                         # Prints out your Rack middleware stack
rake notes                              # Enumerate all annotations (use notes:...
rake notes:custom                       # Enumerate a custom annotation, specif...
rake restart                            # Restart app by touching tmp/restart.txt
rake routes                             # Print out all defined routes in match...
rake secret                             # Generate a cryptographically secure s...
rake stats                              # Report code statistics (KLOCs, etc) f...
rake test                               # Runs all tests in test folder except ...
rake test:db                            # Run tests quickly, but also reset db
rake test:system                        # Run system tests only
rake time:zones[country_or_offset]      # List all time zones, list by two-lett...
rake tmp:clear                          # Clear cache and socket files from tmp...
rake tmp:create                         # Creates tmp directories for cache, so...
rake yarn:install                       # Install all JavaScript dependencies a...
`
jawalonoski commented 6 years ago

The fhir:console task is defined in the source code of the fhir_client project. Specifically, it is here: https://github.com/fhir-crucible/fhir_client/blob/master/lib/fhir_client/tasks/tasks.rake

In order to be accessible to rails projects (or any arbitrary project using the gem) I believe we would need to move the rake tasks from lib/fhir_client/tasks to lib/tasks... although I haven't tested this.

AndrewRayCode commented 6 years ago

It looks like you want to add a Railties setup, http://mdzhang.com/blog/code/2016/09/10/create-ruby-gem-that-adds-rake-tasks/

eugesma commented 5 years ago

Same problem here... How can i use the gem without the tasks?

serg2801 commented 5 years ago

Same problem here

serg2801 commented 5 years ago

hi @dbbooke did you resolve this issue? I have same issue.

tute commented 5 years ago

You can load the console within your rails app with:

spec = Gem::Specification.find_by_name("fhir_client")
load "#{spec.gem_dir}/lib/fhir_client/tasks/tasks.rake"
Rake::Task["fhir:console"].invoke

But it might not be useful for integrating the gem with your project, it just opens an IRB console. 😄

karthikishorejs commented 4 years ago

Is this issue resolved in the release 4.0.4?

onwardmk commented 7 months ago

I just installed the gem and am running across the same issue. Is this going to be fixed?

onwardmk commented 7 months ago

Here's what I ended up doing:

  1. Copied the Rake file from the gem folder to /lib/tasks/fhir.rake
  2. Edited the task in fhir.rake to this:
      desc "console"
      task :console, [] do
        exec("ruby bin/fhir/console")
      end
  3. Copied the bin file from the gem folder to /bin/fhir/console